[cairo] in_fill hit test and matrix transforms

Behdad Esfahbod behdad at behdad.org
Wed Nov 21 20:33:35 PST 2007

On Wed, 2007-11-21 at 11:46 -0500, Donn wrote:
>     def button_press(self,widget,event):
>         cr = self.cr
>         #Exact same matrix, no effect
>         self.matrixstart ( cr )    
>         self.cairocommands ( cr )
>         result = cr.in_fill( event.x, event.y )
>         print result
>         self.matrixend ( cr )

Just move the matrixend call before the in_fill call.  Note that in_fill
transforms your event x,y according to the current transform matrix
(ctm) too.  So, you need to get to an identity ctm before doing it for
your use case.

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759

More information about the cairo mailing list