[cairo] Mouse click collision with cairo curve

Kalle Vahlman kalle.vahlman at gmail.com
Mon Aug 27 23:40:53 PDT 2007

2007/8/28, Deepankar Sharma <deepankar.sharma at gmail.com>:
> I am just beginning to play with cairo and am currently battling with this
> problem. I have a few cairo curves (drawn with cairo_curve_to) on the
> screen. I am storing the begin, end, thickness and control points for the
> curves. When I detect a click, I want to check if I just clicked over a
> curve. In essence, I want to check if an x,y co-ordinate lies on a curve.
> Any ideas / hints / approaches ?

Maybe you could keep the resulting paths around and use cairo_in_stroke()?


Not sure how efficient it is though, nor if you really want that level
of precision (usually within user interfaces you'll want to allow the
user to miss a little to prevent frustration of pixel-perfect clicking
if the targets are small).

Kalle Vahlman, zuh at iki.fi
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi

More information about the cairo mailing list