[clutter] clutter_texture_set_from_rgb_data

2009-07-06 Thread Saul Lethbridge
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


Re: [clutter] clutter_texture_set_from_rgb_data

2009-07-06 Thread Saul Lethbridge
Thanks for that. I'm assuming my RGB data is 24bit, I'm using standard SVG
files.

On Tue, Jul 7, 2009 at 2:44 AM, Uday Verma uday.ka...@gmail.com wrote:

 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 saul.lethbri...@gmail.com
  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/



Re: [clutter] clutter_texture_set_from_rgb_data

2008-07-02 Thread Matthew Allum
Dont you mean 2BPP - i.e 16bit ?

  == Matthew

On Wed, 2008-07-02 at 14:28 +0800, HASWANI HARISH-VCKR47 wrote:
 Hi All,
  
 While going through clutter_texture_set_from_rgb_data API, I found
 that currently clutter support only 4 BPP.
  
 will clutter 0.8 support 3BPP ( implies support for
 COGL_PIXEL_FORMAT_RGBA__PRE or COGL_PIXEL_FORMAT_RGBA__PRE )
  
 Means, whether we'll have more generic implementation for
 clutter_texture_set_from_rgb_data API in clutter 0.8?
  
 Regards,
 Harish Haswani,
 LJ-P2P, GRAPHICS, MME Group, MIEL, Bangalore, INDIA
 Ph: 91-80-26014164
  

-- 
To unsubscribe send a mail to [EMAIL PROTECTED]



RE: [clutter] clutter_texture_set_from_rgb_data

2008-07-02 Thread Matthew Allum
In which case no not yet and doubtful for 0.8.0 at least unless someone
sends a patch. 

  == Matthew

On Wed, 2008-07-02 at 17:01 +0800, HASWANI HARISH-VCKR47 wrote:
 Yes, 2BPP = 2Bytes per pixel like  RGBA5551 or RGBA or RGB565
 
 
 Regards,
 Harish Haswani,
 LJ-P2P, GRAPHICS, MME Group, MIEL, Bangalore, INDIA
 Ph: 91-80-26014164
 
 -Original Message-
 From: Matthew Allum [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, July 02, 2008 2:29 PM
 To: HASWANI HARISH-VCKR47
 Cc: clutter@o-hand.com
 Subject: Re: [clutter] clutter_texture_set_from_rgb_data
 
 Dont you mean 2BPP - i.e 16bit ?
 
   == Matthew
 
 On Wed, 2008-07-02 at 14:28 +0800, HASWANI HARISH-VCKR47 wrote:
  Hi All,
   
  While going through clutter_texture_set_from_rgb_data API, I found 
  that currently clutter support only 4 BPP.
   
  will clutter 0.8 support 3BPP ( implies support for 
  COGL_PIXEL_FORMAT_RGBA__PRE or COGL_PIXEL_FORMAT_RGBA__PRE )
   
  Means, whether we'll have more generic implementation for 
  clutter_texture_set_from_rgb_data API in clutter 0.8?
   
  Regards,
  Harish Haswani,
  LJ-P2P, GRAPHICS, MME Group, MIEL, Bangalore, INDIA
  Ph: 91-80-26014164
   
 

-- 
To unsubscribe send a mail to [EMAIL PROTECTED]



Re: [clutter] clutter_texture_set_from_rgb_data

2008-07-02 Thread Neil Roberts
On Wed, 2008-07-02 at 14:28 +0800, HASWANI HARISH-VCKR47 wrote:
 
 While going through clutter_texture_set_from_rgb_data API, I found
 that currently clutter support only 4 BPP.
  
 will clutter 0.8 support 3BPP

Clutter happily supports 3 bytes per pixel if by that you mean 1 byte
for each of the R, G and B components and no alpha channel. You just
need to set the has_alpha argument to FALSE. The documentation is a bit
misleading there.

- Neil

-- 
To unsubscribe send a mail to [EMAIL PROTECTED]



Re: [clutter] clutter_texture_set_from_rgb_data

2008-07-02 Thread Chris Lord
On Wed, 2008-07-02 at 10:13 +0100, Neil Roberts wrote:
 On Wed, 2008-07-02 at 14:28 +0800, HASWANI HARISH-VCKR47 wrote:
  
  While going through clutter_texture_set_from_rgb_data API, I found
  that currently clutter support only 4 BPP.
   
  will clutter 0.8 support 3BPP
 
 Clutter happily supports 3 bytes per pixel if by that you mean 1 byte
 for each of the R, G and B components and no alpha channel. You just
 need to set the has_alpha argument to FALSE. The documentation is a bit
 misleading there.

I added some clarification to the docs about this yesterday, hopefully
it's a little bit clearer now.

--Chris


-- 
To unsubscribe send a mail to [EMAIL PROTECTED]



Re: [clutter] clutter_texture_set_from_rgb_data

2008-07-02 Thread Neil Roberts
On Wed, 2008-07-02 at 10:59 +0100, Robert Bragg wrote:
 One option is to use cogl_texture_new_from_data which supports more
 formats and also lets you control the internal format.

I was just about to reply saying the same thing with this little
example:

  cogl_tex = cogl_texture_new_from_data (TEX_WIDTH, TEX_HEIGHT,
 32, FALSE,
 COGL_PIXEL_FORMAT_RGB_565,
 COGL_PIXEL_FORMAT_ANY,
 TEX_WIDTH * 2,
 (guchar *) tex_data);
  tex = clutter_texture_new ();
  clutter_texture_set_cogl_texture (CLUTTER_TEXTURE (tex), cogl_tex);
  cogl_texture_unref (cogl_tex);

- Neil

-- 
To unsubscribe send a mail to [EMAIL PROTECTED]



Re: [clutter] clutter_texture_set_from_rgb_data

2008-07-02 Thread Jason Tackaberry
[Resending to list again; sigh, clutter is the only list I use which doesn't 
rewrite Reply-To :)]

