Re: [racket-users] Detecting mouse events on top of picts?

2016-06-09 Thread George Neuner
On 6/8/2016 10:26 PM, David Christiansen wrote: What I mean is that I'm using draw-pict to cause the contents of a pict to be drawn on a dc<%> that I get from a bitmap%. The bitmap is initialized empty and transparent, and then the pict is drawn to it. I can tell which pixels are affected by

Re: [racket-users] Detecting mouse events on top of picts?

2016-06-08 Thread David Christiansen
> Looking at the docs for region%, Racket doesn't have a simple way to do > this - it still could be done by force and might not be that slow > depending on the complexity of the "scene" in the image. If you're > familiar with image processing, the basic idea is recursive "blob" >

Re: [racket-users] Detecting mouse events on top of picts?

2016-06-07 Thread George Neuner
On 6/7/2016 3:40 PM, David Christiansen wrote: > 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

Re: [racket-users] Detecting mouse events on top of picts?

2016-06-07 Thread Matthias Felleisen
Apologies, I was writing this response off line while I was reading your message and as i finished reading yours, I realized your problem was deeper. And apologies for wasting band width. > On Jun 7, 2016, at 3:39 PM, David Christiansen > wrote: > >> Why don’t

Re: [racket-users] Detecting mouse events on top of picts?

2016-06-07 Thread David Christiansen
> Why don’t you check the location of the mouse movement? The coordinates are > close enough. I do check the location of the mouse movement to find a canvas location. What I was looking for a smarter way to do was to check whether or not that particular pixel was drawn by a particular pict that

Re: [racket-users] Detecting mouse events on top of picts?

2016-06-06 Thread George Neuner
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

Re: [racket-users] Detecting mouse events on top of picts?

2016-06-06 Thread Matthias Felleisen
Why don’t you check the location of the mouse movement? The coordinates are close enough. > On Jun 6, 2016, at 4:45 PM, David Raymond Christiansen > wrote: > > Hi all, > > I'm looking for a way to check whether a mouse pointer is on top of a > particular pict

Re: [racket-users] Detecting mouse events on top of picts?

2016-06-06 Thread David Christiansen
> 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

Re: [racket-users] Detecting mouse events on top of picts?

2016-06-06 Thread David Christiansen
> If I understand the goal, you could render to one bitmap that has an > alpha channel, and then check whether the pixel under the mouse ends up > with a non-zero alpha. That's a good simplification. Thanks! I had kind of been hoping that there was an alternative approach that I was missing, but

Re: [racket-users] Detecting mouse events on top of picts?

2016-06-06 Thread George Neuner
On 6/6/2016 4:45 PM, David Raymond Christiansen wrote: I'm looking for a way to check whether a mouse pointer is on top of a particular pict that has been drawn to a canvas%. Right now, the best I've been able to do is to render the pict to two off-screen bitmaps with different background

Re: [racket-users] Detecting mouse events on top of picts?

2016-06-06 Thread Matthew Flatt
At Mon, 6 Jun 2016 16:45:33 -0400, David Raymond Christiansen wrote: > I'm looking for a way to check whether a mouse pointer is on top of a > particular pict that has been drawn to a canvas%. > > Right now, the best I've been able to do is to render the pict to two > off-screen bitmaps with

[racket-users] Detecting mouse events on top of picts?

2016-06-06 Thread David Raymond Christiansen
Hi all, I'm looking for a way to check whether a mouse pointer is on top of a particular pict that has been drawn to a canvas%. Right now, the best I've been able to do is to render the pict to two off-screen bitmaps with different background colors, and then check whether or not the pixel