[cairo] image surface and zdepth or composite

Prashant Saxena animator333 at yahoo.com
Sun Aug 22 10:53:38 PDT 2010


Hi,

I am drawing various shapes (rectangles, disk, ellipse etc) on an image surface. 
Number of shapes and their positions is calculating
at run time. Once all the shapes are drawn, I am calculating the bounding box of 
all the shapes and then drawing a rounded rectangle whose size is equal to 
bounding box.
This rounded rectangle is drawing in the end hence it over writes the shape 
data. To solve this problem first I am calculating the bounding box of shapes to 
be drawn, then drawing the rounded rectangle first and then rest of the shapes.

Here pre-calculation is taking a bit extra time.
Do we have something like z-depth that can be set before drawing? For example 
you set depth to 1 draw all the shapes, while drawing bbox will be calculated, 
then you set depth to '0' and draw the rounded rectangle. It'll be drawn in the 
back because it's depth is '0'.

If z-depth is not available then another solution that might work is:
1. draw all the shapes and calculate bbox
2. draw rounded rectangle based on bbox on another image surface
3. composite shape surface on top of rounded rectangle surface

I know 1 & 2 but I don't know if 3 is possible.

Is there any other way to solve the above problem?

Cheers

Prashant





More information about the cairo mailing list