
TraceFromPixel but for images?

BuntCake
I have a use case where multiple images are displayed in different part of the window. A function is created to work with these images when the user draw a marquee on one of them. Part of the function need to know which image the marquee is on (with the assumption that the marquee stays within one image).
There is TraceFromPixel to figure out which trace is under/near a coordinate. But there is no similar function for images that I am aware of. Is there an easy way to do this other than using marquee/mouse coordinates to calculate and match the coordinates of each image.
Hmm... I would also like to know a neat trick to do this. Are your images displayed on separate axes and not overlapping on the same axis (do you have an example file)? I think you could build a workaround by calling AxisValFromPixel() for each axis in the graph and then checking whether the output is within one of the axes' range via GetAxis. If you have found the axis pair which are both corresponding to the correct horizontal and vertical directions you can identify the image (this requires that each image is plotted against an unique set of axes and you already know which axes correspond to which image, of course).
June 18, 2025 at 06:49 pm - Permalink
Thanks for the idea. The images I have may share one of their axis. I think AxisValFromPixel can still work for my use case using the other axes only.
June 19, 2025 at 07:18 am - Permalink
Is each image inside its own subwindow? If you have a list of the names of the subwindows that contain the images, you can call GetMarquee on each one using the /W flag. The one with the marquee will return V_Flag == 1.
June 19, 2025 at 08:53 am - Permalink
- get list of images
- for each image
- get axes
- if marquee coordinates fall within range of both axes
- add image to list of hits
June 20, 2025 at 02:19 am - Permalink
In reply to Is each image inside its own… by Ben Murphy-Baum
They are not in separate subwindow. I was able to write the function using chozo's suggestion. But I like this idea as well and can use it in a different function where I am already using subwindow. Thanks
June 24, 2025 at 10:54 am - Permalink