GetColor() and RGB

BlitzMax Forums/BlitzMax Programming/GetColor() and RGB

ErikT(Posted 2010) [#1]
Hello everybody! I'm writing a scaling function based on the Scale2X and RotSprite algorithms:

http://en.wikipedia.org/wiki/Pixel_art_scaling_algorithms

I've got the scale2X bit running so far but I want to improve the blending by having it check for pixels similar to eachother and not just equal ones. To do that I really need to get to the separate RGB values somehow. GetColor just plops all that info into a single variable so is there any other way to do this?


xlsior(Posted 2010) [#2]
You'll have to seperate the red, green and blue values based on the GetColor result:
Local Red:int = (Color Shr 16) & $FF
Local Green:int = (Color Shr 8) & $FF
Local Blue:Int = Color & $FF


GfK(Posted 2010) [#3]
GetColor returns separate RGB values for the current color.

Are you sure you didn't mean ReadPixel?

Assuming you did, this [untested] should work:
Color:Int = ReadPixel(x,y)

Red:Int = (Color & $FF0000) Shr 16
Green:Int = (Color & $FF00) Shr 8
Blue:Int = (color & $FF)



ErikT(Posted 2010) [#4]
That's what I meant. Thanks :o)


ErikT(Posted 2010) [#5]
Here's the code so far if anyone wants to play around with it.


Last edited 2010