[bb] The real Mask-color ! by wedoe [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:43

Previous topic - Next topic

BlitzBot

Title : The real Mask-color !
Author : wedoe
Posted : 1+ years ago

Description : 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.


Code :
Code (blitzbasic) Select
; 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...