Initial
This commit is contained in:
83
bsptree/COLORKEY.HPP
Normal file
83
bsptree/COLORKEY.HPP
Normal file
@@ -0,0 +1,83 @@
|
||||
#ifndef _BSPTREE_COLORKEY_HPP_
|
||||
#define _BSPTREE_COLORKEY_HPP_
|
||||
#ifndef _COMMON_RGBCOLOR_HPP_
|
||||
#include <common/rgbcolor.hpp>
|
||||
#endif
|
||||
class ColorKey
|
||||
{
|
||||
public:
|
||||
enum AltKey{RedKey,GreenKey,BlueKey};
|
||||
ColorKey(void);
|
||||
ColorKey(const ColorKey &someColorKey);
|
||||
~ColorKey();
|
||||
AltKey colorKey(AltKey colorKey);
|
||||
AltKey colorKey(void)const;
|
||||
AltKey prevKey(void);
|
||||
AltKey nextKey(void);
|
||||
WORD isLess(const RGBColor &srcRGB,const RGBColor &dstRGB)const;
|
||||
WORD isLessEqual(const RGBColor &srcRGB,const RGBColor &dstRGB)const;
|
||||
private:
|
||||
AltKey mAltKey;
|
||||
};
|
||||
|
||||
inline
|
||||
ColorKey::ColorKey(void)
|
||||
: mAltKey(RedKey)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
ColorKey::ColorKey(const ColorKey &someColorKey)
|
||||
: mAltKey(someColorKey.mAltKey)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
ColorKey::~ColorKey()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
ColorKey::AltKey ColorKey::colorKey(AltKey colorKey)
|
||||
{
|
||||
return(mAltKey=colorKey);
|
||||
}
|
||||
|
||||
inline
|
||||
ColorKey::AltKey ColorKey::colorKey(void)const
|
||||
{
|
||||
return mAltKey;
|
||||
}
|
||||
|
||||
inline
|
||||
ColorKey::AltKey ColorKey::nextKey(void)
|
||||
{
|
||||
if(RedKey==mAltKey)return(mAltKey=GreenKey);
|
||||
else if(GreenKey==mAltKey)return(mAltKey=BlueKey);
|
||||
else return(mAltKey=RedKey);
|
||||
}
|
||||
|
||||
inline
|
||||
ColorKey::AltKey ColorKey::prevKey(void)
|
||||
{
|
||||
if(RedKey==mAltKey)return(mAltKey=BlueKey);
|
||||
else if(GreenKey==mAltKey)return(mAltKey=RedKey);
|
||||
else return(mAltKey=GreenKey);
|
||||
}
|
||||
|
||||
inline
|
||||
WORD ColorKey::isLess(const RGBColor &srcRGB,const RGBColor &dstRGB)const
|
||||
{
|
||||
if(RedKey==mAltKey)return srcRGB.red()<dstRGB.red();
|
||||
else if(GreenKey==mAltKey)return srcRGB.green()<dstRGB.green();
|
||||
else return srcRGB.blue()<dstRGB.blue();
|
||||
}
|
||||
|
||||
inline
|
||||
WORD ColorKey::isLessEqual(const RGBColor &srcRGB,const RGBColor &dstRGB)const
|
||||
{
|
||||
if(RedKey==mAltKey)return srcRGB.red()<=dstRGB.red();
|
||||
else if(GreenKey==mAltKey)return srcRGB.green()<=dstRGB.green();
|
||||
else return srcRGB.blue()<=dstRGB.blue();
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user