[cairo] Need help in understanding some cairo code
John Allerdyce
allerdyce.john at gmail.com
Tue Jan 24 15:28:18 PST 2006
I come across the following cairo code, I appreciate if someone can help me
understand them:
1. Why pass tmpBuf.get() to cairo_image_surface_create_for_data()?
2. What is the purpose of cairo_set_source_surface() and later with
cairo_paint_with_alpha() with the parameter mCairo?
3. What does it save to the file? the data in tmpBuf? or mCairo?
// Create a temporary surface to hold the full-size image in cairo
// image format.
nsAutoArrayPtr<PRUint8> tmpBuf(new PRUint8[
aSurfaceSize.width*aSurfaceSize.height*4]);
cairo_surface_t *tmpSurf =
cairo_image_surface_create_for_data(tmpBuf.get(),
CAIRO_FORMAT_ARGB32,
aSurfaceSize.width, aSurfaceSize.height,
aSurfaceSize.width*4);
cairo_set_source_surface(mCairo, tmpSurf, 0, 0);
cairo_paint_with_alpha(mCairo, mGlobalAlpha);
cairo_surface_write_to_png(tmpSurf, "my.png");
Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/cairo/attachments/20060124/338d017e/attachment.html
More information about the cairo
mailing list