23 #ifndef BAGEL_BOFLIB_GFX_PALETTE_H 24 #define BAGEL_BOFLIB_GFX_PALETTE_H 26 #include "graphics/screen.h" 27 #include "bagel/boflib/error.h" 28 #include "bagel/boflib/object.h" 29 #include "bagel/boflib/stdinc.h" 33 #define PAL_DEFAULT 0x0000 34 #define PAL_ANIMATED 0x0001 35 #define PAL_EXPLICIT 0x0002 37 typedef uint32 RGBCOLOR;
39 byte _data[PALETTE_SIZE];
41 HPALETTE(int16 numColors = PALETTE_COUNT);
56 #define RGB(r, g, b) ((RGBCOLOR)(((byte)(r) | ((uint16)((byte)(g)) << 8)) | (((uint32)(byte)(b)) << 16))) 65 #define GetRed(rgb) ((byte)((rgb) & 0x000000FF)) 66 #define GetGreen(rgb) ((byte)(((rgb) >> 8) & 0x000000FF)) 67 #define GetBlue(rgb) ((byte)(((rgb) >> 16) & 0x000000FF)) 74 static char _szSharedPalFile[MAX_FNAME];
79 void ReleasePalette();
104 ErrorCode loadPalette(
const char *pszFileName, uint16 nFlags = PAL_DEFAULT);
106 ErrorCode createDefault(uint16 nFlags = PAL_DEFAULT);
108 byte getNearestIndex(RGBCOLOR cColor);
110 RGBCOLOR getColor(byte nIndex);
116 void setPalette(
const HPALETTE &hPalette);
118 const HPALETTE &getPalette()
const {
122 const byte *getData()
const {
123 return _palette._data;
126 void setData(
const byte* colors) {
127 memcpy(_palette._data, colors, PALETTE_SIZE);
140 static void initialize();
146 static ErrorCode setSharedPalette(
const char *pszFileName);