Initial Commit
This commit is contained in:
161
common/PALENTRY.HPP
Normal file
161
common/PALENTRY.HPP
Normal file
@@ -0,0 +1,161 @@
|
||||
#ifndef _COMMON_PALETTEENTRY_HPP_
|
||||
#define _COMMON_PALETTEENTRY_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_RGBCOLOR_HPP_
|
||||
#include <common/rgbcolor.hpp>
|
||||
#endif
|
||||
|
||||
class PaletteEntry : private tagPALETTEENTRY
|
||||
{
|
||||
public:
|
||||
enum PaletteFlags{NoCollapse=PC_NOCOLLAPSE,Explicit=PC_EXPLICIT,Reserved=PC_RESERVED,NullFlag=0};
|
||||
PaletteEntry(void);
|
||||
PaletteEntry(const PaletteEntry &somePaletteEntry);
|
||||
PaletteEntry(const RGBColor &someRGBColor);
|
||||
~PaletteEntry(); // destructor must not be virtual
|
||||
PaletteEntry &operator=(const PaletteEntry &somePaletteEntry);
|
||||
PaletteEntry &operator=(const RGBColor &someRGBColor);
|
||||
WORD operator==(const PaletteEntry &somePaletteEntry)const;
|
||||
WORD operator==(const RGBColor &someRGBColor)const;
|
||||
BYTE red(void)const;
|
||||
BYTE green(void)const;
|
||||
BYTE blue(void)const;
|
||||
PaletteFlags flags(void)const;
|
||||
void red(BYTE peRed);
|
||||
void green(BYTE peGreen);
|
||||
void blue(BYTE peBlue);
|
||||
void flags(PaletteFlags peFlags);
|
||||
operator PALETTEENTRY&(void);
|
||||
operator RGBColor(void)const;
|
||||
private:
|
||||
};
|
||||
|
||||
inline
|
||||
PaletteEntry::PaletteEntry(void)
|
||||
{
|
||||
red(0);
|
||||
green(0);
|
||||
blue(0);
|
||||
flags(NullFlag);
|
||||
}
|
||||
|
||||
inline
|
||||
PaletteEntry::PaletteEntry(const PaletteEntry &somePaletteEntry)
|
||||
{
|
||||
red(somePaletteEntry.red());
|
||||
green(somePaletteEntry.green());
|
||||
blue(somePaletteEntry.blue());
|
||||
}
|
||||
|
||||
inline
|
||||
PaletteEntry::PaletteEntry(const RGBColor &someRGBColor)
|
||||
{
|
||||
red(someRGBColor.red());
|
||||
green(someRGBColor.green());
|
||||
blue(someRGBColor.blue());
|
||||
flags(NullFlag);
|
||||
}
|
||||
|
||||
inline
|
||||
PaletteEntry::~PaletteEntry()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
PaletteEntry &PaletteEntry::operator=(const PaletteEntry &somePaletteEntry)
|
||||
{
|
||||
red(somePaletteEntry.red());
|
||||
green(somePaletteEntry.green());
|
||||
blue(somePaletteEntry.blue());
|
||||
flags(somePaletteEntry.flags());
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
PaletteEntry &PaletteEntry::operator=(const RGBColor &someRGBColor)
|
||||
{
|
||||
red(someRGBColor.red());
|
||||
green(someRGBColor.green());
|
||||
blue(someRGBColor.blue());
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD PaletteEntry::operator==(const PaletteEntry &somePaletteEntry)const
|
||||
{
|
||||
return(red()==somePaletteEntry.red()&&
|
||||
green()==somePaletteEntry.green()&&
|
||||
blue()==somePaletteEntry.blue()&&
|
||||
flags()==somePaletteEntry.flags());
|
||||
}
|
||||
|
||||
inline
|
||||
WORD PaletteEntry::operator==(const RGBColor &someRGBColor)const
|
||||
{
|
||||
return(red()==someRGBColor.red()&&
|
||||
green()==someRGBColor.green()&&
|
||||
blue()==someRGBColor.blue());
|
||||
}
|
||||
|
||||
inline
|
||||
BYTE PaletteEntry::red(void)const
|
||||
{
|
||||
return tagPALETTEENTRY::peRed;
|
||||
}
|
||||
|
||||
inline
|
||||
BYTE PaletteEntry::green(void)const
|
||||
{
|
||||
return tagPALETTEENTRY::peGreen;
|
||||
}
|
||||
|
||||
inline
|
||||
BYTE PaletteEntry::blue(void)const
|
||||
{
|
||||
return tagPALETTEENTRY::peBlue;
|
||||
}
|
||||
|
||||
inline
|
||||
PaletteEntry::PaletteFlags PaletteEntry::flags(void)const
|
||||
{
|
||||
return (PaletteFlags)tagPALETTEENTRY::peFlags;
|
||||
}
|
||||
|
||||
inline
|
||||
void PaletteEntry::red(BYTE peRed)
|
||||
{
|
||||
tagPALETTEENTRY::peRed=peRed;
|
||||
}
|
||||
|
||||
inline
|
||||
void PaletteEntry::green(BYTE peGreen)
|
||||
{
|
||||
tagPALETTEENTRY::peGreen=peGreen;
|
||||
}
|
||||
|
||||
inline
|
||||
void PaletteEntry::blue(BYTE peBlue)
|
||||
{
|
||||
tagPALETTEENTRY::peBlue=peBlue;
|
||||
}
|
||||
|
||||
inline
|
||||
void PaletteEntry::flags(PaletteEntry::PaletteFlags peFlags)
|
||||
{
|
||||
tagPALETTEENTRY::peFlags=(BYTE)peFlags;
|
||||
}
|
||||
|
||||
inline
|
||||
PaletteEntry::operator PALETTEENTRY&(void)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
PaletteEntry::operator RGBColor(void)const
|
||||
{
|
||||
return RGBColor(red(),green(),blue());
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user