On 6/6/2016 8:36 PM, David Christiansen wrote:
> That seems overly complicated. Can you not just compare the mouse's
> coordinates to the picture's location in the canvas?
I don't have a good way to know where the picture itself is - only its
bounding box. So if the picture consists of a doughnut shape, I want
the center of the doughnut and the region around its edge to not count
as clicks on it.
Understood. Is it possible to define a region to represent the
clickable areas? This is the way I would do it if possible.
I haven't done much GUI programming in Racket, so I don't know exactly
what it can do, but in, e.g., Windows GDI you can create a region
directly from a binary (1-bit depth) bitmap [and a bitmap of any depth
can be converted to a binary bitmap]. Set (1) pixels in the bitmap will
be included in the region and unset (0) pixels will be excluded.
A region can directly answer whether a point (mouse coordinate) is
inside it or not.
George
--
You received this message because you are subscribed to the Google Groups "Racket
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.