On Wed, 2008-07-02 at 10:13 +0100, Neil Roberts wrote:
 Clutter happily supports 3 bytes per pixel if by that you mean 1 byte
 for each of the R, G and B components and no alpha channel. You just
 need to set the has_alpha argument to FALSE. The documentation is a bit
 misleading there.

Is the 3bpp support first converted to 4bpp in software before uploading
to the card, or can textures natively support this formaT?

Is it possible to pass RGB32 (4bpp) but have clutter ignore the alpha
channel?  I ask because ffmpeg's libswscale sets the alpha channel to 0
when scaling to RGB32.  (And they seem to have no desire to change this
behaviour; I sent a patch years ago that went ignored.)

Cheers,
Jason.  

-- 
To unsubscribe send a mail to [EMAIL PROTECTED]



Re: [clutter] clutter_texture_set_from_rgb_data

2008-07-02 Thread Neil Roberts
On Wed, 2008-07-02 at 08:28 -0400, Jason Tackaberry wrote:
 [Resending to list again; sigh, clutter is the only list I use which doesn't 
 rewrite Reply-To :)]

Can anyone fix this? I've fallen for that a few times too :(

 Is the 3bpp support first converted to 4bpp in software before uploading
 to the card, or can textures natively support this formaT?

OpenGL certainly has support for uploading textures in this format but I
guess potentially the driver might need to internally convert it to a
different format, but at least this will always give you the fastest
route. COGL lets you pick a different format for the internal texture so
you can choose whether you want it to convert before uploading to the
card or not.

 Is it possible to pass RGB32 (4bpp) but have clutter ignore the alpha
 channel?

I don't think this is possible without having COGL convert the texture
unfortunately. You essentially want to disable GL_BLEND and draw the
texture but cogl_texture_rectangle enables GL_BLEND based on whether the
texture has an alpha channel. You could of course make a custom actor
and override ClutterTexture::paint and draw with raw GL calls but that's
not so fun.

- Neil

-- 
To unsubscribe send a mail to [EMAIL PROTECTED]