Re: Canvas, Ellipses, and RGBA

Ali Abdin <> writes:

> I just have some gripes and problems with the canvas which I'd like to 
> share, and hopefully somebody can help me with them:
> 1.) First of all, how the hell do I come up with  guint32 for the 
> color_fill_rgba with the GnomeCanvasItem's - I currently use just 
> '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!

which means it is : 
0x32 ab 9F FF
  R  G  B  A

ex: 0x00FF0080
this a green which is semi-transparent

moving your original values to this format is straightforward:

use the << and >> operators

> 2.) Why on earth to ellipses use bounding boxes? 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. 

yes, you need to do it yourself. this is simply because of the API.

> But its just a nagging thing that I have. 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?

The top-left corner of the bounding box.

> any help/info is appreciated :)

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