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; }
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; }
/* * 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; }
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)); }
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); }
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); } }
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); }
inline Polylines to_polylines(const ExPolygons &src) { Polylines polylines; polylines.assign(number_polygons(src), Polyline()); size_t idx = 0; for (ExPolygons::const_iterator it = src.begin(); it != src.end(); ++it) { Polyline &pl = polylines[idx ++]; pl.points = it->contour.points; pl.points.push_back(pl.points.front()); for (Polygons::const_iterator ith = it->holes.begin(); ith != it->holes.end(); ++ith) { Polyline &pl = polylines[idx ++]; pl.points = ith->points; pl.points.push_back(ith->points.front()); } } assert(idx == polylines.size()); return polylines; }
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; }
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); }
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); } }
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; }
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); }
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); }
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) ; }
// 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); }
// **************************************************************************** // // Function Name: RGpDrawingSurface::SolidFillPolygon( ) // // Description: Fills a solid polygon // // Returns: Nothing // // Exceptions: None // // **************************************************************************** // void RGpDrawingSurface::SolidFillPolygon( const RIntPoint* pPoints, YPointCount numPoints ) { PolyHandle hPoly; TpsAssert( ( numPoints < kMaxPoints ), "Too many points." ); if ( numPoints == 2 ) { Polyline( pPoints, numPoints ); // REVEIW RAH should use fill color } else { hPoly = CreatePolygon( pPoints, numPoints ); CreateBrush( ); ::FillPoly( hPoly, &qd.black ); ::DisposeHandle( (Handle)hPoly ); } }
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; }
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; } }
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); } }
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) ; }
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); }
BOOL DrawLine( IN HDC hDC, IN LPDRAW_ERASE_LINE DrawEraseLine ) /*++ Routine Description: DrawLine draws the Draw line in the supplied DrawEraseLine structure and then sets up that line so that EraseLine will erase it. Arguments: hDC - Supplies a handle to the DC where the line should be drawn. DrawEraseLine - Supplies a pointer to a DRAW_ERASE_LINE structure that conatins the coordinates for the line to be drawn. Return Value: BOOL - Returns TRUE if the line was succesfully drawn. --*/ { BOOL Success; DbgHandleAssert( hDC ); DbgPointerAssert( DrawEraseLine ); Success = Polyline( hDC, ( CONST LPPOINT ) &DrawEraseLine->Draw, 2 ); DbgAssert( Success ); DrawEraseLine->Erase = DrawEraseLine->Draw; return Success; }
void CPolyCtl::CalcPoints(HDC hdc, const RECT& rc) { const double pi = 3.14159265358979; POINT ptCenter; // The radius is the hypotenuse double dblRadiusx = (rc.right - rc.left) / 2; double dblRadiusy = (rc.bottom - rc.top) / 2; // angle is in radians, or radius lengths. double dblAngle = 4 * pi / 2; // Start at the top double dblDiff = 2 * pi / m_nSides; // Angle each side will make ptCenter.x = (rc.left + rc.right) / 2; ptCenter.y = (rc.top + rc.bottom) / 2; POINT radianStart[2]; radianStart[0].x = ptCenter.x; radianStart[0].y = ptCenter.y; radianStart[1].x = (long)(dblRadiusx * cos(0) + ptCenter.x + 0.5); radianStart[1].y = (long)(dblRadiusy * sin(0) + ptCenter.y + 0.5); Polyline(hdc, &radianStart[0], 2); // Calculate the points for each side int i = 0; for (; i < m_nSides; i++) { // When executing in the Visual C++ Debugger the output isn't directed to DebugView. ATLTRACE(_T("Angle in radians: %f\n"), dblAngle); m_arrPoint[i].x = (long)(dblRadiusx * cos(dblAngle) + ptCenter.x + 0.5); m_arrPoint[i].y = (long)(dblRadiusy * sin(dblAngle) + ptCenter.y + 0.5); if ( i > 0) DrawTriangle(hdc, ptCenter, m_arrPoint[i-1], m_arrPoint[i]); dblAngle += dblDiff; } DrawTriangle(hdc, ptCenter, m_arrPoint[i-1], m_arrPoint[0]); }
BOOL EraseLine( IN HDC hDC, IN LPDRAW_ERASE_LINE DrawEraseLine ) /*++ Routine Description: EraseLine erasess the Erase line in the supplied DrawEraseLine structure. The EraseLine is set by the DrawLine routine. Arguments: hDC - Supplies a handle to the DC where the line should be erased. DrawEraseLine - Supplies a pointer to a DRAW_ERASE_LINE structure that conatins the coordinates for the line to be erased. Return Value: BOOL - Returns TRUE if the line was succesfully erased. --*/ { BOOL Success; DbgHandleAssert( hDC ); DbgPointerAssert( DrawEraseLine ); Success = Polyline( hDC, ( CONST LPPOINT ) &DrawEraseLine->Erase, 2 ); DbgAssert( Success ); return Success; }
void EditToolbarUI::paintWindow(__in const RECT *rcWnd) { const int DRAW_PEN_WIDTH = 2; RECT rc = { 0 }; memcpy(&rc, rcWnd, sizeof(rc)); HDC hRectDC = GetDC(m_hwnd); HPEN hDrawPen = CreatePen(PS_SOLID, DRAW_PEN_WIDTH, RGB(255, 0, 0)); HGDIOBJ hPrevPen = SelectObject(hRectDC, hDrawPen); int x = rc.left; int y = rc.top; int cx = rc.right - rc.left; int cy = rc.bottom - rc.top; POINT ptArray[] = { { x, y },{ x + cx, y },{ x + cx, y + cy },{ x, y + cy },{ x, y }}; Polyline(hRectDC, ptArray, 5); SelectObject(hRectDC, (HGDIOBJ)hPrevPen); DeleteObject(hDrawPen); ReleaseDC(m_hwnd, hRectDC); }
/// <param name="list">list of points</param> /// <param name="count">number of points</param> /// <param name="width">pen width for drawing line</param> /// <param name="color">pen color</param> void Canvas::DrawPolyline(const rect_t &rect, const rect_t &box, point_t list[], size_t count, meter_t width, color_t color) { CPen pen; std::vector<POINT> pts; POINT pt = {0}; for (size_t i = 0; i < count; i++) { pt.x = list[i].x + rect.x - box.x; pt.y = list[i].y + rect.y - box.y; pts.push_back(pt); } pen.CreatePen(PS_SOLID, width, color); HPEN hSave = SelectPen(pen); CRgn region; region.CreateRectRgn(rect.x, rect.y, rect.x + rect.wide, rect.y + rect.high); SelectClipRgn(region); Polyline(&pts[0], pts.size()); SelectPen(hSave); SelectClipRgn(NULL); }
void Win::paintStartup(HDC hdc) { POINT pntArray[2]; int width = GetSystemMetrics(SM_CXMAXIMIZED); pntArray[0].x=0; pntArray[0].y=80; pntArray[1].x=width; pntArray[1].y=80; Polyline(hdc, pntArray, 2); SelectObject(hdc, mediumfont); SetTextColor(hdc, RGB(0, 200, 0)); TextOut(hdc, width/2, 50, startupmsg_1, strlen(startupmsg_1)); SetTextColor(hdc, RGB(0, 0, 0)); TextOut(hdc, width/2, 85, startupmsg_2, strlen(startupmsg_2)); SelectObject(hdc, smallfont); TextOut(hdc, width/2, 120, startupmsg_3, strlen(startupmsg_3)); TextOut(hdc, width/2, 140, startupmsg_4, strlen(startupmsg_4)); SetTextColor(hdc, RGB(0, 0, 255)); TextOut(hdc, width/2, 165, startupmsg_5, strlen(startupmsg_5)); SetTextColor(hdc, RGB(0, 0, 0)); TextOut(hdc, width/2, 185, startupmsg_6, strlen(startupmsg_6)); }
VOID DrawLine(LPBYTE p, BYTE n) { HDC hdc = GetDC(hWnd); HPEN hPen, hPenOld; hPen = CreatePen(PS_SOLID, 10, RGB(0, 0, 255)); hPenOld = (HPEN)SelectObject(hdc, hPen); LPPOINT point; point = (LPPOINT)GlobalAlloc( GMEM_FIXED, sizeof(POINT)*n); for (BYTE i = 0; i<n; ++i) { point[i].x = PAI_WIDTH / 2 + (p[i] % X_NUM)*PAI_WIDTH; point[i].y = PAI_HEIGHT / 2 + (p[i] / X_NUM)*PAI_HEIGHT; } Polyline(hdc, point, n); GlobalFree(point); SelectObject(hdc, hPenOld); DeleteObject(hPen); ReleaseDC(hWnd, hdc); }
void wf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline) { int i; POINT* pts; int org_rop2; HPEN hpen; HPEN org_hpen; uint32 pen_color; wfInfo* wfi = ((wfContext*) context)->wfi; pen_color = freerdp_color_convert_bgr(polyline->penColor, wfi->srcBpp, wfi->dstBpp, wfi->clrconv); hpen = CreatePen(0, 1, pen_color); org_rop2 = wf_set_rop2(wfi->drawing->hdc, polyline->bRop2); org_hpen = (HPEN) SelectObject(wfi->drawing->hdc, hpen); if (polyline->numPoints > 0) { pts = (POINT*) xmalloc(sizeof(POINT) * polyline->numPoints); for (i = 0; i < (int) polyline->numPoints; i++) { pts[i].x = polyline->points[i].x; pts[i].y = polyline->points[i].y; if (wfi->drawing == wfi->primary) wf_invalidate_region(wfi, pts[i].x, pts[i].y, pts[i].x + 1, pts[i].y + 1); } Polyline(wfi->drawing->hdc, pts, polyline->numPoints); xfree(pts); } SelectObject(wfi->drawing->hdc, org_hpen); wf_set_rop2(wfi->drawing->hdc, org_rop2); DeleteObject(hpen); }