[cairo]how to draw bitmap with cairo

stephen_liwf stephen_liwf at 126.com
Fri Sep 22 01:17:01 PDT 2006


Hi all, 

I'm newbie, I try to show bitmap(1bpp~24bpp) using cairo_image_surface_create_for_data(), but find out the speed is unbearable.

Code goes like this:
...
cairo_t *pMemCR = pGraphics->GetCR();
DFE_ASSERT(pMemCR != DFE_Null);
cairo_move_to(pMemCR, dDstX, dDstY);

cairo_surface_t *image = cairo_image_surface_create_for_data((unsigned char*)pData, CAIRO_FORMAT_A1, pInfo->bmiHeader.biWidth, pInfo->bmiHeader.biHeight, 0);
cairo_set_source_surface(pMemCR, image, dDstX, dDstY);
cairo_paint(pMemCR);
cairo_surface_destroy(image);
...

Is this the correct method to show bitmap? Or there is better way to do it(manipulate pData directly...)?
Hope someone would shed light on this. Thanks!


stephen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/cairo/attachments/20060922/e74b806a/attachment.html


More information about the cairo mailing list