Get color of pixel under mouse cursor

BlitzMax Forums/BlitzMax Beginners Area/Get color of pixel under mouse cursor

Medicine Storm(Posted 2009) [#1]
I would like to be able to get the RGB value of the pixel under the mouse cursor, but I can't seem to find a command that will help me do this.

What I had in mind is similar to the 'eyedropper' tool in most paint and photo editing programs, allowing the user to copy the color clicked on.

Is there a reciprocal to the 'Plot' command?

Thanks,

-Medicine Storm


Perturbatio(Posted 2009) [#2]
Grab the screen to a pixmap then use readpixel?


tonyg(Posted 2009) [#3]
Think you need to grabpixmap and then readpixel.
<edit> Argh


plash(Posted 2009) [#4]



Medicine Storm(Posted 2009) [#5]
@Plash:

Fast, easy and exactly what I was looking for.

Thank you!

-Medicine Storm


plash(Posted 2009) [#6]
Color box..



ImaginaryHuman(Posted 2009) [#7]
Note that reading the backbuffer into a pixmap is NOT a fast process, relatively speaking. Data has to be transferred over the graphics bus. Even reading a small area as a pixmap can affect your framerate, so it's not something that you want to do lots of times. If you need to read many pixels, read a rectangular area and then pick out the pixels you want.