Re: subtractive painting



thsman <adwords@xxxxxxxxxxxxxxxx> schrieb im Beitrag
<1167265748.469328.281630@xxxxxxxxxxxxxxxxxxxxxxxxxxx>...
Using getpixel and setpixel I have made a crude kind of painting
program for my kids and they are quite happy about it. But I want to
make the colors on the screen behave in a similar way to the way paint
pigments do on paper. In other words I want a shade of green to appear
when blue is painted over an existing yellow color, or orange to come
from painting red over yellow.
Sounds simple but I have spent days Googling around this and have not
found the formula I need.

If your program is restricted to the 16 basic solid colours ('VGA'
colours), the easiest way presumably is a lookup table with 14 x 14 = 196
entries (2 colours, black and white, don't need to be covered by the table:
any pen colour combined with a black pixel gives a black pixel; any pen
colour combined with a white pixel gives a pixel in the source colour).
Every table entry needs to have 3 members: the source (pen) colour, the
pixel colour, and the resulting colour (just 196 * 3 * 4 = 2.352 bytes).

--
----------------------------------------------------------------------
THORSTEN ALBERS Universität Freiburg
albers@
uni-freiburg.de
----------------------------------------------------------------------

.


Loading