[cairo] Can I provide a location to obtain a drawn object?

Donn donn.ingle at gmail.com
Sat Jul 5 00:46:36 PDT 2008

> If I have drawn something on a surface, is it possible to look up what has
> been drawn at a specific location?
Hi, Cairo is a "draw and forget" kind of thing. If you want to record where 
stuff is then you need to employ a list of some kind that keeps track of what 
was drawn; possibly by some form of OOP*. You can translate the cursor's x,y 
into the current transform of the cairo drawing surface but matching that to 
the things in your list is up to you.

* Basically, keep a list of each path that you draw. There is a function 
in_fill() that will tell you if a point is within that path but you have to 
draw each path first and then test for a hit. You don't need to stroke or 
fill the hit-test path so it stays invisible.


More information about the cairo mailing list