vikrum / kidpix

JSKIDPIX v1.0.2021

Home Page:https://kidpix.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing tool: wacky brush, 3d brush

gingerbeardman opened this issue · comments

Your sample image

https://user-images.githubusercontent.com/291215/128236489-32a56b21-17e9-4b4a-b631-a987472127c4.png

It seems to me that this is drawing two strokes at once.

  1. solid line
  2. dither highlight

More Examples

Here are two ovals:

  1. left: drawn clockwise
  2. right: drawn anti-clockwise

These were drawn starting/ending at the 12 o'clock position,
but the result is the same regardless of starting/ending position.

Screen shot 2021-08-07 at 14 21 38

Notes

  • they are diagonally mirrored along the line top-left to bottom-right

Here are some horizontal and vertical lines:

  1. drawn upwards (bottom to top)
  2. draw downwards (top to bottom)
  3. drawn rightwards (left to right)
  4. drawn leftwards (right to left)

Screen shot 2021-08-07 at 14 24 54


Here are some diagonal lines:

  1. drawn upwards to left (bottom to top)
  2. draw downwards to right (top to bottom)
  3. drawn upwards to right (bottom to top)
  4. draw downwards to left (top to bottom)

Screen shot 2021-08-07 at 14 29 57

Notes

  • 1 & 2 are "opposite" (let's say of widths 0 and 1)
  • 3 & 4 are "identical" (let's say both of width 2)

A reproduction of your ornate shape:

  • drawn starting from A and ending at B

Screen shot 2021-08-07 at 14 36 47


My educated guess

Here's how I think it does it:

  1. draw the solid stroke
  2. set size of the dither stoke according to direction (delta from last draw)
  3. draw the dither stroke up-left a few pixels

Size of dither stroke

  • up/left decreases the size
  • down/right increases the size

But from what default values?
And by what factor?

I'd have to experiment with code to figure out the details.

Thank you for this! A kind soul (isachs@) reached out to Craig Hickman about the 3d brush tool and he responded back with this:

"I didn’t know about this. It’s an interesting implementation. The line he has questions about is simply two lines drawn at the same time. One solid on the bottom and a line with a 50% halftone pattern on the top. The first version of Kid Pix was written for the original Macintosh one bit graphics."

I'll keep noodling on it too. Worst comes to worst, the freeware/public domain version of KidPix is available here: http://cd.textfiles.com/garbo/MAC/GRAPHICS/ and we can reverse engineer that.

So I was right! That's good to know.

That said, neither Craig or myself have the exact details just yet. So close!

I'll keep thinking about it.

edit: have also asked over at Macintosh Garden to see if anybody fancies reverse engineering it.

reverse engineered the public domain version a bit, and i think it goes like this:

while mouse held down:

  • set pen size to 5x5
  • set pattern to solid
  • draw line from (old_x, old_y) to (new_x-1, new_y-1)
  • set pen size to 2x2
  • set pattern to 50% black (checkerboard)
  • draw line from (old_x, old_y) to (new_x-2, new_y-2)
  • (old_x, old_y) = (new_x, new_y)

Wow! Thanks @ubuntor for your RE work on this.

I'm amazed that got very close to how it works just by eyeballing.

Thinking about it, the 2x2 checkerboard is what affects the apparent "width" of the dithered stroke and it differing by orientation. Two corners will be white and two will be black! Tada!

@ubuntor Huge thank you for digging this out. After giving it a try and not getting it to replicate, I figured out why both @gingerbeardman and I went down the wrong path (my guess too was that there was some implementation detail factoring in deltas or direction).

Turns out I was confusing myself with the velocity of the brush! It's an implementation detail that in the OG version the direction of the strokes causes previous renderings to stomp on each other! That's a huge part of the effect! If you increase the speed and try all the different directions, orientations, the dithered 2nd line shows up! 😂

See towards end of video here:
https://user-images.githubusercontent.com/291215/129132915-67a5e714-137b-455f-8fa9-78e4ff086246.mov

Rough ballpark in codepen:
Screen Shot 2021-08-11 at 8 17 07 PM

Thanks @gingerbeardman @ubuntor ! I'll try to work on a release this weekend and get a bunch of other fixes out too.

kidpix-1629085555832

Thanks all! To be deployed shortly. Variety of "halftones" behind the usual modifier keys.