The Shape of Everything
A website mostly about Mac stuff, written by August "Gus" Mueller
» Acorn
» Retrobatch
» Mastodon
» Instagram
» Github
» Maybe Pizza?
» Archives
» Feed
» Micro feed
August 15, 2018

Here's a little movie I just put together to show myself currently debugging some things in a new brush engine I'm making for Acorn 6.2. Hopefully it'll all come together the way I'd like.

There are a number of things going on here.

To start with, it doesn't look like a nice smooth brush you'd normally see. This is because the spacing (the distance between painting "dabs") is set to 100%. I'm doing this to expose any bugs in the code which manage the distribution of the dabs, and if you look closely there seem to be a few. For instance, after the very first dab there is more whitespace than you'd expect and the final dab overlaps with the previous one. I'll have to figure out what's going on there. (The dabs change in size because I'm using a pressure sensitive Wacom stylus).

Next you'll notice little flashes of outlined boxes around one or two dabs. This is the engine telling the Metal view which portion to update to the screen. This is helpful to make sure that the minimum amount of pixels being refreshed to the screen. Why is a box drawn around a single dab and other times two dabs are outlined? Well sometimes more dabs are drawn to the bitmap than are ready to be refreshed, so the engine will queue and combine those up for me.

Does this mean the new engine is async? Yep. That's been fun to debug.

And then when the brushing ends, you'll see a bezier line drawing through the whole stroke along with a bunch of red points. The red points are where NSWindow's trackEventsMatchingMask: decided to give me new locations to draw. This was helpful earlier when I was trying to figure out why the brush stroke wasn't ending where I thought it should.

And finally, you'll noice Xcode in the background instead of Acorn's standard checker-boxed canvas. This is because I'm developing the engine in a new test app and I'm playing around with transparent metal views for fun.