Re: Canvas, Ellipses, and RGBA



[response is down below]

On Mon, 6 Dec 1999, Mathieu Lacage wrote:

> Ali Abdin <ALIABDIN@aucegypt.edu> 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


This is 'still' not really clear - Okay say I have a variable 'i' do I do
i = 0;
and then use the << and >> operators, or do I just do it without any 
initialization?
When do I use << and when do I use >>? What order must they be in?

Secondly - the RGBA values you gave are confusin - how do I get them from 
a GnomeColorPicker - do I take the 'gdouble' values, do I take the 
'guint8' or the 'guint16'?

Can you give me an example? Like 
guint8 R,G,B,A;
guint32 fill_color = 0;

fill_color = fill_color << R << G << B << A;

Will the above work correctly? If not what should I do?



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