Re: Changing picbuf-data.



On Tue, Feb 13, 2007 at 07:41:24PM +0100, Magnus Myrefors wrote:
> Does anyone know why you can't change the value of 
> a pixbuf-pixel to yellow?

Choose r, g, b components corresponding to the desired tone
of yellow (all graphics programs can display the r, g, b
values, also GtkColorSelection can).  Store them as bytes in
this order to the pixbuf pixel.

If the pixbuf has an alpha channel, you may also wish to set
the value of alpha.

> I have examined a pixbuf-dataarea
> and it seems like a yellow color in the pixbuf is stored
> like this [235, 3, 243, 1].

If the pixbuf has an alpha channel, the values are stored as
r, g, b, a.  This means the pixel is pink, but with alpha
value only 1 and therefore almost transparent, i.e. almost
invisible.

If the pixbuf does not have an alpha channel, there are only
three bytes per pixel and [235, 3, 243, 1] can be several
things depending on what components of the two adjacent
pixel it overwrites.

> When I change a stored value
> to these, one would expect that the result would be yellow
> but when shown in a widget it becomes white instead.

In both cases yellow can result only from sheer luck (white
isn't a very likely outcome either).

Yeti


--
Whatever.



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