[cairo] Does pixman refactoring also contain new pixel formats ?

Stefan Landvogt stefan.landvogt at gmail.com
Tue Jun 2 08:19:55 PDT 2009


I am using Cairo in an propriety window system. The pixel format is  
given and cannot be changed on the window system side: I tried that  
before and will just not be possible.

The cairo image surface is created with the following call:
cairo_image_surface_create ( CAIRO_FORMAT_ARGB32, GetWidth(),  
GetHeight() );

and the possibilities with Cairo are restricted to the following:
typedef enum _cairo_format {
     CAIRO_FORMAT_ARGB32,
     CAIRO_FORMAT_RGB24,
     CAIRO_FORMAT_A8,
     CAIRO_FORMAT_A1
     /* The value of 4 is reserved by a deprecated enum value.
      * The next format added must have an explicit value of 5.
     CAIRO_FORMAT_RGB16_565 = 4,
     */
} cairo_format_t;


So I have to rephrase my question:

Is there the chance, that after the refactoring of pixman we might get  
additional cairo_format's ?

I had some conversation with Carl Worth about that topic, and for me  
it would be great to have some additional formats:
http://lists.cairographics.org/archives/cairo/2009-January/016436.html




On Jun 2, 2009, at 15:38 , Petr Kobalíček wrote:

> Hi Stefan,
>
> can you please describe why you are using this pixel format, or the
> library that needs this? My experiences are that problems are always
> with gdk_pixbuf and wxWidgets. Currently cairo and pixman supports
> most used 32 bit format that is endian dependent, but I think this is
> right choice.
>
> Cheers
> - Petr
>
> 2009/6/2 Stefan Landvogt <stefan.landvogt at gmail.com>:
>> Hi Soeren,
>>
>> I did not follow the list closely in the last weeks, but I was
>> wondering, whether the pixman refactoring also lead to new pixel
>> formats.
>>
>> At the moment my main performance bottleneck is the following code,
>> that I have to use, when putting the graphics onto the screen in my
>> environment:
>>
>> int currentWidth = GetWidth();
>> int     currentHeight = GetHeight();
>>
>> unsigned char *bufferARGB = 0;
>> bufferARGB = cairo_image_surface_get_data( GetCairoSurface() );
>>
>> unsigned char* bufferRGBA = new unsigned char[currentWidth *
>> currentHeight * 4];
>>
>> int currentRGBA = 0;
>> for(int i=0;i< currentWidth * currentHeight * 4;i+=4)
>> {
>>       bufferRGBA[currentRGBA++] = bufferARGB[i+2];
>>       bufferRGBA[currentRGBA++] = bufferARGB[i+1];
>>       bufferRGBA[currentRGBA++] = bufferARGB[i];
>>       bufferRGBA[currentRGBA++] = bufferARGB[i+3];
>> }
>>
>> aSurface->DrawSetTextureRGBA( aTextureID, bufferRGBA, currentWidth,
>> currentHeight );
>>
>> delete[] bufferRGBA;
>>
>> _______________________________________________
>> cairo mailing list
>> cairo at cairographics.org
>> http://lists.cairographics.org/mailman/listinfo/cairo
>>



More information about the cairo mailing list