Re: GdkPixBuf - Byte Order

В Срд, 18/01/2006 в 17:15 +0800, calvin softwarelabs org пишет:
> Hello,
> We are facing some problem with the byte ordering of the GdkPixbuf.
> In our application, we are using gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE,
> depth, width, height) for getting a GdkPixBuf * and from the pixbuf we are
> getting the the guchar * picturebuf. We store our image data in the
> picturebuf in the following order:
>   picturebuf +  = blue;
>   picturebuf + 1 = green;
>   picturebuf + 2 = Red;
>   picutrebuf + 3 = alpha;
> But, from the documentation we found that GdkPixBuf uses
>   picturebuf +  = red;
>   picturebuf + 1 = green;
>   picturebuf + 2 = blue;
>   picturebuf + 3 = alpha;
> Because of the mismatch in the byte ordering, ie GTK using LSB and our
> application layer using MSB, we are required to swap byte  and byte 2. Our
> system is based on Little Endian and GTK version 2.4

> Is there a way to configure the byte ordering in GTK/GDK ? Since I am new
> to gtk environment, request you to guide me.
> Thanks and Regards
> Calvin

That is not a LSB vs MSB problem (it's all about integers, not colors),
you are using GDK_COLORSPACE_BGR (Blue first. Not yet exists in gtk) and
create pixbuf with GDK_COLORSPACE_RGB. Since other colorspaces like BGR
and YUV are not supported by gdk-pixbuf yet, you need to convert data
manually from your picturebuf. 

Are you extensively mixing pixbuf/your library operations? In that case
it may have sense to modify your library. Another thing is to support
different colorspaces in gdk-pixbuf. It should not be hard to do I
think, probably it may have sense to discuss this problem on gtk-devel-
list and write a patch.

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