30 #ifndef PT_GFX_COLOR_H
31 #define PT_GFX_COLOR_H
33 #include <Pt/Gfx/Api.h>
62 std::memcpy( &_value, base,
sizeof(
uint32_t) );
75 Color& operator=(
const Color& color) =
default;
92 _value = (_value & 0x00FFFFFF) | (
uint32_t(a) << 24);
97 return (_value & 0x00FF0000) >> 16;
102 _value = (_value & 0xFF00FFFF) | (
uint32_t(r) << 16);
107 return (_value & 0x0000FF00) >> 8;
112 _value = (_value & 0xFFFF00FF) | (
uint32_t(g) << 8);
117 return _value & 0x000000FF;
122 _value = (_value & 0xFFFFFF00) |
uint32_t(b);
130 bool operator==(
const Color& other)
const
131 {
return _value == other._value; }
133 bool operator!=(
const Color& other)
const
134 {
return _value != other._value; }
226 return ColorF(_a, s, s, s);
232 return ColorF(a * 257, r * 257, g * 257, b * 257);
243 inline Color::Color(
const ColorF& c)
244 : _value( (
Pt::
uint32_t(c.alpha() >> 8) << 24) |
252 inline Color& Color::operator=(
const ColorF& c)
262 inline ColorF::ColorF(
const Color& c)
263 : _a(c.alpha() * 257)
265 , _g(c.green() * 257)
270 inline ColorF& ColorF::operator=(
const Color& c)
272 _a = c.alpha() * 257;
274 _g = c.green() * 257;