WINDEV, WEBDEV AND WINDEV MOBILEONLINE HELPVersion: 1516171819202122232425
• Coordinates
• Using the drawing functions
• Drawing in PHP
• Drawing in Browser code
WINDEV
WEBDEV
WINDEV Mobile
Others
Draws a line composed of several segments:
• in an Image control,
• Versions 17 and later
in an Image variable.
New in version 17
in an Image variable.
in an Image variable.
in an Image variable.
• Versions 25 and later
in a WDPic variable (on the background layer),
New in version 25
in a WDPic variable (on the background layer),
in a WDPic variable (on the background layer),
• Versions 25 and later
in a picLayer variable.
New in version 25
in a picLayer variable.
in a picLayer variable.
The first coordinate indicates the starting point of the first segment, then each coordinate indicates the end of the previous segment and the beginning of the next segment.
Example
dStartDrawing(IMG_Drawing)
// Draws a 4-pixel thick, green dotted line
dPen(DarkGreen, 2, 4)
// Line composed of 4 segments
dPolyline(4, 10, 100, 50, 60, 80, 90, 150, 13)
dStartDrawing(IMG_Drawing)
dPen(DarkGreen, 2, 4)
// Draw a line from an array of point coordinates (syntax 2)
arrCoordinatesXY is array of 0 by 2 int = [[2, 3], [14, 100], [10,70], [50, 80]]
dPolyline(arrCoordinatesXY)
dPen(IMG_Drawing, DarkGreen, 2, 4)
arrCoordinatesXY2 is array of 0 int = [2, 2, 140, 2, 150, 70, 0, 100, 200,100]
dPolyline(IMG_Drawing, arrCoordinatesXY2)
Syntax

Building a line point by point

dPolyline([<Image>, ] <NbPoint> , <X1> , <Y1> , <X2> , <Y2> [, <Xn> [, <Yn> [, <Line color>]]])
<Image>: Optional control name or optional Image, WDPic or picLayer variable
Image to use. This image can correspond to:
• the name of an Image control.
• the name of an Image variable.
• Versions 25 and later
the name of an WDPic variable. Only the background layer will be handled.
New in version 25
the name of an WDPic variable. Only the background layer will be handled.
the name of an WDPic variable. Only the background layer will be handled.
• Versions 25 and later
the name of a picLayer variable.
New in version 25
the name of a picLayer variable.
the name of a picLayer variable.
If this parameter is not specified, it is necessary to define the drawing destination with dStartDrawing.
<NbPoint>: Integer
Number of line segments. This parameter defines the number of <X>, <Y> pairs to specify in the function.
<X1>: Integer
X coordinate of the first segment of the line. These coordinates are expressed in pixels.
<Y1>: Integer
Y coordinate of the first segment of the line. These coordinates are expressed in pixels.
<X2>: Integer
X coordinate of the second segment of the line. These coordinates are expressed in pixels.
<Y2>: Integer
Y coordinate of the second segment of the line. These coordinates are expressed in pixels.
<Xn>: Optional integer
X coordinate of the N segment of the line. These coordinates are expressed in pixels.
<Yn>: Optional integer
Y coordinate of the N segment of the line. These coordinates are expressed in pixels.
<Line color>: Integer or constant (optional)
Line color. This color can correspond to:
If this parameter is not specified, the line color:
• corresponds to the color specified in the last call to dPen,
• is identical to the color used for the background if dPen was not used.

Building a line via an array of X and Y coordinates

dPolyline([<Image>, ] <Array of coordinates> [, <Line color>])
<Image>: Optional control name or optional Image, WDPic or picLayer variable
Image to use. This image can correspond to:
• the name of an Image control.
• the name of a Image variable.
• Versions 25 and later
the name of a WDPic variable. Only the background layer will be handled.
New in version 25
the name of a WDPic variable. Only the background layer will be handled.
the name of a WDPic variable. Only the background layer will be handled.
• Versions 25 and later
the name of a picLayer variable.
New in version 25
the name of a picLayer variable.
the name of a picLayer variable.
If this parameter is not specified, it is necessary to define the drawing destination with dStartDrawing.
<Array of coordinates>: Array of integers or array of points
WLanguage array of integers containing the coordinates of segments that make up the line. The even subscript represent the X coordinates while the odd subscripts represent the Y coordinates of points. These coordinates are expressed in pixels.
<Line color>: Integer or constant (optional)
Line color. This color can correspond to:
If this parameter is not specified, the line color:
• corresponds to the color specified in the last call to dPen,
• is identical to the color used for the background if dPen was not used.
Remarks

Coordinates

Coordinates are given with respect to the top left corner of the image (coordinates: (0.0)).

Using the drawing functions

The drawing functions can be used according to 2 methods:
• Method 1: Using dStartDrawing
• dStartDrawing must be called before any other drawing function. dStartDrawing is used to define the element (Image control or variable) to which the drawing functions will be applied.
• When drawing on an Image control:
• The drawing functions operate on a copy ("bitmap") of the image. You can use the drawing functions of Windows (via API or CallDLL32) but these functions must use the DC (Device Context) returned by dStartDrawing.
• dEndDrawing and dStartDrawing must not be called in the same process.
The drawing will not be displayed if dEndDrawing and dStartDrawing are called in the same process: it will be automatically erased.
• Versions 24 and later
Method 2: indicating the drawing target directly in the syntax (via a parameter)
The <Image> parameter is used to specify directly the target of the drawing. dStartDrawing becomes useless. This function must be deleted.
New in version 24
Method 2: indicating the drawing target directly in the syntax (via a parameter)
The <Image> parameter is used to specify directly the target of the drawing. dStartDrawing becomes useless. This function must be deleted.
Method 2: indicating the drawing target directly in the syntax (via a parameter)
The <Image> parameter is used to specify directly the target of the drawing. dStartDrawing becomes useless. This function must be deleted.
Related Examples:
 Unit examples (WINDEV): The drawing functions [ + ] Using the main drawing functions of WINDEV to:- Initialize an Image control for drawing- Draw simple shapes- Write a text into a drawing- Change the color in a drawing
Business / UI classification : Neutral code
Component : wd250pnt.dll
Minimum version required
• Version 24