Re: Canvas, Ellipses, and RGBA
- From: Federico Mena Quintero <federico redhat com>
- To: ALIABDIN aucegypt edu
- CC: gnome-devel-list gnome org
- Subject: Re: Canvas, Ellipses, and RGBA
- Date: Mon, 6 Dec 1999 12:30:43 -0500
> 1.) First of all, how the hell do I come up with guint32 for the
> color_fill_rgba with the GnomeCanvasItem's
You can use the GNOME_CANVAS_COLOR() and GNOME_CANVAS_COLOR_A()
macros. And those *are* in the reference documentation :-)
> 'fill_color' but I really really want to use the alpha channels. I have a
> GnomeColorPicker, but thats gives me _4_ values in various forms, i.e.
> double, guint8, guint16, etc?) anyway, how do I combine values that I
> gain from the GnomeColorPicker into /ONE/ guint32 for one guint32 RGBA
> value. Havoc's book is not very helpful with this, since he directly
> writes the RGBA values - Also, it appears to be a 'hex' value (i.e. it's
> something like 0x32ab9FFF which I find weird for a guint32). Help!
When expressed in hexadecimal, an RGBA color is 0xRRGGBBAA, that is, 8
bits per channel. An alpha of 0 is fully transparent, an alpha of 255
is fully opaque.
> 2.) Why on earth to ellipses use bounding boxes?
Because
- The Tk canvas works that way.
- It is more convenient to specify a bounding box than to have
two values for the semiaxes of an ellipse and a flag that
specifies whether you want a circle or an ellipse.
> wouldn't it make /much/ more sense to provide radius, and then x
> and y coordinates for the center - Thats how I learned how circles
> to be drawn. This is relatively easy to change on my own (just
> needs a little bit of math), so I don't really mind.
X and Gdk also use bounding boxes, btw :-)
> Also, when i do a gnome_canvas_item_move on an ellipse, what
> exactly gets moved, the center of the circle? the top-left corner
> of the boundin box? the center of the bounding box?
All the points that compose the ellipse get moved, just as you would
expect. If a point (x, y) is on the ellipse, then it will get moved
to (x + dx, y + dy).
Federico
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]