[cairo] image surface and zdepth or composite

Arjen Nienhuis a.g.nienhuis at gmail.com
Sun Aug 22 12:33:54 PDT 2010


In pseudocode:

push_group()
bb = draw_shapes_and_return_bounding_box()
g = pop_group()
draw_round_rect(bb)
paint_group(g)

On Sun, Aug 22, 2010 at 7:53 PM, Prashant Saxena <animator333 at yahoo.com>wrote:

> 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
>
>
>
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20100822/caebc48a/attachment.html>


More information about the cairo mailing list