How does semi-transparency work on the anti-aliased canvas?



Hi,

This all started by someone asking how to make Venn diagrams
in Perl.  See attached example, reverse-ripped from the canvas demo.

In the demo for the latest
Gnome2-Canvas-1.002, in particular at the "canvas-primitives"
tab. It has a "cadet-blue" ellipse, which is created on the anti-aliased
canvas, like this:

        setup_item (Gnome2::Canvas::Item->new ($root,
                                           'Gnome2::Canvas::Ellipse',
                                           "x1", 210.0,
                                           "y1", 80.0,
                                           "x2", 280.0,
                                           "y2", 140.0,
                                           "fill_color_rgba", 0x3cb37180,
                                           "outline_color", "black",
                                           "width_pixels", 0));
                        

I can manipulate the "fill_color_rgba" hex number to
give me a few different semi-transparent ellipses, but
can anyone explain how the hex numbering actually works to
produce the semi-transparent effect?

The canvas demo, is set up, to allow you to choose a normal
(not anti-aliased) example, which does it on the basis of using a stiple.
It's alot uglier, but it is always how I thought it was done, coming from
Tk.

Thanks.


-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html

Attachment: canvas-primitives4
Description: Binary data



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