reading the color under the pointer
BlitzPlus Forums/BlitzPlus Programming/reading the color under the pointer
| ||
Hi Guys :-) I wish to read the color under the pointer. Is there any way of doing this? Thanks in antici...pation ;-) |
| ||
You can use ReadPixel or ReadPixelfast for this. |
| ||
RTFMGetColor x, y Parameters: x = x coordinate of pixel y = y coordinate of pixel Description: This command works like a 'color picker' in your favorite paint program. By specifying Example: ; GetColor Example Graphics 320,200 SetBuffer BackBuffer() For t = 1 To 1000 Color Rnd(255), Rnd(255), Rnd(255) Rect Rnd(320),Rnd(200),10,10,1 Next GetColor 100,100 Print "Box at 100,100 is RGB:" + ColorRed() + "," + ColorGreen() + "," + ColorBlue() + "!" Flip While Not KeyHit(1) Wend |
| ||
GetColor is slow. I would use ReadPixel. |
| ||
You can also use native Windows API functions ;) |
| ||
Instead of GetColor 100, 100 in the above, why not GetColor MouseX(), MouseY() for the color under the mouse pointer. You could put this in a loop that changes the readout each time the mouse moves, until a mouse button is pressed, using While Not MouseDown() .. Wend. Or use ReadPixel as suggested. |