Re: gdk_pixbuf questions



On Sun, Mar 30, 2003 at 11:00:31PM +0200, Jochen Voss wrote:
> 
> I have a question about gdk_pixbuf: in which order are the
> RGBA values organised in memory? 

It depends on the return of gdk_pixbuf_get_colorspace() and
gdk_pixbuf_get_n_channels(), though at the moment the only possible
values are RGB and RGBA.

> Do I need to care about the byte order of the machine?

No.

> The specific questions are:
> (1) What is a portable way to access the alpha values of a pixbuf?
> Does something like
> 
>     pixels = gdk_pixbuf_get_pixels(pixbuf);
>     alpha = pixels [ 4*(y*width + x) + 3 ];
> 
> always work, or does this depend on the byte order?

It doesn't depend on byte order, but you need rowstride instead 
of width, and you need to be sure the pixbuf has an alpha channel.

> (2) How can I portably construct the 'pixel' argument for
> 'gdk_pixbuf_fill'?  Does 0x000000FF always denote opaque black, or is
> it transparent blue on some systems?

0x000000FF is always opaque black. It's defined as 
R << 24 | G << 16 | B << 8 | A I believe.

Havoc



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