[cairo] Hit detection
Carl Worth
cworth at cworth.org
Mon Nov 27 21:01:39 PST 2006
On Mon, 27 Nov 2006 13:14:35 +1300, Piotr Zurek wrote:
> That's all good for rectangular (or almost rectangular) objects but what
> about things like bezier curves. Of course, I could calculate that as
> well but I hope there exists an easier way.
For what it's worth, the polygon formed by the control points forms a
nice, easy-to-work-with bounds for the spline, (it's guaranteed to be
contained within the convex hull of the points).
> I guess I should simply ask what's the best way to utilize in_fill and
> in_stroke but maybe someone has different suggestion?
I'd suggest using them as a last resort. Test against bounding
rectangles first, then against more precise bounding polygons, then
use cairo_in_fill and cairo_in_stroke if necessary.
Or something like that anyway, (I haven't really done much application
code with cairo yet, but I would guess this is how I would likely
approach the problem).
-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20061127/d71011a7/attachment.pgp
More information about the cairo
mailing list