[cairo] Cairo and SDL

Dirk De Becker Dirk.DeBecker at dzine.be
Fri Mar 19 03:43:57 PDT 2010


Hi all,

I would like to use cairo in combination with SDL (without GTK) in a C++ 
application. However, I am having problems getting started.
My main problem is, how I can make a cairo buffer that is stored in 
video memory.
At present, I am using an ImageSurface, because it is the only thing I 
was able to create:
#define WIDTH 1366
#define HEIGHT 768
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER);
screen = SDL_SetVideoMode(WIDTH, HEIGHT, 32, SDL_HWSURFACE | SDL_DOUBLEBUF);
Display * display = XOpenDisplay(NULL);
Cairo::Refptr<Cairo::ImageSurface> my_buffer = 
Cairo::ImageSurface::create((unsigned char*))screen->pixels, 
Cairo::FORMAT_ARGB32, WIDTH, HEIGHT, 4*WIDTH);

I believe I need to use an XlibSurface instead of the ImageSurface, but 
I did not find yet how to create this using a SDL window.
Can someone give me a hint on this?

Kind regards,
Dirk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Dirk_DeBecker.vcf
Type: text/x-vcard
Size: 339 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20100319/7ae62890/attachment.vcf>


More information about the cairo mailing list