function Outline: TPolygon32;


This functions takes each contour (polyline) and constructs a new TPolygon32 object by outlining each contour.

The operation is similar to using morphological edge detection filter for bitmaps, but it operates over polygon vertices.

When outlining a closed polygon, this function actually returns two contours for each initial closed contour. In case of polylines (Closed property is False), it returns a single contour (see image below).

Note, this technique produces good results only for antialiased polygons.

This function is essential for thick line drawing, all you have to do, is to take an original polygon, build its outline and grow it to get the desired thickness:

  P, Outline: TPolygon32;
  Outline := P.Outline; // create an outline
  Outline.Grow(Fixed(1), 1); // make it 2-pixel wide outline (it grows in both directions)
  Outline.DrawFill(DstBitmap, clBlack32);

See Also

TPolygon32, Closed