December 04, 2020, 11:04:51 AM

Author Topic: [bb] Color Functions by N [ 1+ years ago ]  (Read 601 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] Color Functions by N [ 1+ years ago ]
« on: June 29, 2017, 12:28:42 AM »
Title : Color Functions
Author : N
Posted : 1+ years ago

Description : The short description is enough.

Code :
Code: BlitzBasic
  1. Const RALPHA = 24       ;Return Alpha when using RColor
  2. Const RRED = 16 ;Return Red when using RColor
  3. Const RGREEN = 8        ;Return Green when using RColor
  4. Const RBLUE = 0 ;Return Blue when using RColor
  5.  
  6. ; IntColor returns an integer color useable by WritePixel() and WritePixelFast()
  7. ; R = Red
  8. ; G = Green
  9. ; B = Blue
  10. ; A = Alpha.
  11. ; return = An integer color useable by functions such as WritePixel() and WritePixelFast()
  12. Function IntColor(R,G,B,A=255)
  13.         Return A Shl 24 Or R Shl 16 Or G Shl 8 Or B Shl 0
  14. End Function
  15.  
  16. ; RColor returns the value of Red, Green, Blue, or Alpha in C.
  17. ; c = An integer color returned by, for example, ReadPixelFast()
  18. ; c = The amount of bits C should be shifted right to.  Valid constants are: RRED, RGREEN, RBLUE, RALPHA
  19. ; return = An integer ranging from 0 to 255.
  20. Function RColor%(c%,d%)
  21.         Return c Shr d And 255 Shl 0
  22. End Function


Comments :


Filax(Posted 1+ years ago)

 Very usefull thanks !


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal