[Cairo] mouse pointer and cairo

Owen Taylor otaylor at redhat.com
Sun Oct 12 20:28:33 PDT 2003


On Sat, 2003-10-11 at 17:39, Thomas Hunger wrote:
> Hi,
> I wonder what would be the best way to calculate the intersection between my 
> mouse pointer and a cairo-shape (line, rect).
> The only way I can think of is to tesselate into trapezoids by calling 
> cairo_stroke or cairo_fill, then take the list of trapezoids and look for 
> each if the pointer is inside and return true if it was inside any trapezoid.
> But then functions like _cairo_path_stroke_to_traps are hidden inside, so I 
> would need to hack the insides of cairo?
> Is cairo thought to be for things like this, too, or is it a pure rendering 
> interface?

Can you explain you explain a bit more about what you are trying to do
here? By "mouse pointer", do you mean the single current point, or the
visual representation on screen (a Cursor in X terms)?

Determining whether a point is inside a path seems likely a reasonable
analytic operation for Cairo to have; if you wanted to intersect a 
cursor image with the path, you'd presumably do that in pixel terms
using the standard cairo operators. 

Regards,
							Owen






More information about the cairo mailing list