Skip to content

Add CopyBits and CopyMask to libQuickDraw - #70

Merged
colemancda merged 14 commits into
masterfrom
feature/quickdraw-copybits
Dec 3, 2026
Merged

colemancda merged 14 commits into
masterfrom
feature/quickdraw-copybits

Conversation

@colemancda

Copy link
Copy Markdown
Member

Adds CopyBits and CopyMask between black and white bitmaps to libQuickDraw (112 of 305 now implemented), measured first against Mac OS 9.2.2 with CopyBitsCapture.c.

A destination with the current port's pixels is clipped by its regions and left alone with the pen hidden; another bitmap is limited only by its bounds and the mask region.

Engine changes (Graphite2D)

These affect Swift callers and picture playback too:

  • The port rectangle no longer limits drawing, only the pixels, visRgn and clipRgn.
  • A 1-bit source is scaled as QuickDraw scales it: shrinking ORs the source pixels a destination pixel covers; stretching takes one.
  • Transparent mode no longer paints a bitmap's clear pixels.
  • A copy within the same memory reads the source as it was.

libQuickDraw behavior change

In its black and white ports, every ForeColor and BackColor other than white now draws black, as Mac OS did. Yellow, for one, used to draw white.

Still different

64 of the 66 captured lines match. The other two copy from a source rectangle reaching outside its bitmap, where Mac OS copied the memory there; Graphite doesn't read it and leaves the destination. The test lists both.

Not measured

  • Scaling of sources deeper than 1 bit, which is unchanged.
  • Whether the current port's colors apply when copying into another bitmap; they are applied.

Testing

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

@colemancda
colemancda merged commit 630fd02 into master Dec 3, 2026
3 checks passed
@colemancda
colemancda deleted the feature/quickdraw-copybits branch December 3, 2026 05:14
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