Saturday, September 16, 2023

⚗ RgbaCircle Prototype

Prototype Version 2

I've created a second version of the first prototype discussed earlier (see below.)

This version replaces the pixels in the circle's border (to delimit the area for painting) with the pixels that were there before drawing the circle, and applies the rgba colour to each of those pixels.

Compare this second version of the app (via the links immediately below) to the first version of the app (via the links at the very far bottom of this blog item) 




Prototype Version 1


Just starting to sketch out code for an eventual include library.

I think the process will involve drawing the circle in some "reserved" colour, filling that circle, and then either "undoing" the border, or replacing the border with the the original pixels (before circle drawing), and then applying the rgba colour to those original pixels.

That will mean that I will need to setup the code to copy the screen area before drawing the circle, so that we can have access to the pixels that ought to be where the border is.

Why bother with the border and why not setup the algorithm to just paint there too?

My circle algorithm, to not have any gaps in the circle, likely repeats the drawing of some pixels in the border (rounding issues etc. related to aspect ratio between pixel width and pixel height which can be different from screen mode to screen mode).  Doing rgba painting while drawing the circumference, I was getting some lines painted twice, so some of the painting coming out darker, because of double (or more) rgba painting in the same spot.

By using a "reserved" colour to draw the circle border, we can use that colour to figure out the circle area for rgba painting: we just need to find the leftmost inner border colour and the rightmost inner colour, for every line of pixels in the area, and paint between the inner borders.  Nice and tidy.

Something like that.  I'm going to need to sleep over it a little.



No comments:

Post a Comment

🖥 Oriental Paintbrush Sim

This is a port and mod of a QBJS program ("Calligraphy Pro 128 Studio:  Oriental paintbrush mode") by Vince. Click/touch the canva...