#ifndef _DDRAW_DIRECTPALETTE_HPP_ #define _DDRAW_DIRECTPALETTE_HPP_ #ifndef _COMMON_PALETTEENTRY_HPP_ #include #endif #ifndef _COMMON_SMARTPOINTER_HPP_ #include #endif #ifndef _DDRAW_DDRAW_HPP_ #include #endif class String; class DirectPalette : private SmartPointer { public: friend class DirectDraw; friend class Surface; enum CreationFlags{PalIndex1Bit=DDPCAPS_1BIT,PalIndex2Bit=DDPCAPS_2BIT,PalIndex4Bit=DDPCAPS_4BIT, PalIndex8Bit=DDPCAPS_8BIT,PalIndex8BitEntries=DDPCAPS_8BITENTRIES,PalAlpha=DDPCAPS_ALPHA, PalAllow256Entries=DDPCAPS_ALLOW256,PalInitialize=DDPCAPS_INITIALIZE,PalPrimarySurface=DDPCAPS_PRIMARYSURFACE, PalPrimarySurfaceLeft=DDPCAPS_PRIMARYSURFACELEFT,PalVSync=DDPCAPS_VSYNC}; DirectPalette(void); virtual ~DirectPalette(); DWORD flags(void); void flags(DWORD flags); PaletteEntry &operator[](int palIndex); BOOL readPalette(const String &strPathFileName); WORD systemPalette(void); void destroy(void); private: enum {MaxColors=256}; DirectPalette(const DirectPalette &someDirectPalette); DirectPalette &operator=(const DirectPalette &someDirectPalette); void initPalette(void); PaletteEntry mPaletteEntries[MaxColors]; DWORD mPaletteFlags; }; inline DirectPalette::DirectPalette(void) : mPaletteFlags(PalIndex8Bit|PalAllow256Entries) { initPalette(); } inline DirectPalette::DirectPalette(const DirectPalette &someDirectPalette) { // private implementation *this=someDirectPalette; } inline DirectPalette::~DirectPalette(void) { destroy(); } inline DirectPalette &DirectPalette::operator=(const DirectPalette &/*someDirectPalette*/) { // private implementation return *this; } inline PaletteEntry &DirectPalette::operator[](int palIndex) { return mPaletteEntries[palIndex]; } inline DWORD DirectPalette::flags(void) { return mPaletteFlags; } inline void DirectPalette::flags(DWORD flags) { mPaletteFlags=flags; } inline void DirectPalette::destroy(void) { if(!isOkay())return; operator->()->Release(); SmartPointer::destroy(); } #endif