[Cairo] mouse pointer and cairo

Thomas Hunger info at teh-web.de
Sat Oct 11 16:14:36 PDT 2003


I am not member of the group of people with relevant user-interface design 
experience,  since I am pretty new to the entire matter.
When using a "ordinary" vector graphics editor it should not make a difference 
if anti-aliased pixels belong to the region or not since people just zoom in 
if mouse positioning is not exact enough.
If i got the idea right, geometrically correct testing could be done 
completely on the cairo level while testing for device pixels would need to 
be done on the libic(render) level, so it would be easier to test 
geometrically correct?
Since cairo_stroke starts a new path, cairo_in_stroke would either need to be 
called before cairo_stroke and perform a virtual "what would be if" stroke, 
or a programm would have to do all operations twice, one run for drawing, the 
other for intersection testing. In both cases the tesselation into traps 
would be done twice, is that bad for speed?
just collecting my thoughts,
Tom

On Saturday 11 October 2003 20:31, you wrote:
> On Oct 11, Thomas Hunger wrote:
>  > I wonder what would be the best way to calculate the intersection
>  > between my mouse pointer and a cairo-shape (line, rect).
>
> We'll want to add some functions to Cairo to support this. PostScript
> provides operators for this and we could start with correspondingly
> named functions:
>
> 	int
> 	cairo_in_stroke (cairo_t *cr, double x, double y);
>
> 	int
> 	cairo_in_fill (cairo_t *cr, double x, double y);
>
> We'll have to decide our own semantics for these operations.
> PostScript returns true if the pixel containing the given point would
> be painted by stroke or fill. But that may or may not be the
> definition we want when doing anti-aliased graphics. The other obvious
> choice would be to compute geometrically correct containment without
> reference to the device pixel grid.
>
> I'd be glad for some guidance from those with relevant user-interface
> design experience.
>
> The PostScript versions of these operators also allow the user to test
> for intersection with an arbitrary region instead of a point, (the
> region is specified as a userpath). This might be another reason to
> expose a cairo_path_t object.
>
> Comments?
>
> -Carl





More information about the cairo mailing list