Code archives/Graphics/The real Mask-color !

This code has been declared by its author to be Public Domain code.

Download source code

The real Mask-color ! by wedoe2002
There is much confusion among beginners how to
get the maskcolor right. When making GFX in a
drawing-program the color may be reported different
by the program than by Blitz due to bit-modes.
This program reads the maskcolor so you can't get it wrong.
; A program to find the maskcolor when in doubt

Graphics 640,480,16,2 ; Change 16 to your bitmode if you use 24 or 32
sprite=LoadImage("crate.png")
DrawImage sprite,0,0
rgb=ReadPixel(0,0); The coords on the sprite where the maskcolor is represented
b=rgb And $ff
g=rgb Shr 8 And $ff
r=rgb Shr 16 And $ff
Text 0,300,"The mask-color is: "+r+","+g+","+b
WaitKey()
End

Comments

None.

Code Archives Forum