alpha channel with Gdk/Gtk+ color



I am revisiting a simple kaleidoscope program in which I would like to add
opacity/transparency for the colors. Can that
be done? I have rummaged around looking for info on the alpha channel, but
can't find anything that isn't stuck inside the
ColorSelection widget. That's not what I want; just the adjusting of the
transparency.

So, I have an array of 30 triangles, in order; a GdkColor array of 30
colors. Is there a straightforward way to add varying
opacity for the triangles? I would like to have the triangles grow less and
less opaque going from bottom to top. This all is
done through a pixmap, of course.

I read the passage on the ColorSelection widget in the Gtk tutorial. It
talks about the alpha channel, which goes from 0 - 65535.
I added that to the little sample code in the tutorial, and a ColorSelection
dialogue does show an opacity slider, but with
a range from  0 - 255. But the tutorial does not show how to use the alpha
channel in selecting a color.

GdkColor doesn't include an alpha channel. The GIMP does have an opacity
slider sometimes, and in playing with it I could
change the opacity of a color. That as well has a range  of 0  255, not the
full alpha channel of 0 - 65535.

Any help in adding varying opacity/transparency for the triangles will be
much appreciated.

Michael Ehrhardt



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