Hi All,

It seems to almost work nicely... except for the extra 2 pixels that are
Added to the Top of the converted CAIRO texture.
Just was wondering what I'm missing here? :)

Any help is much appreciated. :)

Thanks,
Izzy.

Snippet:

        //...

guint8 *data = NULL;
CoglHandle *cogl_handle = NULL;

ClutterTexture *tex = CLUTTER_TEXTURE( clutter_texture_new_from_file(
"icon1.png", NULL ) );
cogl_handle = clutter_texture_get_cogl_texture( tex );

guint rowstride = cogl_texture_get_rowstride( cogl_handle );
//CoglPixelFormat frmt = cogl_texture_get_format( cogl_handle );

#if G_BYTE_ORDER == G_LITTLE_ENDIAN
#define PIXEL_FORMAT COGL_PIXEL_FORMAT_BGRA_8888_PRE
#elif G_BYTE_ORDER == G_BIG_ENDIAN
#define PIXEL_FORMAT COGL_PIXEL_FORMAT_ARGB_8888_PRE
#else
#define PIXEL_FORMAT COGL_PIXEL_FORMAT_ANY
#endif

int len = cogl_texture_get_data( cogl_handle, PIXEL_FORMAT, rowstride, NULL
);
data = g_malloc( len );
cogl_texture_get_data( cogl_handle, PIXEL_FORMAT, rowstride, data );

        // if I pass  'data + 4' as the 1st argument, one of the 2 extra
pixels is gone... but I'm not sure that's the right way.
cairo_surface_t *test = cairo_image_surface_create_for_data( data,
CAIRO_FORMAT_ARGB32, 16, 16, rowstride );

g_free( (gpointer) data );

        //...
_______________________________________________
clutter-app-devel-list mailing list
[email protected]
http://lists.clutter-project.org/listinfo/clutter-app-devel-list

Reply via email to