[cairo] API request: obtain the trapezoids that are outside of the surface

Jost Boekemeier jost2345 at yahoo.de
Tue Aug 24 09:36:34 PDT 2004


On Wed, 2004-08-18 at 17:58, Carl Worth wrote:

> 1) Given a cubic Bzier spline, it is guaranteed to be contained within
>    the polygon formed by its four control points.
> 
> 2) If stroking rather than filling, the bounds needs to be increased by
>    one half the line width in each dimension, (this includes the space
>    needed for the stroke, any caps, and for bevel and round joins).
> 
> 3) If stroking with miter joins, then the increase in step 2 should
>    instead be: 0.5 * (miter_limit * line_width).
> 
> So, that should lead to a calculation that is plenty fast, and is
> sufficient for you to get a positive test result if a shape ever exceeds
> the surface bounds. It's not necessarily tight, so it can give false
> positives when the shape gets close, but I would imagine you can deal
> with that, right?

Yes, this will work, thanks.   Associating a persistent bounding box
with the FILL and STROKE token and keeping the boxes as if they were
ordinary shapes will also make the code simpler.  

BTW: I assumed that RENDER keeps the trapezoids that cairo sends to it,
so that it can scale the picture upon request:

cairo_save(cr);
 cairo_set_target_surface(cr, parent);
 cairo_scale(cr, 10, 10);
 cairo_surface_show(cr, surface);
cairo_restore(cr);

It seems that RENDER only keeps the image of surface, but not the
trapezoids.  Is that a bug?


Jost




More information about the cairo mailing list