This function draws a bezier curve in the designated object (the screen, printer, or image data).
Parameters
Name | Explanation |
---|---|
DeviceValue | The device context or the raster image data (depending on the DeviceMode) |
lpPoint | A structure defining coordinates for the points of
the polygonal area on the image
In C++Builder, pass the pointer to the first element in the structure array In Delphi, if Pt is an array of TPoint, then the arguments are returned in the first elements of the array Pt[0] |
Points | The number of points defining the polygonal area on the image (2 or more), i.e. the number of points in the lpPoint array |
DrawInfo | Structure whose members set the drawing information |
DeviceMode | The designated object where the polygon is drawn (0: Screen, 1: Printer, 2: Image data) |
Return Value
Returns True (nonzero) if successful. Returns False (0) if unsuccessful.
Explanation
The IKPolyBezier function draws a bezier curve in the designated object (the screen, printer, or image data). The initial bezier curve consists of 4 points, a start point, 2 control points, and an endpoint. Thereafter the bezier curve consists of 3 points (the control points and endpoint). This method can draw in the following designated objects: screen, printer, and image data.
To execute this method, the following member variables of DrawInfo structure should be set PenWidth, PenStyle, PenMode, PenColor, Transparent, and BackColor. The BackColor property is enabled when the Transparent is False and the pen is set to draw solid lines.
The value contained in the Points parameter must be (3 X the number of beziers) + a start point.
If the DeviceMode parameter is 0 or 2 then the lpPoint member variables are in pixel units.
If the DeviceMode parameter is 1 then the lpPoint member variables are in 0.1mm units.
Sample code:
In C++Builder
IKPRINT_DRAWINFO DrawInfo;
POINT PtCurve[4];
PtCurve[0].x = 10; PtCurve[0].y = 100;
PtCurve[1].x = 50; PtCurve[1].y = 50;
PtCurve[2].x = 100; PtCurve[2].y = 150;
PtCurve[3].x = 150; PtCurve[3].y = 100;
memset(&DrawInfo, 0,
sizeof(IKPRINT_DRAWINFO));
DrawInfo.PenColor = RGB(0, 0, 255);
DrawInfo.PenStyle = 1;
DrawInfo.PenWidth = 15;
IKPolyBezier(hDC, PtCurve, 4, DrawInfo,
0);
In Delphi
DrawInfo: IKPRINT_DRAWINFO;
PtCurve: array[0..3] of TPoint;
PtCurve[0].x := 10; PtCurve[0].y :=
100;
PtCurve[1].x := 50; PtCurve[1].y := 50;
PtCurve[2].x := 100; PtCurve[2].y :=
150;
PtCurve[3].x := 150; PtCurve[3].y :=
100;
FillChar(DrawInfo, SizeOf(DrawInfo),
0);
DrawInfo.PenColor := clGreen;
DrawInfo.PenStyle := 1;
DrawInfo.PenWidth := 15;
IKPolyBezier(hDC, PtCurve[0], 4, DrawInfo,
0);