本文整理汇总了C++中DrawShape函数的典型用法代码示例。如果您正苦于以下问题:C++ DrawShape函数的具体用法?C++ DrawShape怎么用?C++ DrawShape使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DrawShape函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: painter
void Orientation_Widget::paintEvent(QPaintEvent * event)
{
(void)event;
QPainter painter(this);
// Draw the border and fill the background
painter.setRenderHint(QPainter::Antialiasing, false);
painter.setBrush( painter.background() );
painter.setPen( Qt::NoPen );
painter.drawRect( 0, 0, width(), height() );
painter.setBrush( Qt::NoBrush );
painter.setPen( QPen( QColor::fromRgb(0,0,0)) );
painter.setRenderHint(QPainter::Antialiasing, true);
CenterX = (float)(width() / 2);
CenterY = (float)(height() / 2);
DrawScale = ViewScale * ((float)width()/ 560.0f);
if(bQuat2Valid) {
DrawShape( painter, mat2, QColor::fromRgb(192,192,192), QuadPt, QuadLine );
}
DrawShape( painter, mat, QColor::fromRgb(0,0,0), QuadPt, QuadLine );
}
示例2: DoMouseMove
void DoMouseMove(HWND hWnd,LONG lParam)
{
HDC hdc;
if (mouseDown)
{
hdc = GetDC(hWnd);
/*
* Erase the old shape.
*/
SaveROP = SetROP2(hdc,R2_NOTXORPEN);
DrawShape(hdc, thisShape[CurrentPoint].Points.left,
thisShape[CurrentPoint].Points.top, oldx, oldy,
thisShape[CurrentPoint].theShape,
thisShape[CurrentPoint].PenWidth,
thisShape[CurrentPoint].PenColor, 1);
/*
* At this point, the slope must be positive because
* the coordinates could not have been switched.
* The next step is to draw the new shape.
*/
oldx = LOWORD(lParam);
oldy = HIWORD(lParam);
DrawShape(hdc, thisShape[CurrentPoint].Points.left,
thisShape[CurrentPoint].Points.top, oldx, oldy,
thisShape[CurrentPoint].theShape,
thisShape[CurrentPoint].PenWidth,
thisShape[CurrentPoint].PenColor, 1);
SetROP2(hdc,SaveROP);
ReleaseDC(hWnd,hdc);
}
}
示例3: ProcessFace
static void ProcessFace(
CImage& cimg, // io: color version of image
const float* landmarks, // in
int nfaces, // in
const char* imgpath) // in
{
Shape shape(LandmarksAsShape(landmarks));
shape = ConvertShape(shape, nlandmarks_g);
if (shape.rows == 0)
Err("Cannot convert to a %d point shape", nlandmarks_g);
if (writeimgs_g)
DrawShape(cimg, shape);
if (multiface_g)
{
logprintf("face %d\n", nfaces);
double xmin, xmax, ymin, ymax; // needed to position face nbr
ShapeMinMax(xmin, xmax, ymin, ymax, shape);
ImgPrintf(cimg,
(xmin + xmax)/2, ymin - (ymax-ymin)/50., 0xff0000, 1,
"%d", nfaces);
}
if (csv_g)
LogShapeAsCsv(shape, imgpath);
else
LogShape(shape, imgpath);
}
示例4: WriteLandmarkedImg
static void WriteLandmarkedImg(
const Image& img, // in: the image
const char* newpath, // in: the image path
const Shape& shape, // in: the shape
const Shape& cropshape, // in: crop image to this shape (typically the ref shape)
unsigned color=C_RED, // in: rrggbb e.g. 0xff0000 is red
int iworst=-1) // in: index of worst fitting point, -1 for none
{
CImage cimg; cvtColor(img, cimg, CV_GRAY2BGR); // color image
if (iworst >= 0) // draw circle at worst fitting point?
cv::circle(cimg,
cv::Point(cvRound(shape(iworst, IX)),
cvRound(shape(iworst, IY))),
MAX(2, cvRound(ShapeWidth(shape) / 40)),
cv::Scalar(255, 255, 0), 2); // cyan
DrawShape(cimg, shape, color);
if (crop_g)
CropCimgToShapeWithMargin(cimg, cropshape);
if (!cv::imwrite(newpath, cimg))
Err("Cannot write %s", newpath);
}
示例5: DrawNode
void DrawNode(R3Scene *scene, R3Node *node)
{
// Push transformation onto stack
glPushMatrix();
LoadMatrix(&node->transformation);
// Load material
if (node->material) LoadMaterial(node->material);
// Draw shape
if (node->shape) DrawShape(node->shape);
// Draw children nodes
for (int i = 0; i < (int) node->children.size(); i++)
DrawNode(scene, node->children[i]);
// Restore previous transformation
glPopMatrix();
// Show bounding box
if (show_bboxes) {
GLboolean lighting = glIsEnabled(GL_LIGHTING);
glDisable(GL_LIGHTING);
node->bbox.Outline();
if (lighting) glEnable(GL_LIGHTING);
}
}
示例6: DrawParticleSinks
void DrawParticleSinks(R3Scene *scene)
{
// Check if should draw particle sinks
if (!show_particle_sources_and_sinks) return;
// Setup
GLboolean lighting = glIsEnabled(GL_LIGHTING);
glEnable(GL_LIGHTING);
// Define sink material
static R3Material sink_material;
if (sink_material.id != 33) {
sink_material.ka.Reset(0.2,0.2,0.2,1);
sink_material.kd.Reset(1,0,0,1);
sink_material.ks.Reset(1,0,0,1);
sink_material.kt.Reset(0,0,0,1);
sink_material.emission.Reset(0,0,0,1);
sink_material.shininess = 1;
sink_material.indexofrefraction = 1;
sink_material.texture = NULL;
sink_material.texture_index = -1;
sink_material.id = 33;
}
// Draw all particle sinks
glEnable(GL_LIGHTING);
LoadMaterial(&sink_material);
for (int i = 0; i < scene->NParticleSinks(); i++) {
R3ParticleSink *sink = scene->ParticleSink(i);
DrawShape(sink->shape);
}
// Clean up
if (!lighting) glDisable(GL_LIGHTING);
}
示例7: DrawLanders
void DrawLanders()
{
// draw the landers in 2 colors
NxU32 nbActors = gScene->getNbActors();
NxActor** actors = gScene->getActors();
while (nbActors--)
{
NxActor* actor = *actors++;
const char *name=actor->getName();
if (strcmp(name,"~lander")==0) {
NxShape*const* shapes;
shapes = actor->getShapes();
NxU32 nShapes = actor->getNbShapes();
//glDisable(GL_LIGHTING);
char sname[256]="";
while (nShapes--)
{
sprintf(sname,"%s",shapes[nShapes]->getName());
if (strcmp(sname,"upside")==0)
glColor4f(0.0f,1.0f,0.0f,1.0f);
else if (strcmp(sname,"downside")==0)
glColor4f(1.0f,0.0f,0.0f,1.0f);
else if (strcmp(sname,"U1")==0)
glColor4f(1.0f,0.0f,0.0f,1.0f);
else if (strcmp(sname,"U2")==0)
glColor4f(0.0f,1.0f,0.0f,1.0f);
else if (strcmp(sname,"U3")==0)
glColor4f(0.0f,0.0f,1.0f,1.0f);
DrawShape(shapes[nShapes], false);
}
//glEnable(GL_LIGHTING);
}
}
}
示例8: DrawActor
void DrawActor(NxActor* actor, NxActor* gSelectedActor)
{
NxShape*const* shapes = actor->getShapes();
NxU32 nShapes = actor->getNbShapes();
if (actor == gSelectedActor)
{
while (nShapes--)
{
DrawWireShape(shapes[nShapes], NxVec3(1,1,1));
}
}
NxVec3 defaultColor = NxVec3(0.65f, 0.67f, 0.63f);
NxVec3 dynamicActiveColor = NxVec3(0.82f, 0.77f, 0.73f);
NxVec3 dynamicSleepingColor = NxVec3(0.6f, 0.6f, 0.6f);
NxVec3 kinematicColor = NxVec3(0.73f, 0.77f, 0.82f);
nShapes = actor->getNbShapes();
while (nShapes--)
{
NxVec3 color = defaultColor;
if (actor->isDynamic())
{
if (actor->readBodyFlag(NX_BF_KINEMATIC))
color = kinematicColor;
else
if (actor->isSleeping())
color = dynamicSleepingColor;
else
color = dynamicActiveColor;
}
DrawShape(shapes[nShapes], color);
}
}
示例9: CleanupClosePushL
/**
Starts test step
@return TVerdict pass / fail
*/
enum TVerdict CT_WServGenericpluginStepLoad::doTestStepL()
{
__UHEAP_MARK;
RWindow win;
CleanupClosePushL(win);
CreateRWindowL(iWinGroup, win, KWinPos, KRgbBlue, KWinSize);
DrawShape(win);
RWindow win1;
CleanupClosePushL(win1);
if(iScreen1)
{
CreateRWindowL(iWinGroup1, win1, KWinPos, KRgbBlue, KWinSize);
DrawShape(win1);
}
switch( iTestId )
{
case 1:
INFO_PRINTF1(_L("Testing Control of CWsPlugin loading from WSINI.INI..."));
GraphicsWservGenericpluginLoad1L();
break;
case 2:
INFO_PRINTF1(_L("Testing that plugins can be specified on a per-screen basis through WSINI.INI file..."));
GraphicsWservGenericpluginLoad2L();
break;
case 3:
INFO_PRINTF1(_L("Testing Integer and string attributes in WSINI.INI file can be read from CWsPlugin..."));
GraphicsWservGenericpluginLoad3L();
break;
case 4:
INFO_PRINTF1(_L("Testing CWsPlugin can gain information about closing windows using MWsWindow interface..."));
GraphicsWservGenericpluginLoad4L();
break;
case 5:
INFO_PRINTF1(_L("Testing CWsPlugin can obtain instance of another CWPlugin..."));
GraphicsWservGenericpluginLoad5L();
break;
default:
break;
}
CleanupStack::PopAndDestroy(2,&win);
__UHEAP_MARKEND;
return TestStepResult();
}
示例10: col
void nuiDrawContext::DrawPoint(float x, float y)
{
nuiShape shp;
shp.AddCircle(x, y, mCurrentState.mLineWidth);
nuiColor col(mCurrentState.mFillColor);
SetFillColor(mCurrentState.mStrokeColor);
DrawShape(&shp, eFillShape);
SetFillColor(col);
}
示例11: slowdown
void slowdown(){
Touch();
//if(Touch_ret)
asm("lda %b",Touch_ret);
asm("beq %g",else1);
TouchDo();
asm("rts");
else1:
//PosY--;
asm("dec %b",PosY);
DrawShape();
}
示例12: while
void DrawPxShapes::DrawActor( PxRigidActor* actor )
{
PxU32 nShapes = actor->getNbShapes();
PxShape** shapes = new PxShape*[ nShapes ];
actor->getShapes( shapes, nShapes );
while ( nShapes-- )
{
DrawShape( shapes[ nShapes ] );
}
delete [] shapes;
}
示例13: FillShape
void UIShape::OnDraw(UIDrawingContext& context)
{
UIVisual::OnDraw(context);
const RectF clippedBounds = context.GetCurrentClippedBounds();
const RectF bounds = context.GetCurrentBounds();
if (fillColor.A > 0)
FillShape(context, clippedBounds, bounds, fillColor);
if (lineColor.A > 0)
DrawShape(context, clippedBounds, bounds, lineColor);
}
示例14: rotate
void rotate(){
//NowDirectionNo=(NowDirectionNo+4+rotate_n)&3;
asm("lda %b",NowDirectionNo);
asm("clc");
asm("adc #$04");
asm("adc %b",rotate_n);
asm("and #$03");
asm("sta %b",NowDirectionNo);
getNowLeft();
//if(PosX+getBlock_ret>10)
asm("lda %b",getBlock_ret);
asm("clc");
asm("adc %b",PosX);
asm("cmp #$0A");
asm("bmi %g",else1);
asm("beq %g",else1);
//rotate_tempPosX=PosX;
asm("lda %b",PosX);
asm("sta %b",rotate_tempPosX);
//PosX=10-getBlock_ret;
asm("lda #$0A");
asm("sec");
asm("sbc %b",getBlock_ret);
asm("sta %b",PosX);
AnyTouch();
//if(0==AnyTouch_ret)jmp jp2
asm("lda %b",AnyTouch_ret);
asm("beq %g",jp2);
//PosX=rotate_tempPosX;
asm("lda %b",rotate_tempPosX);
asm("sta %b",PosX);
asm("jmp %g",jp1);
else1:
AnyTouch();
//if(AnyTouch_ret)asm("jmp %g",jp1);
asm("lda %b",AnyTouch_ret);
asm("beq %g",jp2);
jp1:
//NowDirectionNo=(NowDirectionNo+4-rotate_n)&3;
asm("lda %b",NowDirectionNo);
asm("clc");
asm("adc #$04");
asm("sec");
asm("sbc %b",rotate_n);
asm("and #$03");
asm("sta %b",NowDirectionNo);
jp2:
DrawShape();
}
示例15: GetPolygonPoints
void
AirspacePreviewRenderer::Draw(Canvas &canvas, const AbstractAirspace &airspace,
const RasterPoint pt, unsigned radius,
const AirspaceRendererSettings &settings,
const AirspaceLook &look)
{
AbstractAirspace::Shape shape = airspace.GetShape();
AirspaceClass type = airspace.GetType();
// Container for storing the points of a polygon airspace
std::vector<RasterPoint> pts;
if (shape == AbstractAirspace::Shape::POLYGON && !IsAncientHardware())
GetPolygonPoints(pts, (const AirspacePolygon &)airspace, pt, radius);
if (PrepareFill(canvas, type, look, settings)) {
DrawShape(canvas, shape, pt, radius, pts);
UnprepareFill(canvas);
}
if (PrepareOutline(canvas, type, look, settings))
DrawShape(canvas, shape, pt, radius, pts);
}