I think it would depend on what kind of RGB (24-bit, 3 bytes per pixel) data
you have, whether it has alpha channel along with the RGB channel (RGBA)
(32-bit, 4 bytes per pixel).

so if you have just plain 24-bit per pixel RGB data, you need to pass 3 for
bytes per pixel, otherwise its going to be 4.

The rowstride would be a little more tricky.  I thing it will be width * (3
or 4, depending on the kind of data, or bytes per pixel) rounded up to a
multiple of 4.  so for a 640x480 image, with RGB, the the rowstride would be
640*3 (it is divisible by 4), for an image like 201x100 with RGB data it
would 201*3 = 603 rounded up to a multiple of 4 = 604 (divisble by four).

I think this is how it works.  Somebody, please correct me if I am wrong.

A simple bit operation can always give you the correct result:

rowstride = ((width * bpp) + 3) & (~0x3)

Hope this makes sense.

On Mon, Jul 6, 2009 at 6:34 AM, Saul Lethbridge
<[email protected]>wrote:

> Hi All,
>
> I'm trying to understand what values I need to enter for the function
> clutter_texture_set_from_rgb_data, see below:
>
>
> rowstride : Distance in bytes between row starts.
> bpp : bytes per pixel (Currently only 3 and 4 supported, depending on
> has_alpha)
>
> Thanks
>



-- 
Uday
http://soundc.de/

Reply via email to