本文整理汇总了C++中Path::FindStartOfPath方法的典型用法代码示例。如果您正苦于以下问题:C++ Path::FindStartOfPath方法的具体用法?C++ Path::FindStartOfPath怎么用?C++ Path::FindStartOfPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path
的用法示例。
在下文中一共展示了Path::FindStartOfPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RedrawDiagram
void ArrangeAlignment::RedrawDiagram(ReDrawInfoType* ExtraInfo)
{
// objects drawn in the render region must be relatively large in the given coord space
// else Gavin's curve flattening results in visible straight lines
// so every dimension is scaled by scale
INT32 scale=1000;
// make a render region
DocRect VirtRendRect;
VirtRendRect.lo.x=-1*scale;
VirtRendRect.lo.y=-2*scale;
VirtRendRect.hi.x=(DiagWidth +1)*scale;
VirtRendRect.hi.y=(DiagHeight+2)*scale;
RenderRegion* pRender=CreateGRenderRegion(&VirtRendRect,ExtraInfo);
if (pRender!=NULL)
{
pRender->SaveContext();
// currently this must be set here before any colour tables calculated
Quality AntiAliasQuality(Quality::QualityMax);
QualityAttribute AntiAliasQualityAttr(AntiAliasQuality);
pRender->SetQuality(&AntiAliasQualityAttr,FALSE);
// Render the background rectangle
DialogColourInfo RedrawColours;
pRender->SetLineColour(RedrawColours.DialogBack());
pRender->SetFillColour(RedrawColours.DialogBack());
pRender->DrawRect(&VirtRendRect);
// declared at this scope else RestoreContext() dies!
RadialFillAttribute Fill;
// set up some defaults used by all objects
Fill.MakeElliptical();
Fill.Colour=DocColour(255,255,255);
pRender->SetLineColour(BLACK);
pRender->SetLineWidth(0);
for (INT32 i=0; i<DiagRects; i++)
{
// reverse order in which objets are rendered (now filled!)
INT32 j=DiagRects-1-i;
// set fill colour of each object
switch (j)
{
case 0: Fill.EndColour=DocColour(255,255,0); break;
case 1: Fill.EndColour=DocColour(0,0,255); break;
case 2: Fill.EndColour=DocColour(255,0,0); break;
case 3: Fill.EndColour=DocColour(0,160,0); break;
default: Fill.EndColour=DocColour(0,0,0); break;
}
// get bound rect of object to be drawn
INT32 x=DiagRectX[Align.h][j].lo*scale;
INT32 w=DiagRectX[Align.h][j].hi*scale-x;
INT32 y=DiagRectY[Align.v][j].lo*scale;
INT32 h=DiagRectY[Align.v][j].hi*scale-y;
// create shape and fill geometries
Path shape;
shape.Initialise(16,8);
shape.IsFilled=TRUE;
shape.FindStartOfPath();
switch (j)
{
case 0:
{
// create a rectangle
shape.InsertMoveTo(DocCoord(x,y));
shape.InsertLineTo(DocCoord(x,y+h));
shape.InsertLineTo(DocCoord(x+w,y+h));
shape.InsertLineTo(DocCoord(x+w,y));
shape.InsertLineTo(DocCoord(x,y));
// // create a radial fill
// Fill.StartPoint=DocCoord(x+w*3/16,y+h*3/4);
// Fill.EndPoint =DocCoord(x+w*3/8,y+h/2);
// Fill.EndPoint2 =DocCoord(x+w*3/8,y+h);
break;
}
case 1:
{
// create a pseudo ellipse
shape.InsertMoveTo( DocCoord(x,y+h/2));
shape.InsertCurveTo(DocCoord(x,y+h*3/4), DocCoord(x+w/4,y+h), DocCoord(x+w/2,y+h));
shape.InsertCurveTo(DocCoord(x+w*3/4,y+h),DocCoord(x+w,y+h*3/4),DocCoord(x+w,y+h/2));
shape.InsertCurveTo(DocCoord(x+w,y+h/4), DocCoord(x+w*3/4,y), DocCoord(x+w/2,y));
shape.InsertCurveTo(DocCoord(x+w/4,y), DocCoord(x,y+h/4), DocCoord(x,y+h/2));
// // create a radial fill
// Fill.StartPoint=DocCoord(x+w*3/8,y+h*5/8);
// Fill.EndPoint =DocCoord(x+w*6/8,y+h/4);
// Fill.EndPoint2 =DocCoord(x+w*6/8,y+h);
break;
}
default:
//.........这里部分代码省略.........
示例2: CreateStockArrow
BOOL ArrowRec::CreateStockArrow(StockArrow ArrowType)
{
if (ArrowShape != NULL)
{
delete ArrowShape;
ArrowShape = NULL;
}
BOOL ok;
Path* pPath;
const INT32 Size = 3;
const INT32 Width = (72000/2)*3;
if (ArrowType >= NUM_STOCK_ARROWS)
ArrowType = SA_STRAIGHTARROW;
// Set the ArrowID
ArrowID = ArrowType;
switch (ArrowType)
{
case SA_STRAIGHTARROW:
/*
STRAIGHT
-9 54 m
-9 0 l
-9 -54 l
117 0 l
-9 54 l
-9 54 l
*/
pPath = new Path();
if (pPath == NULL)
return FALSE;
ok = pPath->Initialise(4);
if (ok) pPath->FindStartOfPath();
if (ok) ok = pPath->InsertMoveTo(DocCoord( -9000, 54000));
if (ok) ok = pPath->InsertLineTo(DocCoord( -9000, -54000));
if (ok) ok = pPath->InsertLineTo(DocCoord(117000, 0));
if (ok) ok = pPath->CloseSubPath();
if (!ok)
{
delete pPath;
return FALSE;
}
pPath->IsFilled = TRUE;
pPath->IsStroked = FALSE;
ArrowShape = pPath;
Centre = DocCoord(0,0);
LineWidth = Width;
ArrowWidth = INT32(Size);
ArrowHeight = INT32(Size);
IsNull = FALSE;
StartArrow = FALSE;
break;
case SA_ANGLEDARROW:
/*
ANGLED
-26.999 53.999 m
-9 0 l
-26.999 -54.001 l
135 0 l
-26.999 53.999 l
*/
pPath = new Path();
if (pPath == NULL)
return FALSE;
ok = pPath->Initialise(5);
if (ok) pPath->FindStartOfPath();
if (ok) ok = pPath->InsertMoveTo(DocCoord(-27000, 54000));
if (ok) ok = pPath->InsertLineTo(DocCoord( -9000, 0));
if (ok) ok = pPath->InsertLineTo(DocCoord(-27000, -54000));
if (ok) ok = pPath->InsertLineTo(DocCoord(135000, 0));
if (ok) ok = pPath->CloseSubPath();
if (!ok)
{
delete pPath;
return FALSE;
}
pPath->IsFilled = TRUE;
pPath->IsStroked = FALSE;
ArrowShape = pPath;
Centre = DocCoord(0,0);
LineWidth = Width;
//.........这里部分代码省略.........
示例3: RenderControl
void RenderDemoDlg::RenderControl(ReDrawInfoType* ExtraInfo)
{
// Go get a render region
DocRect VirtualSize(-ExtraInfo->dx/2, -ExtraInfo->dy/2, ExtraInfo->dx/2, ExtraInfo->dy/2);
RenderRegion* pRender = CreateGRenderRegion(&VirtualSize, ExtraInfo);
if (pRender!=NULL)
{
DialogColourInfo RedrawColours; // Get a supplier for default dlg colours
// Render stuff in here
// Build a Linear fill attribute
LinearFillAttribute MyGradFill;
MyGradFill.Colour = DocColour(255, 255, 0);
MyGradFill.EndColour = DocColour(0, 255, 255);
MyGradFill.StartPoint = DocCoord(0, ExtraInfo->dy);
MyGradFill.EndPoint = DocCoord(ExtraInfo->dx, 0);
// Build a path
Path InkPath;
InkPath.Initialise(12,12);
InkPath.FindStartOfPath();
// Get the coords used to build a shape
INT32 dx = ExtraInfo->dx / 2;
INT32 dy = ExtraInfo->dy / 2;
INT32 Midx = ExtraInfo->dx / 4;
INT32 Midy = ExtraInfo->dy / 4;
// build a circle in the middle of the control
InkPath.InsertMoveTo(DocCoord(Midx, dy));
InkPath.InsertCurveTo(DocCoord(Midx+Midx/2, dy), DocCoord(dx, Midy+Midy/2), DocCoord(dx, Midy));
InkPath.InsertCurveTo(DocCoord(dx, Midy-Midy/2), DocCoord(Midx+Midx/2, 0), DocCoord(Midx, 0));
InkPath.InsertCurveTo(DocCoord(Midx-Midx/2, 0), DocCoord(0, Midy-Midy/2), DocCoord(0, Midy));
InkPath.InsertCurveTo(DocCoord(0, Midy+Midy/2), DocCoord(Midx-Midx/2, dy), DocCoord(Midx, dy));
InkPath.IsFilled = TRUE;
// A Grey colour [...hmmm, it's not a very grey grey any more... oragnge more like]
DocColour Grey(255,200,0);
// Render the attributes and the a rectangle
pRender->SaveContext();
pRender->SetLineColour(Grey);
// Draw a rectangle to fill in the background - Fill with Dialogue Background colour
DocRect DrawMe(0, 0, ExtraInfo->dx, ExtraInfo->dy);
pRender->SetFillColour(RedrawColours.DialogBack());
pRender->DrawRect(&VirtualSize);
// Draw some shapes and stuff
pRender->SetFillGeometry(&MyGradFill, FALSE);
pRender->DrawPath(&InkPath);
// Build a path
Path TriPath;
TriPath.Initialise(12,12);
TriPath.FindStartOfPath();
// build a circle in the middle of the control
TriPath.InsertMoveTo(VirtualSize.lo);
TriPath.InsertLineTo(DocCoord(VirtualSize.hi.x, VirtualSize.lo.y));
TriPath.InsertLineTo(DocCoord(0, VirtualSize.hi.y));
TriPath.InsertLineTo(VirtualSize.lo);
TriPath.IsFilled = TRUE;
LinearFillAttribute MyTriFill;
MyTriFill.Colour = ShowFirst ? First : Second;
MyTriFill.EndColour = DocColour(0,0,0);
MyTriFill.StartPoint = DocCoord(ExtraInfo->dx, 0);
MyTriFill.EndPoint = DocCoord(0, ExtraInfo->dy);
pRender->SetFillGeometry(&MyTriFill, FALSE);
pRender->DrawPath(&TriPath);
pRender->RestoreContext();
// Get rid of the render region
DestroyGRenderRegion(pRender);
}
// and animate it!
if (ShowFirst)
{
INT32 Red, Green, Blue;
First.GetRGBValue(&Red, &Green, &Blue);
if (Blue>0)
{
// Set the colour back again
Blue -= 10;
First.SetRGBValue(Red, Green, Blue);
// redraw it
InvalidateGadget(_R(IDC_REDRAW_ME));
}
}
else
{
// Set the colour back to how it was
First.SetRGBValue(255, 0, 250);
}
//.........这里部分代码省略.........