Skip to content

Add polygons, region recording and mapping to libQuickDraw - #69

Merged
colemancda merged 21 commits into
masterfrom
feature/quickdraw-polygons
Dec 3, 2026
Merged

colemancda merged 21 commits into
masterfrom
feature/quickdraw-polygons

Conversation

@colemancda

Copy link
Copy Markdown
Member

Adds 16 calls to libQuickDraw (110 of 305 now implemented), measured first against Mac OS 9.2.2 with PolygonCapture.c:

  • OpenRgn, CloseRgn
  • OpenPoly, ClosePoly, KillPoly, OffsetPoly
  • FramePoly, PaintPoly, ErasePoly, InvertPoly, FillPoly
  • ScalePt, MapPt, MapRect, MapRgn, MapPoly

Engine changes (Graphite2D)

These affect Swift callers too:

  • Polygons, and recorded paths of lines, fill by QuickDraw's edge rule. The old one had been checked against a single triangle.
  • With the pen hidden nothing is drawn. Erase, invert and fill used to draw anyway.
  • beginRegion and the new beginPolygon hide the pen, and ending them shows it, so showing it while recording draws as well as records.
  • FramePoly leaves the pen at the polygon's last point.
  • openRegion is now read from a settable regionRecording, so a caller can keep a port's recording elsewhere.

Library state

A call's Port lasts only as long as the call, so while a region or polygon is being recorded the library holds it, keyed by the port's address, until it is closed or the port is initialized or closed. rgnSave and polySave are only marked as non-NULL.

Still different

144 of the 156 captured lines match, including every picture. The other 12 are all mapping into an inverted rectangle; the test lists them and fails if one starts to match.

Testing

swift test passes (797 tests). The CMake build installs, exports the 305 functions the headers declare, and both C conformance programs pass.

@colemancda
colemancda merged commit 329d878 into master Dec 3, 2026
3 checks passed
@colemancda
colemancda deleted the feature/quickdraw-polygons branch December 3, 2026 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant