Get RGB values in Sprite Candy

Blitz3D Forums/Blitz3D Programming/Get RGB values in Sprite Candy

mkg(Posted 2008) [#1]
Can someone please give me some ideas on this?

Is it possible to read the colour (RGB values) of a HUD component?

Is it possible with a Blitz entity?


boomboom(Posted 2008) [#2]
http://www.blitzbasic.com/b3ddocs/command.php?name=GetColor


Ross C(Posted 2008) [#3]
You might want to avoid using ReadPixelFast, if it's just for one pixel, incase you come across it. Locking the buffer, reading and spliting the ARGB value is slower than what boomboom suggests.


mkg(Posted 2008) [#4]
Thanks - that may do what I need. I have to admit that I do still get a little confused about using some 2d functions in 3d games.

I thought that it might be possible to read the colour of an entity rather than just pixel at x,y on the screen. So what if you want to know the current rgb of an entity that may be totally or partially masked by another entity?


tonyg(Posted 2008) [#5]
... but can't the entity, texture, image, whatever be multiple colour? This would mean the 'entity' does not have a single RGB. Unless you mean Alpha of course which is different. If you ARE using a single colour texture then you might want to create a Type called Coloured_entity which includes the handlefromobject for the entity plus RGB field. When you want to check the entities colour you loop through the types finding the matching handlefromobject and then read the colour details. Depending on how many you have will depend on how quick it is.


Ross C(Posted 2008) [#6]
Simple read the pixel value on the frontbuffer, AFTER the flip command.