getAsRGBA problem

dreamak

26-07-2008 15:10:29

Hi there,

Ive used getAsRGBA to get rgb values, but every time i get only a long number, for example: for ColourValue(1,0,0,1) (pure red) i get "4278190335"
I dont know if Im making something wrong or it is a bug.


pic=ogre.Image()
pic.load("asdf.png", ogre.ResourceGroupManager.INTERNAL_RESOURCE_GROUP_NAME)
rgb=pic.getColourAt(0,1,0)
print rgb.getAsRGBA()

chpod

26-07-2008 16:15:38

This is the doc for getAsRGBA:
RGBA getAsRGBA (void) const
Retrieves colour as RGBA.

But RGBA is defined as:
typedef uint32 Ogre::RGBA

So RGBA is a 32 bits unsigned integer.

In your example, 4278190335 is nothing but #FF0000FF (hexadecimal). This gives:
#FF (255)=>red
#00 (0)=>green
#00 (0)=>blue
#FF (255)=>alpha

In your code, try this:
rgb=pic.getColourAt(0,1,0)
print rgb.r
print rgb.g
print rgb.b
print rgb.a


Hope this helps,
chpod