added GetRGB/GetBGR in Color.h/.cpp
This commit is contained in:
parent
c78733216f
commit
2e14c54ca4
@ -3,6 +3,7 @@
|
||||
|
||||
#include<hgl/TypeFunc.h>
|
||||
#include<hgl/color/Color4f.h>
|
||||
#include<hgl/math/Vector.h>
|
||||
namespace hgl
|
||||
{
|
||||
/**
|
||||
@ -261,6 +262,9 @@ namespace hgl
|
||||
ENUM_CLASS_RANGE(AliceBlue,YellowGreen)
|
||||
};//enum COLOR_ENUM
|
||||
|
||||
bool GetRGB(const enum class COLOR &ce,Vector3u8 &);
|
||||
bool GetBGR(const enum class COLOR &ce,Vector3u8 &);
|
||||
|
||||
const uint32 GetRGBA(const enum class COLOR &ce,const uint8 &alpha);
|
||||
const uint32 GetABGR(const enum class COLOR &ce,const uint8 &alpha);
|
||||
|
||||
|
@ -302,6 +302,32 @@ namespace hgl
|
||||
|
||||
#undef DEF_COLOR
|
||||
|
||||
bool GetRGB(const enum class COLOR &ce,Vector3u8 &color)
|
||||
{
|
||||
RANGE_CHECK_RETURN_FALSE(ce);
|
||||
|
||||
const COLOR_DEF &c=prv_color[size_t(ce)];
|
||||
|
||||
color.r=c.red;
|
||||
color.g=c.green;
|
||||
color.b=c.blue;
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool GetBGR(const enum class COLOR &ce,Vector3u8 &color)
|
||||
{
|
||||
RANGE_CHECK_RETURN_FALSE(ce);
|
||||
|
||||
const COLOR_DEF &c=prv_color[size_t(ce)];
|
||||
|
||||
color.b=c.red;
|
||||
color.g=c.green;
|
||||
color.r=c.blue;
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
const uint32 GetRGBA(const enum class COLOR &ce,const uint8 &alpha)
|
||||
{
|
||||
const COLOR_DEF &c=prv_color[size_t(ce)];
|
||||
|
Loading…
x
Reference in New Issue
Block a user