GetColor fast

Blitz3D Forums/Blitz3D Beginners Area/GetColor fast

Josaih6/10(Posted 2010) [#1]
I am making program that needs to have the rgb values separate like GetColor gives you. But GetColor Is way to slow. Any ideas?


Matty(Posted 2010) [#2]
Use readpixelfast and convert the rgb values to red , green , and blue components as follows:


col=readpixelfast(x,y)

r=(col shr 16) and 255
g=(col shr 8) and 255
b=col and 255




Ross C(Posted 2010) [#3]
You will need to LockBuffer on what your reading though. And that takes time. So just for one pixel, your best off just using readpixel. In tests it's faster for one pixel, than locking the buffer, using readpixelfast, then unlocking the buffer.