gbLib/include/gbColor.hpp

Go to the documentation of this file.
00001 
00012 #ifndef _GHULBUSGRAPHICS_COLOR_HPP_INCLUDE_GUARD_
00013 #define _GHULBUSGRAPHICS_COLOR_HPP_INCLUDE_GUARD_
00014 
00015 namespace GhulbusGraphics {
00022     typedef unsigned int GBCOLOR;
00025     typedef unsigned char GBCOLOR_COMPONENT;
00026 
00029     namespace GBCOLOR32 {
00030         inline GBCOLOR XRGB(GBCOLOR_COMPONENT r, GBCOLOR_COMPONENT g, GBCOLOR_COMPONENT b) {
00031             return ( 0xFF000000 | (r<<16) | (g<<8) | (b) );
00032         }
00033         inline GBCOLOR XRGB(int r, int g, int b) {
00034             return ( 0xFF000000 | ((r&0xff)<<16) | ((g&0xff)<<8) | (b&0xff) );
00035         }
00036         inline GBCOLOR ARGB(GBCOLOR_COMPONENT a, GBCOLOR_COMPONENT r, GBCOLOR_COMPONENT g, GBCOLOR_COMPONENT b) {
00037             return ( (a<<24) | (r<<16) | (g<<8) | (b) );
00038         }
00039         inline GBCOLOR ARGB(int a, int r, int g, int b) {
00040             return ( ((a&0xff)<<24) | ((r&0xff)<<16) | ((g&0xff)<<8) | (b&0xff) );
00041         }
00042         inline GBCOLOR_COMPONENT GetR(GBCOLOR c) {
00043             return static_cast<GBCOLOR_COMPONENT>( (c>>16) & 0xff );
00044         }
00045         inline GBCOLOR_COMPONENT GetG(GBCOLOR c) {
00046             return static_cast<GBCOLOR_COMPONENT>( (c>>8) & 0xff );
00047         }
00048         inline GBCOLOR_COMPONENT GetB(GBCOLOR c) {
00049             return static_cast<GBCOLOR_COMPONENT>( c & 0xff );
00050         }
00051         inline GBCOLOR_COMPONENT GetA(GBCOLOR c) {
00052             return static_cast<GBCOLOR_COMPONENT>( (c>>24) & 0xff );
00053         }   
00054     };
00055 };
00056 
00057 #endif

Generated on Sat Jan 19 18:58:21 2008 for PS2 IconSys Library by  doxygen 1.5.4