Finding Colour at Point on Screen

BlitzMax Forums/BlitzMax Beginners Area/Finding Colour at Point on Screen

Rico(Posted 2010) [#1]
I used to like the old color=Point(x,y) command they had in some old basics. Someone gave me a routine for doing this in Blitz ages ago, but I can't find it, can anyone help? I need it to find the colour at a point on a bitmap. So i can make tile data for irregular map tiles (like slopes etc).

Thank you very much


grable(Posted 2010) [#2]
if its a bitmap you could use ReadPixel() on a TPixmap, if its the screen only way i see without breaking out platform specific code is GrabPixmap().


GfK(Posted 2010) [#3]
GrabPixmap is the way to go. But you don't need to grab the whole screen (unless you want to use ReadPixel a lot per cycle). Just grab a 1x1 pixmap which is basically the pixel you want to test.


ImaginaryHuman(Posted 2010) [#4]
If you use OpenGL you can use a single call to glReadPixels() to read a single pixel into an integer variable.


Rico(Posted 2010) [#5]
thank you very much , has anyone got a function to do it? i am a bit rusty