Advertisement
Kyosaur

PAWN color RGBA<>INT macros

Mar 11th, 2011
463
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.60 KB | None | 0 0
  1. //Color macros by Kyoshiro
  2.  
  3. #define RGBAToInt(%0,%1,%2,%3) ((16777216 * (%0)) + (65536 * (%1)) + (256 * (%2)) + (%3))
  4.  
  5. #define IntToRGBA(%0,%1,%2,%3,%4) \
  6. (%1) = ((%0) >>> 24); (%2) = (((%0) >>> 16) & 0xFF); (%3) = (((%0) >>> 8) & 0xFF); (%4) = ((%0) & 0xFF)
  7.  
  8.  
  9. //You can use the RGBAToInt macro for defining colors (its far more clear than hex) and TONS more.
  10.  
  11. #define COLOR_WHITE     RGBAToInt(255,255,255,255)
  12. #define COLOR_RED   RGBAToInt(255,0,0,255)
  13. #define COLOR_GREEN     RGBAToInt(0,255,0,255)
  14. #define COLOR_BLUE      RGBAToInt(0,0,255,255)
  15. #define COLOR_YELLOW    RGBAToInt(255,255,0,255)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement