Detect colour of pixel (Release Announcements)

by Ken Holmes @, Melbourne, Australia, Friday, August 01, 2014, 07:32 (2029 days ago)

Has there been any recent development in this area. QuickBasic had a command - point(x, y) - which gave the QB color number of the pixel at x,y, eg. 2 for green.

I'm writing a predator/prey simulation where the prey are pixels of some color different to the predators or the background. If you issue " print pixel(x, y) " in a test rectangle , it prints, say, 4278255360 for green, but if you try code such as "if pixel(x, y) = 4278255360 then (do something)", it doesn't work.

I've tried using white pixels and "if pixel(x, y) > 4294967200", also using clear pixels and "if pixel(x, y) = 0 ( or < 1 ) - still no banana!

Incidentally, the correct value for white is 4294967295, not the value shown in Basic256 (Language Documentation).

Complete thread:

 RSS Feed of thread

powered by my little forum