<div dir="ltr">The tricks of cairo. The save/restore worked fine. Thanks for the help.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Feb 6, 2016 at 12:10 AM, Uli Schlachter <span dir="ltr"><<a href="mailto:psychon@znc.in" target="_blank">psychon@znc.in</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Am 06.02.2016 um 06:15 schrieb Mark Olesen:<br>
> Is cairo_in_fill supposed to work with rotation?<br>
> The following code gets hits on the un-rotated rectangle.<br>
> It's like the rotation is ignored. Thanks in advance.<br>
><br>
</span>[...]<br>
<span class="">>     cairo_new_path(cr);<br>
>     cairo_rotate(cr, 45.0); // ROTATION SEEMS TO BE IGNORED<br>
>     cairo_rectangle(cr, 0.0, 0.0, 100.0, 100.0);<br>
><br>
>     // only gets hits on un-rotated rectangle<br>
>     l_hit = cairo_in_fill(cr, (*event).x, (*event).y);<br>
>     printf("rect hit=%d %lf %lf\n", l_hit, (*event).x, (*event).y);<br>
><br>
>     cairo_destroy(cr);<br>
><br>
>     return 1;<br>
> }<br>
</span>[...]<br>
<br>
cairo_in_fill() gets a point in user coordinates. That means that the point is<br>
rotated, too, before the hit test. Either undo the rotation with<br>
cairo_rectangle(cr, -45.0) (what a weird angle....) or via:<br>
<br>
cairo_save(cr);<br>
cairo_rotate(cr, 45);<br>
cairo_rectangle(cr, 0, 0, 100, 100);<br>
cairo_restore(cr);<br>
<br>
l_hit = cairo_in_fill(cr, x, y);<br>
<br>
Cheers,<br>
Uli<br>
<span class="HOEnZb"><font color="#888888">--<br>
- Captain, I think I should tell you I've never<br>
  actually landed a starship before.<br>
- That's all right, Lieutenant, neither have I.<br>
</font></span></blockquote></div><br></div>