Email or username:

Password:

Forgot your password?
Devine Lu Linvega

During tinycodechristmas last year, someone showed me how to get halftones by using xor(x,y) so I could turn 4 colors into 4 colors and 3 inbetween halftones. It makes for drawing pictures in a 4 colors screens without dithering somewhat practical.

I've been working on some slides for an upcoming talk and updated Adelie to render tga files with these extra half tones :mac:

git.sr.ht/~rabbits/adelie

Black and white image dithered with a simple XOR function.
4 comments
icoon

@neauoire nice! Are there some docs/resources on how the halftining xor works?

Devine Lu Linvega

@icoon Someone explained it to me on here many months back, but the idea is to take the x,y positions and XOR them together, mask it with 0x01 AND, so you get either 0 or 1, and add that whenever the color of the source pixel is a multiple of two.

The function in the image shows how I do it in a catlang.

Go Up