23 #ifndef BAGEL_BOFLIB_GFX_PALETTE_H 24 #define BAGEL_BOFLIB_GFX_PALETTE_H 26 #include "graphics/palette.h" 27 #include "bagel/afxwin.h" 28 #include "bagel/boflib/error.h" 29 #include "bagel/boflib/object.h" 30 #include "bagel/boflib/stdinc.h" 36 byte _data[Graphics::PALETTE_SIZE];
38 PaletteData(int16 numColors = Graphics::PALETTE_COUNT);
60 #define GetRed(rgb) ((byte)((rgb) & 0x000000FF)) 61 #define GetGreen(rgb) ((byte)(((rgb) >> 8) & 0x000000FF)) 62 #define GetBlue(rgb) ((byte)(((rgb) >> 16) & 0x000000FF)) 69 static char _szSharedPalFile[MAX_FNAME];
74 void ReleasePalette();
99 ErrorCode loadPalette(
const char *pszFileName, uint16 nFlags = PAL_DEFAULT);
101 ErrorCode createDefault(uint16 nFlags = PAL_DEFAULT);
103 byte getNearestIndex(COLORREF cColor);
105 COLORREF getColor(byte nIndex);
113 const PaletteData &getPalette()
const {
117 const byte *getData()
const {
118 return _palette._data;
121 void setData(
const byte* colors) {
122 memcpy(_palette._data, colors, Graphics::PALETTE_SIZE);
135 static void initialize();
141 static ErrorCode setSharedPalette(
const char *pszFileName);