[cairo] Need help in understanding some cairo code

Christian Biesinger cbiesinger at web.de
Wed Jan 25 08:24:55 PST 2006


John Allerdyce wrote:
> 1. Why pass tmpBuf.get()  to cairo_image_surface_create_for_data()?

That makes cairo store the image data in the provided buffer. If the 
code you showed is the complete code, then I don't see a reason why it 
doesn't just use cairo_image_surface_create without providing a buffer...

> 2. What is the purpose of cairo_set_source_surface() and later with
> cairo_paint_with_alpha() with the parameter mCairo?

That draws the contents of tmpSurf onto the cairo context mCairo, using 
a global opacity of mGlobalAlpha. If the code you showed is complete, 
then the data is uninitialized, so the results will be quite random...

> 3. What does it save to the file? the data in tmpBuf? or mCairo?

The data in tmpSurf/tmpBuf (which is the same). mCairo probably refers 
to a different surface.



More information about the cairo mailing list