ScanlinePolygonFill

Fills any polygon, concave or self-intersecting, as DrawRect bands: a scanline fill with an active-edge list. Spans in a band never overlap, so translucent fills blend once. Use it through Renderer.drawPolygonAsSpansTo()/drawConcavePolygonTo().


Constructor

new ScanlinePolygonFill(): ScanlinePolygonFill

Instance Methods

fill( canvasDrawTo: ifDraw2d, points: Array.<BGE.Math.Vector>, x: float, y: float, rgba: integer, bandSize: integer, bandAcrossY: dynamic, fillRule: BGE.PolygonFillRule, ): integer

Fills points (any outline, in order) with one DrawRect per run of matching band spans. Each band's spans are the outline's cross-section at the band's middle, so at 1px it's accurate; edges come out stepped by up to bandSize pixels.

Parameters

  • canvasDrawTo (ifDraw2d)
  • points (Array.<BGE.Math.Vector>) — the outline's corners in order
  • x (float) — offset added to every point
  • y (float) — offset added to every point
  • rgba (integer) — fill color
  • bandSize (integer) — band thickness in pixels
  • bandAcrossY (dynamic) — true for horizontal bands, false for vertical, invalid to band across the bounding box's shorter side
  • fillRule (BGE.PolygonFillRule)

Returns

  • integer — rects drawn