[cairo] more than obtaining the bound of a path.
cworth at cworth.org
Mon Oct 2 12:10:08 PDT 2006
On Mon, 2 Oct 2006 00:07:07 -0700, "satish kambala" wrote:
> I am new to cairo and recently learnt about 'cairo_stroke_extents' which
> gives the bounding box for the path after rendering. While this is fine, I
> would like to know if there is any way we can check if the path after
> rendering falls in a rectangular bound.
> For example, I have few lines with coords ranging from (0,0) - (100, 100)
> and for each path I would like to find out if it lies in (25, 25) - (50,50)
> after it is being rendered. Is there any API to get this directly??
There's nothing to do that directly, but it seems like it should be
simple enough for you to use the box returned by cairo_stroke_extents
and do the intersection testing you want with your box of
interest. Something like:
cairo_stroke_extents (cr, &x1, &y1, &x2, &y2);
if ((x1 >= 25.0 && x1 <= 50.0) &&
(x2 >= 25.0 && x2 <= 50.0) &&
(y1 >= 25.0 && y1 <= 50.0) &&
(y2 >= 25.0 && y2 <= 50.0) &&)
/* stroke lies entirely within (25, 25) - (50, 50) */
Thats for complete containment. I'm not sure if that's what you meant
by "lies in" or if you simply wanted non-zero intersection, but that
would also be pretty easy to do as well.
Easy enough? Or did I misunderstand what you wanted to do?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20061002/e55fcbbe/attachment.pgp
More information about the cairo