Components for Developers
© 2000-2012, Two Pilots

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

PDF Creator Pilot documentation

Download CHM version of this manual.
How to draw simple elements, such as a line and cubic Bezier curves

Example
Collapse All

Example

C++

[copy to clipboard]
PM_DOCUMENT doc = PM_DOCUMENT_New();

PM_RECT rc = {0, 0, 600, 800};
PM_PAGE page = PM_DOCUMENT_AddPage(doc, rc);
PM_CANVAS canvas = PM_PAGE_GetCanvas(page);
	
PM_CANVAS_SetLineWidth(canvas, 5);
PM_CANVAS_MoveTo(canvas, 100, 100);
PM_CANVAS_DrawCurveTo(canvas, 200, 200, 100, 300, 200, 400);
PM_CANVAS_Stroke(canvas);
PM_CANVAS_SetRGBColorStroke(canvas, 1.0f, 0.0f, 0.0f);
PM_CANVAS_MoveTo(canvas, 100, 100);
PM_CANVAS_DrawLineTo(canvas, 200, 200);
PM_CANVAS_Stroke(canvas);
PM_CANVAS_MoveTo(canvas, 100, 300);
PM_CANVAS_DrawLineTo(canvas, 200,400);
PM_CANVAS_MoveTo(canvas, 300, 100);
PM_CANVAS_DrawCurveTo(canvas, 200, 300, 400, 200, 400, 100);
PM_CANVAS_Stroke(canvas);
PM_CANVAS_SetRGBColorStroke(canvas, 0.0f, 0.0f, 1.0f);
PM_CANVAS_MoveTo(canvas, 300, 100);
PM_CANVAS_DrawLineTo(canvas, 200, 300);
PM_CANVAS_Stroke(canvas);
PM_CANVAS_MoveTo(canvas, 400, 200);
PM_CANVAS_DrawLineTo(canvas, 400, 100);
PM_CANVAS_Stroke(canvas);
	
PM_DOCUMENT_Save(doc, "LinesAndCurves.pdf");
PM_DOCUMENT_Free(doc);

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

 

 

PDF Library | Virtual Printer | Converters to PDF

Support | Blog | Forum | Contacts

© 2000-2012, Two Pilots