Detect colour of pixel (Release Announcements)

by Jim ⌂ @, Russell, KY, Friday, August 01, 2014, 20:07 (970 days ago) @ Ken Holmes


Curious. I believe the issue is the 32 bit color 0Xaarrggbb where aa=alpha, rr=red, gg=green, and bb=blue is getting converted to an unsigned int at one place in the code and a signed int in another. It will take a few days to cypher this one out.

As a solution you could convert the pixel value to HEX and string compare, the RGB function output, or you can compare to the color name and this should always work.

color green

print green
print tohex(green)
print rgb(0,255,0)

rect 0,0,100,100
print pixel(50,50)
if tohex(pixel(25,25)) = "ff00ff00" then print "green"
if pixel(25,25) = green then print "green"
if pixel(25,25) = rgb(0,255,0) then print "green"

Complete thread:

 RSS Feed of thread

powered by my little forum