mirror of
https://github.com/edubart/otclient.git
synced 2025-10-19 05:53:26 +02:00
more flexible skins
This commit is contained in:
@@ -33,22 +33,22 @@ class Color
|
||||
{
|
||||
public:
|
||||
inline Color() : color(0) { }
|
||||
inline Color(uint8 r, uint8 g, uint8 b, uint8 a = 0xFF) : color(((r & 0xff)<<24) | ((g & 0xff)<<16) | ((b & 0xff)<<8) | (a & 0xff)) { }
|
||||
inline Color(uint8 r, uint8 g, uint8 b, uint8 a = 0xFF) : color(((a & 0xff)<<24) | ((b & 0xff)<<16) | ((g & 0xff)<<8) | (r & 0xff)) { }
|
||||
inline Color(const Color& other) : color(other.color) { }
|
||||
inline Color(RGBA rgba) : color(rgba) { }
|
||||
|
||||
inline uint8 r() const { return (color >> 24) & 0xFF; }
|
||||
inline uint8 g() const { return (color >> 16) & 0xFF; }
|
||||
inline uint8 b() const { return (color >> 8) & 0xFF; }
|
||||
inline uint8 a() const { return color & 0xFF; }
|
||||
inline uint8 a() const { return (color >> 24) & 0xFF; }
|
||||
inline uint8 b() const { return (color >> 16) & 0xFF; }
|
||||
inline uint8 g() const { return (color >> 8) & 0xFF; }
|
||||
inline uint8 r() const { return color & 0xFF; }
|
||||
inline RGBA rgba() const { return color; }
|
||||
inline const uint8* rgbaPtr() const { return (const uint8*)&color; }
|
||||
|
||||
inline void setRed(uint8 r) { color = ((r & 0xff)<<24) | (color & 0x00ffffff); }
|
||||
inline void setGreen(uint8 g) { color = ((g & 0xff)<<16) | (color & 0xff00ffff); }
|
||||
inline void setBlue(uint8 b) { color = ((b & 0xff)<<8) | (color & 0xffff00ff); }
|
||||
inline void setAlpha(uint8 a) { color = (a & 0xff) | (color & 0xffffff00); }
|
||||
inline void setRGBA(uint8 r, uint8 g, uint8 b, uint8 a = 0xFF) { color = ((r & 0xff)<<24) | ((g & 0xff)<<16) | ((b & 0xff)<<8) | (a & 0xff); }
|
||||
inline void setAlpha(uint8 a) { color = ((a & 0xff)<<24) | (color & 0x00ffffff); }
|
||||
inline void setBlue(uint8 b) { color = ((b & 0xff)<<16) | (color & 0xff00ffff); }
|
||||
inline void setGreen(uint8 g) { color = ((g & 0xff)<<8) | (color & 0xffff00ff); }
|
||||
inline void setRed(uint8 r) { color = (r & 0xff) | (color & 0xffffff00); }
|
||||
inline void setRGBA(uint8 r, uint8 g, uint8 b, uint8 a = 0xFF) { color = ((a & 0xff)<<24) | ((b & 0xff)<<16) | ((g & 0xff)<<8) | (r & 0xff); }
|
||||
inline void setRGBA(uint32 rgba) { color = rgba; }
|
||||
|
||||
inline Color& operator=(const Color& other) { color = other.color; return *this; }
|
||||
|
Reference in New Issue
Block a user