Re: GdkPixbuf pixel data weirdness



On Mon, 2003-03-10 at 03:32, Chris Garrett wrote:
Thanks Evan!

It was a rowstride problem.  I did not realise that the width of each row 
was not equal to the number of pixels * 3 (in 8bpp mode) or 4 if an alpha 
channel was added.

Why is this?  What are the padding pixels used for at the end of each row? - 
is it so that the start of the next row is word aligned?  I could not find 
anything in the docs apart from the gdk_pixbuf_get_rowstride() function 
call, which simply defines rowstride without an explanation.

There are a couple of reasons. Padding is a big one ... operations can
be a lot more efficient if things are properly aligned.

But another reason is to allow creating a "subpixbuf" that points
to the pixel data of a larger image ... see gdk_pixbuf_new_subpixbuf().

Regards,
                                               Owen





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