December 03, 2020, 07:59:30 PM

Author Topic: [bb] The real Mask-color ! by wedoe [ 1+ years ago ]  (Read 873 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] The real Mask-color ! by wedoe [ 1+ years ago ]
« on: June 29, 2017, 12:28:43 AM »
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
  1. ; A program to find the maskcolor when in doubt
  2.  
  3. Graphics 640,480,16,2 ; Change 16 to your bitmode if you use 24 or 32
  4. sprite=LoadImage("crate.png")
  5. DrawImage sprite,0,0
  6. rgb=ReadPixel(0,0); The coords on the sprite where the maskcolor is represented
  7. b=rgb And $ff
  8. g=rgb Shr 8 And $ff
  9. r=rgb Shr 16 And $ff
  10. Text 0,300,"The mask-color is: "+r+","+g+","+b
  11. WaitKey()
  12. End


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal