News for hackers. Stuff that matters.
Re:Investigating MacPaint's Source Code by DesertVarnish on Friday April 04, 2025 @11:51PM (#43590563)
My wife has been working on a pixel accurate recreation of MacPaint on the web, and one of the things that I've learned from on-and-off helping with it was just how much of the magic in it is actually just handled by QuickDraw.

Also, the text styling has a lot more complexity than you would expect.

Re:Investigating MacPaint's Source Code by jwstarr on Friday April 04, 2025 @11:56PM (#43590582)
By "pixel accurate", do you mean the user interface or the rendering? Is she able to leverage the HTML 2D Canvas API or does she have to go lower level than that?
Re:Investigating MacPaint's Source Code by allthreespies on Saturday April 05, 2025 @04:03AM (#43591794)
I’m using a buffer pool and raw bitmaps with calls to drawImage - the canvas api doesn’t play very well with trying to do things in a pixel perfect way.

I’ve gone on a lot of rabbit holes digging into original source code and dev manuals for this project, hopefully one day I’ll write some of it up somewhere. I think what’s been interesting is iterating towards the most elegant solutions has often meant ending up with pretty similar approaches to what Atkinson originally used.

Re:Investigating MacPaint's Source Code by userbinator on Saturday April 05, 2025 @01:41AM (#43591104)
MSPaint (which I wish MS would officially open-source) heavily relies on GDI too.
Re:Investigating MacPaint's Source Code by gblargg on Saturday April 05, 2025 @05:56AM (#43592237)
QuickDraw's regions always impressed me. They could cover an arbitrary area, and most operations could be masked to a region. This was important for updating a window behind another efficiently, just mask to the visible portion and draw its contents normally.
Re:Investigating MacPaint's Source Code by JKCalhoun on Saturday April 05, 2025 @09:14AM (#43593202)
Me as well.

As I recall, regions were essentially something akin to an array of run-length-encodings for each scan line (where, additionally, there was a sentinel or some way to indicate the next n rows are the same as the previous). The fun part is then writing a set of routines to union, difference, etc. pairs of these RLE region objects (and here I use the word 'object' loosely).