Re: cairo_in_fill w/rotate?
Mark Olesen <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <CAExh6bYAwGDXO2UodWxqy1GvsqMv9HD+7q1wHxcWwFJnvAf7ng@mail.gmail.com> |
The tricks of cairo. The save/restore worked fine. Thanks for the help. On Sat, Feb 6, 2016 at 12:10 AM, Uli Schlachter <[email protected]> wrote: > Am 06.02.2016 um 06:15 schrieb Mark Olesen: > > Is cairo_in_fill supposed to work with rotation? > > The following code gets hits on the un-rotated rectangle. > > It's like the rotation is ignored. Thanks in advance. > > > [...] > > cairo_new_path(cr); > > cairo_rotate(cr, 45.0); // ROTATION SEEMS TO BE IGNORED > > cairo_rectangle(cr, 0.0, 0.0, 100.0, 100.0); > > > > // only gets hits on un-rotated rectangle > > l_hit = cairo_in_fill(cr, (*event).x, (*event).y); > > printf("rect hit=%d %lf %lf\n", l_hit, (*event).x, (*event).y); > > > > cairo_destroy(cr); > > > > return 1; > > } > [...] > > cairo_in_fill() gets a point in user coordinates. That means that the > point is > rotated, too, before the hit test. Either undo the rotation with > cairo_rectangle(cr, -45.0) (what a weird angle....) or via: > > cairo_save(cr); > cairo_rotate(cr, 45); > cairo_rectangle(cr, 0, 0, 100, 100); > cairo_restore(cr); > > l_hit = cairo_in_fill(cr, x, y); > > Cheers, > Uli > -- > - Captain, I think I should tell you I've never > actually landed a starship before. > - That's all right, Lieutenant, neither have I. > -- cairo mailing list [email protected] https://lists.cairographics.org/mailman/listinfo/cairo