本文整理汇总了C++中Polyline函数的典型用法代码示例。如果您正苦于以下问题:C++ Polyline函数的具体用法?C++ Polyline怎么用?C++ Polyline使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Polyline函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: to_polylines
inline Polylines to_polylines(ExPolygon &&src)
{
Polylines polylines;
polylines.assign(src.holes.size() + 1, Polyline());
size_t idx = 0;
Polyline &pl = polylines[idx ++];
pl.points = std::move(src.contour.points);
pl.points.push_back(pl.points.front());
for (Polygons::const_iterator ith = src.holes.begin(); ith != src.holes.end(); ++ith) {
Polyline &pl = polylines[idx ++];
pl.points = std::move(ith->points);
pl.points.push_back(ith->points.front());
}
assert(idx == polylines.size());
return polylines;
}
开发者ID:jiripech,项目名称:Slic3r,代码行数:16,代码来源:ExPolygon.hpp
示例2: _clipper_pl
Polylines _clipper_pl(ClipperLib::ClipType clipType, const Polygons &subject, const Polygons &clip, bool safety_offset_)
{
// transform input polygons into polylines
Polylines polylines;
polylines.reserve(subject.size());
for (Polygons::const_iterator polygon = subject.begin(); polygon != subject.end(); ++polygon)
polylines.emplace_back(polygon->operator Polyline()); // implicit call to split_at_first_point()
// perform clipping
Polylines retval = _clipper_pl(clipType, polylines, clip, safety_offset_);
/* If the split_at_first_point() call above happens to split the polygon inside the clipping area
we would get two consecutive polylines instead of a single one, so we go through them in order
to recombine continuous polylines. */
for (size_t i = 0; i < retval.size(); ++i) {
for (size_t j = i+1; j < retval.size(); ++j) {
if (retval[i].points.back() == retval[j].points.front()) {
/* If last point of i coincides with first point of j,
append points of j to i and delete j */
retval[i].points.insert(retval[i].points.end(), retval[j].points.begin()+1, retval[j].points.end());
retval.erase(retval.begin() + j);
--j;
} else if (retval[i].points.front() == retval[j].points.back()) {
/* If first point of i coincides with last point of j,
prepend points of j to i and delete j */
retval[i].points.insert(retval[i].points.begin(), retval[j].points.begin(), retval[j].points.end()-1);
retval.erase(retval.begin() + j);
--j;
} else if (retval[i].points.front() == retval[j].points.front()) {
/* Since Clipper does not preserve orientation of polylines,
also check the case when first point of i coincides with first point of j. */
retval[j].reverse();
retval[i].points.insert(retval[i].points.begin(), retval[j].points.begin(), retval[j].points.end()-1);
retval.erase(retval.begin() + j);
--j;
} else if (retval[i].points.back() == retval[j].points.back()) {
/* Since Clipper does not preserve orientation of polylines,
also check the case when last point of i coincides with last point of j. */
retval[j].reverse();
retval[i].points.insert(retval[i].points.end(), retval[j].points.begin()+1, retval[j].points.end());
retval.erase(retval.begin() + j);
--j;
}
}
}
return retval;
}
开发者ID:prusa3d,项目名称:Slic3r,代码行数:47,代码来源:ClipperUtils.cpp
示例3: AngleLimit360
/*
* VENTA3 This is a modified Segment()
*/
int LKSurface::DrawArc(long x, long y, int radius, const RECT& rc, double start, double end) {
POINT pt[66];
int i;
int istart;
int iend;
if ((x - radius) > rc.right) return false;
if ((x + radius) < rc.left) return false;
if ((y - radius) > rc.bottom) return false;
if ((y + radius) < rc.top) return false;
// JMW added faster checking...
start = AngleLimit360(start);
end = AngleLimit360(end);
istart = iround(start / 360.0 * 64);
iend = iround(end / 360.0 * 64);
int npoly = 0;
if (istart > iend) {
iend += 64;
}
istart++;
iend--;
pt[npoly].x = x + (long) (radius * fastsine(start));
pt[npoly].y = y - (long) (radius * fastcosine(start));
npoly++;
for (i = 0; i < 64; i++) {
if (i <= iend - istart) {
pt[npoly].x = x + (long) (radius * xcoords[(i + istart) % 64]);
pt[npoly].y = y - (long) (radius * ycoords[(i + istart) % 64]);
npoly++;
}
}
pt[npoly].x = x + (long) (radius * fastsine(end));
pt[npoly].y = y - (long) (radius * fastcosine(end));
npoly++;
Polyline(pt, npoly, rc);
return true;
}
开发者ID:LK8000,项目名称:LK8000,代码行数:49,代码来源:LKSurface.cpp
示例4: Poly
void
Poly(HDC hdc, POINT * lpPoints, int nCount, COLORREF fg, COLORREF bg, int thickness, int style, BOOL closed)
{
LOGBRUSH logbrush;
HBRUSH oldBrush;
HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, thickness, fg));
logbrush.lbStyle = (style == 0) ? BS_HOLLOW : BS_SOLID;
logbrush.lbColor = (style == 2) ? fg : bg;
logbrush.lbHatch = 0;
oldBrush = SelectObject(hdc, CreateBrushIndirect(&logbrush));
if (closed)
Polygon(hdc, lpPoints, nCount);
else
Polyline(hdc, lpPoints, nCount);
DeleteObject(SelectObject(hdc, oldBrush));
DeleteObject(SelectObject(hdc, oldPen));
}
开发者ID:Nevermore2015,项目名称:reactos,代码行数:17,代码来源:drawing.c
示例5: va_start
void CSkeletalViewerApp::Nui_DrawSkeletonSegment( NUI_SKELETON_DATA * pSkel, int numJoints, ... )
{
va_list vl;
va_start(vl,numJoints);
POINT segmentPositions[NUI_SKELETON_POSITION_COUNT];
for (int iJoint = 0; iJoint < numJoints; iJoint++)
{
NUI_SKELETON_POSITION_INDEX jointIndex = va_arg(vl,NUI_SKELETON_POSITION_INDEX);
segmentPositions[iJoint].x = m_Points[jointIndex].x;
segmentPositions[iJoint].y = m_Points[jointIndex].y;
}
Polyline(m_SkeletonDC, segmentPositions, numJoints);
va_end(vl);
}
开发者ID:cendanny,项目名称:Nuit-Blanche,代码行数:17,代码来源:NuiImpl.cpp
示例6: buildCircle
void LKSurface::DrawCircle(long x, long y, int radius, const RECT& rc, bool fill) {
if ((x - radius) > rc.right) return;
if ((x + radius) < rc.left) return;
if ((y - radius) > rc.bottom) return;
if ((y + radius) < rc.top) return;
// Only called by ThreadDraw, so static vector can be used.
static std::vector<RasterPoint> CirclePt;
buildCircle(RasterPoint(x,y), radius, CirclePt);
if (fill) {
Polygon(CirclePt.data(), CirclePt.size(), rc);
} else {
Polyline(CirclePt.data(), CirclePt.size(), rc);
}
}
开发者ID:LK8000,项目名称:LK8000,代码行数:17,代码来源:LKSurface.cpp
示例7: l_ui_polyline
static void
l_ui_polyline(struct rdp_inst * inst, uint8 opcode, RD_POINT * points, int npoints,
RD_PEN * pen)
{
wfInfo * wfi;
HPEN hpen;
HPEN org_hpen;
int color;
int org_rop2;
int i;
POINT * ps;
wfi = GET_WFI(inst);
//printf("ui_polyline opcode %d npoints %d\n", opcode, npoints);
color = wf_color_convert(wfi, pen->color, inst->settings->server_depth);
hpen = CreatePen(pen->style, pen->width, color);
org_rop2 = SetROP2(wfi->drw->hdc, opcode + 1);
org_hpen = (HPEN)SelectObject(wfi->drw->hdc, hpen);
if (npoints > 0)
{
ps = (POINT *) malloc(sizeof(POINT) * npoints);
for (i = 0; i < npoints; i++)
{
//printf("ui_polyline point %d %d %d\n", i, points[i].x, points[i].y);
if (i == 0)
{
ps[i].x = points[i].x;
ps[i].y = points[i].y;
}
else
{
ps[i].x = ps[i - 1].x + points[i].x;
ps[i].y = ps[i - 1].y + points[i].y;
}
if (wfi->drw == wfi->backstore)
{
wf_invalidate_region(wfi, ps[i].x, ps[i].y, ps[i].x + 1, ps[i].y + 1);
}
}
Polyline(wfi->drw->hdc, ps, npoints);
}
SelectObject(wfi->drw->hdc, org_hpen);
SetROP2 (wfi->drw->hdc, org_rop2);
DeleteObject(hpen);
}
开发者ID:alama,项目名称:freerdp,代码行数:45,代码来源:wf_win.cpp
示例8: pen
bool GiCanvasGdi::rawLines(const GiContext* ctx,
const Point2d* pxs, int count)
{
HDC hdc = m_draw->getDrawDC();
KGDIObject pen (hdc, m_draw->createPen(ctx), false);
bool ret = false;
if (count > 0)
{
std::vector<POINT> pts;
pts.resize(count);
for (int i = 0; i < count; i++)
pxs[i].get(pts[i].x, pts[i].y);
ret = !!Polyline(hdc, &pts.front(), count);
}
return ret;
}
开发者ID:huangzongwu,项目名称:touchvg,代码行数:18,代码来源:canvasgdi.cpp
示例9: WndProc
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)//视窗讯息处理程式
{
//CS_视窗类别样式
//CW_建立视窗
//DT_绘制文字
//IDI_图示ID
//IDC_游标ID
//MB_讯息方块
//SND_声音
//WM_视窗讯息
//WS_视窗样式
HDC hdc;
PAINTSTRUCT ps;
// RECT rect;
static int cxClient,cyClient;
int i;
POINT apt[NUM];
switch (message)
{
case WM_SIZE:
cxClient = LOWORD(lParam);
cyClient = HIWORD(lParam);
return 0;
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
MoveToEx(hdc, 0, cyClient / 2, NULL);
LineTo(hdc, cxClient, cyClient / 2);
for (i = 0; i < NUM; i++)
{
apt[i].x = i*cxClient / NUM;
apt[i].y = (int)(cyClient / 2 * (1 - sin(TWOPI*i / NUM)));
}
Polyline(hdc, apt,sizeof(apt)/sizeof(POINT));
// Polyline(hdc, apt, NUM);与上面相等
// EndPaint(hwnd, &ps);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
//视窗讯息处理程式不予处理的所有讯息提供内定处理
return DefWindowProc(hwnd, message, wParam, lParam);
}
开发者ID:Magicmay,项目名称:windowsProgram,代码行数:44,代码来源:Sinewave.cpp
示例10: DrawHands
void DrawHands(HDC hdc, SYSTEMTIME* pst, BOOL fChange)
{
static POINT pt[3][5] = {
0, -150, 100, 0, 0, 600, -100, 0, 0, -150,
0, -200, 50, 0, 0, 800, -50, 0, 0, -200,
0, 0, 0, 0, 0, 0, 0, 0, 0, 800
};
int i, iAngle[3];
POINT ptTemp[3][5];
iAngle[0] = (pst->wHour * 30) % 360 + pst->wMinute / 2;
iAngle[1] = pst->wMinute * 6;
iAngle[2] = pst->wSecond * 6;
memcpy(ptTemp, pt, sizeof(pt));
for (i = fChange ? 0 : 2; i < 3;i++)
{
RotatePoint(ptTemp[i], 5, iAngle[i]);
Polyline(hdc, ptTemp[i], 5);
}
}
开发者ID:Feilone,项目名称:TestCodeJustForMe,代码行数:19,代码来源:CLOCK.cpp
示例11: _clipper_ln
Lines
_clipper_ln(ClipperLib::ClipType clipType, const Lines &subject, const Polygons &clip,
bool safety_offset_)
{
// convert Lines to Polylines
Polylines polylines;
polylines.reserve(subject.size());
for (const Line &line : subject)
polylines.emplace_back(Polyline(line.a, line.b));
// perform operation
polylines = _clipper_pl(clipType, polylines, clip, safety_offset_);
// convert Polylines to Lines
Lines retval;
for (Polylines::const_iterator polyline = polylines.begin(); polyline != polylines.end(); ++polyline)
retval.emplace_back(polyline->operator Line());
return retval;
}
开发者ID:prusa3d,项目名称:Slic3r,代码行数:19,代码来源:ClipperUtils.cpp
示例12: wf_gdi_polyline
void wf_gdi_polyline(wfContext* wfc, POLYLINE_ORDER* polyline)
{
int i;
POINT* pts;
int org_rop2;
HPEN hpen;
HPEN org_hpen;
UINT32 pen_color;
pen_color = freerdp_color_convert_var_bgr(polyline->penColor, wfc->srcBpp, wfc->dstBpp, wfc->clrconv);
hpen = CreatePen(0, 1, pen_color);
org_rop2 = wf_set_rop2(wfc->drawing->hdc, polyline->bRop2);
org_hpen = (HPEN) SelectObject(wfc->drawing->hdc, hpen);
if (polyline->numPoints > 0)
{
POINT temp;
temp.x = polyline->xStart;
temp.y = polyline->yStart;
pts = (POINT*) malloc(sizeof(POINT) * polyline->numPoints);
for (i = 0; i < (int) polyline->numPoints; i++)
{
temp.x += polyline->points[i].x;
temp.y += polyline->points[i].y;
pts[i].x = temp.x;
pts[i].y = temp.y;
if (wfc->drawing == wfc->primary)
wf_invalidate_region(wfc, pts[i].x, pts[i].y, pts[i].x + 1, pts[i].y + 1);
}
Polyline(wfc->drawing->hdc, pts, polyline->numPoints);
free(pts);
}
SelectObject(wfc->drawing->hdc, org_hpen);
wf_set_rop2(wfc->drawing->hdc, org_rop2);
DeleteObject(hpen);
}
开发者ID:JozLes77,项目名称:FreeRDP,代码行数:42,代码来源:wf_gdi.c
示例13: drawRectangle
void drawRectangle(int x, int y, int width, int height)
{
POINT point[5];
point[0].x = x;
point[0].y = y;
point[1].x = x + width;
point[1].y = y;
point[2].x = x + width;
point[2].y = y + height;
point[3].x = x;
point[3].y = y + height;
point[4].x = x;
point[4].y = y;
Polyline(_paintDC, point, 5);
}
开发者ID:nalune,项目名称:MarkTwain,代码行数:20,代码来源:mtimpl.cpp
示例14: PaintSinWave
void PaintSinWave(HWND hwnd, int cxClient, int cyClient)
{
int i ;
PAINTSTRUCT ps ;
POINT apt [NUM] ;
HDC hdc = BeginPaint (hwnd, &ps) ;
MoveToEx (hdc, 0, cyClient / 2, NULL) ;
LineTo (hdc, cxClient, cyClient / 2) ;
for (i = 0 ; i < NUM ; i++)
{
apt[i].x = i * cxClient / NUM ;
apt[i].y = (int) (cyClient / 2 * (1 - sin (TWOPI * i / NUM))) ;
}
Polyline (hdc, apt, NUM) ;
EndPaint (hwnd, &ps) ;
}
开发者ID:yuechuanbingzhi163,项目名称:CPPPractice,代码行数:20,代码来源:DemoFunctions.cpp
示例15: SetBkMode
// Draw OfficeManagerASE
void OfficeGSE::DrawOfficeManagerASE(HINSTANCE hinst, HWND hwnd, HDC hdc, ActorRequest* ActReq)
{
int r = ActReq->GetRequest();
int c = ActReq->GetActorId();
int bottom = ActReq->GetIntParam1();
int top = ActReq->GetIntParam2();
int right = ActReq->GetIntParam3();
int left = ActReq->GetIntParam4();
SetBkMode(hdc, TRANSPARENT);
HPEN Pen = CreatePen(PS_DOT, 0, RGB(255, 255, 255));
SelectObject(hdc, Pen);
POINT p[5];
p[0].x = left; p[0].y = top;
p[1].x = right; p[1].y = top;
p[2].x = right; p[2].y = bottom;
p[3].x = left; p[3].y = bottom;
p[4].x = left; p[4].y = top;
Polyline(hdc, p, 5);
DeleteObject(Pen);
}
开发者ID:s-takeuchi,项目名称:YaizuNetTool,代码行数:22,代码来源:OfficeGSE.cpp
示例16: GPpolygon
int GPpolygon (Gwidget_t *widget, int gpn, Gpoint_t *gpp, Ggattr_t *ap) {
int n, i;
if (gpn == 0)
return 0;
if (gpn + 1 > Gppn) {
n = (((gpn + 1) + PPINCR - 1) / PPINCR) * PPINCR;
Gppp = Marraygrow (Gppp, (long) n * PPSIZE);
Gppn = n;
}
for (i = 0; i < gpn; i++)
Gppp[i] = pdrawtopix (widget, gpp[i]);
setgattr (widget, ap);
if (WPU->gattr.fill) {
if (Gppp[gpn - 1].x != Gppp[0].x || Gppp[gpn - 1].y != Gppp[0].y)
Gppp[gpn] = Gppp[0], gpn++;
Polygon (GC, Gppp, (int) gpn);
} else
Polyline (GC, Gppp, (int) gpn);
return 0;
}
开发者ID:AhmedAMohamed,项目名称:graphviz,代码行数:21,代码来源:gpcanvas.c
示例17: switch
void Statistics::StyleLine(HDC hdc, POINT l1, POINT l2,
int Style) {
POINT line[2];
line[0] = l1;
line[1] = l2;
switch (Style) {
case STYLE_BLUETHIN:
DrawDashLine(hdc, 1,
l1,
l2,
RGB(0,0,255));
break;
case STYLE_REDTHICK:
DrawDashLine(hdc, 3,
l1,
l2,
RGB(200,50,50));
break;
case STYLE_DASHGREEN:
DrawDashLine(hdc, 2,
line[0],
line[1],
RGB(0,255,0));
break;
case STYLE_MEDIUMBLACK:
SelectObject(hdc, GetStockObject(BLACK_PEN));
Polyline(hdc, line, 2);
break;
case STYLE_THINDASHPAPER:
DrawDashLine(hdc, 1,
l1,
l2,
RGB(0xf0,0xf0,0xb0));
break;
default:
break;
}
}
开发者ID:JanezKolar,项目名称:LK8000,代码行数:40,代码来源:Statistics.cpp
示例18: iupDrawPolygon
void iupDrawPolygon(IdrawCanvas* dc, int* points, int count, unsigned char r, unsigned char g, unsigned char b, int style)
{
if (style==IUP_DRAW_FILL)
{
HBRUSH hBrush = CreateSolidBrush(RGB(r,g,b));
HPEN hBrushOld = SelectObject(dc->hBitmapDC, hBrush);
BeginPath(dc->hBitmapDC);
Polygon(dc->hBitmapDC, (POINT*)points, count);
EndPath(dc->hBitmapDC);
FillPath(dc->hBitmapDC);
SelectObject(dc->hBitmapDC, hBrushOld);
DeleteObject(hBrush);
}
else
{
HPEN hPen = CreatePen(style==IUP_DRAW_STROKE_DASH? PS_DASH: PS_SOLID, 1, RGB(r, g, b));
HPEN hPenOld = SelectObject(dc->hBitmapDC, hPen);
Polyline(dc->hBitmapDC, (POINT*)points, count);
SelectObject(dc->hBitmapDC, hPenOld);
DeleteObject(hPen);
}
}
开发者ID:DavidPhillipOster,项目名称:IupCocoa,代码行数:22,代码来源:iupwin_draw.c
示例19: WndProc
LRESULT CALLBACK WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
static int cxClient, cyClient ;
HDC hdc ;
int i ;
PAINTSTRUCT ps ;
POINT pt [NUM] ;
switch (iMsg)
{
case WM_SIZE:
cxClient = LOWORD (lParam) ;
cyClient = HIWORD (lParam) ;
return 0 ;
case WM_PAINT:
hdc = BeginPaint (hwnd, &ps) ;
MoveToEx (hdc, 0, cyClient / 2, NULL) ;
LineTo (hdc, cxClient, cyClient / 2) ;
for (i = 0 ; i < NUM ; i++)
{
pt[i].x = i * cxClient / NUM ;
pt[i].y = (int) (cyClient / 2 *
(1 - sin (TWOPI * i / NUM))) ;
}
Polyline (hdc, pt, NUM) ;
return 0 ;
case WM_DESTROY:
PostQuitMessage (0) ;
return 0 ;
}
return DefWindowProc (hwnd, iMsg, wParam, lParam) ;
}
开发者ID:note4me,项目名称:Misc,代码行数:39,代码来源:SINEWAVE.C
示例20: calculate_polyline
static void calculate_polyline(void)
{
WINT points, i;
RECT rect;
POINT p[9];
HPEN hOldPen;
do {
rect.left = 0x7fff;
rect.top = 0x7fff;
rect.right = 0;
rect.bottom = 0;
points = get_rand(2, 9);
for (i=0; i<points; i++)
{
p[i].x = get_rand(0, xMax);
p[i].y = get_rand(0, yMax);
if (p[i].x < rect.left)
rect.left = p[i].x;
if (p[i].x > rect.right)
rect.right = p[i].x;
if (p[i].y < rect.top)
rect.top = p[i].y;
if (p[i].y > rect.bottom)
rect.bottom = p[i].y;
}
hOldPen = SelectObject(hMemDC, create_pen());
SetROP2(hMemDC, get_rand(1,17));
Polyline(hMemDC, &p[0], points);
DeleteObject(SelectObject(hMemDC, hOldPen));
if (TestSemaphore(&PainterRequired) < 0)
{
InvalidateRect(hWnd, &rect, FALSE);
UpdateWindow(hWnd);
}
} while ((TestSemaphore(&DemoRun)) && (!TestSemaphore(&SingleRun)));
if (!TestSemaphore(&SingleRun));
Signal(&Done);
}
开发者ID:jamjr,项目名称:Helios-NG,代码行数:39,代码来源:gditest.c
注:本文中的Polyline函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论