Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Imaging With QuickDraw /
Chapter 3 - QuickDraw Drawing / QuickDraw Drawing Reference
Routines


Creating and Managing Polygons

A polygon is defined by a sequence of connected lines. To create a polygon, you first call the OpenPoly function and then some number of LineTo procedures to draw lines from the first vertex of the polygon to the second, from the second to the third, and so on, until you've drawn a line to the last vertex. You then use the ClosePoly procedure, which completes the figure by drawing a connecting line from the last vertex back to the first.

After you use the OpenPoly function to create a polygon, QuickDraw begins collecting the line-drawing information you provide into a Polygon record. The OpenPoly function returns a handle to the newly allocated Polygon record.

After defining a polygon in this way, you can draw it with the FramePoly, PaintPoly, and FillPoly procedures. You can move it by using the OffSetPoly procedure. When you are finished using the polygon, use the KillPoly procedure to release its memory. When using the ClosePoly, OffsetPoly, and KillPoly procedures, you refer to a polygon by the handle returned by OpenPoly when you first created the polygon.

Note
If, while your application draws a polygon, it exceeds available stack space in Color QuickDraw, the QDError function (described in the chapter "Color QuickDraw" in this book) returns the result code -144.

Subtopics
OpenPoly
ClosePoly
OffsetPoly
KillPoly

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996