Re: setting Gtk2::Gdk::Color pixel




On Nov 16, 2007, at 6:40 PM, Kevin Ryde wrote:

Ie. for xors or other crazy GCFunction operations I think the GdkColor
is not a colour, just a way to pass a pixel value with the bits you want
to flip or set or whatever.

(I imagine apart from xors most such things are only really useful for a
pseudocolor where you've setup particular colours in particular pixels
of the colormap. Maybe on a truecolor you could OR in some extra red on
top of other drawing, or something like that though.)

XOR is useful for reversible drawing. I swear, the white+xor trick works. I just wrote the attached script, and used it to create the attached screenshot. Load your favorite picture (watch out -- scaling and scrolling are left as an exercise for you) and drag button 1 around.

Back in the olden days, fancy alpha compositing and such was simply too expensive for interactive operations like rubber-band selection. XOR allowed you to make a reversible change to the target very cheaply. Doing and XOR bitwise operation on a 24-bit color value flips all the bits and typically gives you the opposite RGB color. This is nice because you can see what you're doing... mostly. Doesn't work so great on grays.

Attachment: xor.pl
Description: Text Data

JPEG image




(For those who are curious, yes, those are my kids. The picture is from around Halloween in '06.)

--
elysse:  You dance better than some.
me:  "Some" what?
elysse:  Some asparagus.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]