当前位置: 首页>>代码示例>>C++>>正文


C++ Polyline函数代码示例

本文整理汇总了C++中Polyline函数的典型用法代码示例。如果您正苦于以下问题:C++ Polyline函数的具体用法?C++ Polyline怎么用?C++ Polyline使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Polyline函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的Polyline函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。