TLazCanvas.Polygon procedure
Overloaded method which adds support for the non-zero winding rule.
Declaration
procedure Polygon(const Points: Array of TPoint; Winding: Boolean)
; overloadArguments
Points | Array with the TPoint instances for the vertices on the polygon. |
Winding | True if the non-zero winding rule is enabled for the canvas instance. Otherwise the polygon is filled by means of the "even-odd" rule in which alternating horizontal lines are drawn between pairs of polygon intersection points. |
Description
Polygon() overloads an equally-named method inherited from
TFPCustomCanvas
which
fills a polygon via
DoPolygonFill().
By default, the even-odd rule is applied for filling.
The current overload, however, adds support for filling the polygon
by the
non-zero winding rule.
In each case, the polygon is filled by drawing horizontal lines across the polygon starting at the left The intersection points of this line with the polygon segments are calculated and sorted from left to right.
In the even-odd rule, lines are drawn between adjacent intersection points in an alternating way.
In the non-zero winding rule the "winding number" (starting at zero for each line) is incremented/decremented depending on whether the hit polygon segment is oriented upward or downward. The following line segment is drawn only when the accumulated winding number is not zero.
The non-zero winding rule is selected when the Winding argument of the
method is true.
Otherwise the even-odd rule is applied.
The DrawPixel() method is called along the filling lines in order to apply the
brush color to the canvas pixels in an either opaque or semi-transparent way.
Added in LCL version 3.0.
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
