95 lines
2.1 KiB
C++
95 lines
2.1 KiB
C++
#ifndef _DDRAW_DIRECTPALETTE_HPP_
|
|
#define _DDRAW_DIRECTPALETTE_HPP_
|
|
#ifndef _COMMON_PALETTEENTRY_HPP_
|
|
#include <common/palentry.hpp>
|
|
#endif
|
|
#ifndef _COMMON_SMARTPOINTER_HPP_
|
|
#include <common/pointer.hpp>
|
|
#endif
|
|
#ifndef _DDRAW_DDRAW_HPP_
|
|
#include <ddraw/ddraw.hpp>
|
|
#endif
|
|
|
|
class String;
|
|
|
|
class DirectPalette : private SmartPointer<IDirectDrawPalette>
|
|
{
|
|
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<IDirectDrawPalette>::destroy();
|
|
}
|
|
#endif
|
|
|
|
|