Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem reaing sprites Height and Width
#11
Oki, thx lillo.

But lets say i would like to store or compare color values from to diffrent sprites.

I can do:

IF Sprite(2) = Sprite2(2)......

Then i have to break the rgb values out line neo said? But then again he said that the code he gave me only would hold in 32 bit mode.

And one thing more..How do you store a hex value?. Cause a sone as you put it in a integer variable i can't get them back to hex.
ttp://hem.passagen.se/qb.basta
Reply
#12
Same as in QB:
Code:
HEX$ - a string function that returns a string that represents the
       hexadecimal value of the decimal argument expression

Syntax
  HEX$(expression)
    â–  expression is a numeric expression that has a decimal value
Reply
#13
To read a color from a buffer you can use:
Code:
dim a as uinteger
a=POINT x,y, buffer
This will return a RGB value in the format of the present color depth. You have to break it in the color components:
Code:
'for24 and  32 bits depths:
blue=a and &hff
green=(a and &hff00) shr 8
red=(a and &hff0000) shr 16

'for 15 and 16 bits depths:
blue =a and &h1F
green=(a and &h7E0) shr 5
red=(a and &F800) shr 11
for 8 and less bits depths POINT returns a palette index
Antoni
Reply
#14
Little correction: POINT always returns color values in &hRRGGBB format (8 bit red, 8 bit green and 8 bit blue) if in color depths > 8bpp, thus also if in 15/16bpp.
ngelo Mottola - EC++
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)