<< Click to Display Table of Contents >> Navigation: ThinBASIC Modules > UI (User Interface) > CONTROLS > Control Types > Canvas Control > Canvas Control Commands > Canvas_Polygon |
Description
Draw a polygon in the selected graphic target
Syntax
n = Canvas_Polygon points [,[rgbColor] [, [fillcolor] [,[fillstyle] [, fillmode]]]]
Returns
Number
Parameters
Name |
Type |
Optional |
Meaning |
Points |
UDT |
No |
User-defined type that defines the number of vertices and the location of each. See Remarks for more info. |
rgbColor |
Number |
Yes |
RBG starting color |
fillcolor |
Number |
Yes |
RGB ending color |
fillstyle |
Number |
Yes |
Fill style (pattern) to be used. If fillstyle is omitted, the default fill style is solid (0). If a hatch pattern is chosen (1 to 6), the foreground color is specified by the fillcolor, while the background is specified by the default background color. The fillstyle can be:
%Canvas_FillStyle_Solid %Canvas_FillStyle_HorizontalLines %Canvas_FillStyle_VerticalLines %Canvas_FillStyle_UpwardDiagonalLines %Canvas_FillStyle_DownwardDiagonalLines %Canvas_FillStyle_CrossedLines %Canvas_FillStyle_DiagonalCrossedLines |
fillmode |
Number |
Yes |
If fillmode is missing (or zero), the winding mode is selected. This fills any region with a non-zero winding value. If fillmode is non-zero, the alternate mode is selected. This fills the area between odd-numbered and even-numbered polygon sides on each scan line. That is, it fills the area between the first side and the second side, between the third side and fourth side, etc. |
Remarks
Points is something like the following UDT:
Type PolyPoint
x As Single
y As Single
End Type
Type PolyArray
count As Long
xy(1024) As PolyPoint '---Can be any number of elements from 2 to 1024
End Type
Points is any UDT that must have the following structure:
•the first member is a LONG integer point count
•followed directly by the appropriate number of SINGLE precision floats to specify the actual coordinates
There must be at least two, and no more than 1024 vertices
Restrictions
See also
Examples
Dim pa As PolyArray
'...
pa.count = 4 '---Indicate you need 4 vertex
pa.xy(1).x = x1 '---X1
pa.xy(1).y = y1-150 '---Y1
pa.xy(2).x = x1+150 '---X2
pa.xy(2).y = y1 '---Y2
pa.xy(3).x = x1 '---X3
pa.xy(3).y = y1+150 '---Y3
pa.xy(4).x = x1-150 '---X4
pa.xy(4).y = y1 '---Y4
CANVAS_Polygon pa, RGB(255, 0, 255), RGB(5,128,0), %CANVAS_FillStyle_DiagonalCrossedLines
'... Number of vertex can be any from 2 to 1024