67 explicit color_t(
const SDL_Color&
c);
195 return r == c.
r && g == c.
g && b == c.
b && a == c.
a;
200 return !(*
this ==
c);
209 static_cast<uint8_t
>(r > 255 - c.
r ? 255 : r + c.
r),
210 static_cast<uint8_t>(g > 255 - c.
g ? 255 : g + c.
g),
211 static_cast<uint8_t
>(b > 255 - c.
b ? 255 : b + c.
b),
212 static_cast<uint8_t>(a > 255 - c.
a ? 255 : a + c.
a),
219 std::max<uint8_t>(
r, c.
r),
220 std::max<uint8_t>(g, c.
g),
221 std::max<uint8_t>(
b, c.
b),
222 std::max<uint8_t>(a, c.
a),
228 static_cast<uint8_t
>(255 -
r),
229 static_cast<uint8_t>(255 - g),
230 static_cast<uint8_t
>(255 -
b),
244 s << static_cast<int>(c.
r) <<
" " 245 << static_cast<int>(c.
g) <<
" " 246 <<
static_cast<int>(c.
b) <<
" " 247 << static_cast<int>(c.
a) << std::endl;
259 return c.to_rgba_bytes();
std::string to_rgba_string() const
Returns the stored color as an "R,G,B,A" string.
const uint32_t RGBA_ALPHA_MASK
const uint32_t RGBA_GREEN_BITSHIFT
const uint32_t SDL_BLUE_MASK
const uint32_t RGBA_BLUE_BITSHIFT
bool operator==(const color_t &c) const
const uint32_t SDL_ALPHA_MASK
const uint32_t SDL_GREEN_BITSHIFT
bool operator!=(const color_t &c) const
const uint32_t RGBA_RED_BITSHIFT
std::string to_rgb_string() const
Returns the stored color as an "R,G,B" string.
const uint32_t RGBA_RED_MASK
SDL_Color to_sdl() const
Returns the stored color as an color_t object.
const uint32_t SDL_BLUE_BITSHIFT
color_t blend_add(const color_t &c) const
color_t(uint8_t r_val, uint8_t g_val, uint8_t b_val, uint8_t a_val=ALPHA_OPAQUE)
std::ostream & operator<<(std::ostream &s, const color_t &c)
const uint32_t SDL_RED_MASK
static color_t null_color()
Definition of a 'null' color - fully transparent black.
const uint32_t RGBA_GREEN_MASK
static color_t from_hex_string(const std::string &c)
Creates a new color_t object from a string variable in hex format.
const uint32_t SDL_RED_BITSHIFT
static color_t from_argb_bytes(uint32_t c)
Creates a new color_t object from a uint32_t variable.
std::size_t operator()(const color_t &c) const noexcept
color_t blend_lighten(const color_t &c) const
static map_location::DIRECTION s
std::string to_hex_string() const
Returns the stored color in rrggbb hex format.
static color_t from_rgba_bytes(uint32_t c)
Creates a new color_t object from a uint32_t variable.
uint32_t to_rgba_bytes() const
Returns the stored color as a uint32_t, in RGBA format.
const uint8_t ALPHA_OPAQUE
uint32_t to_argb_bytes() const
Returns the stored color as a uint32_t, an ARGB format.
const uint32_t RGBA_ALPHA_BITSHIFT
const uint32_t SDL_ALPHA_BITSHIFT
const uint32_t SDL_GREEN_MASK
static color_t from_rgba_string(const std::string &c)
Creates a new color_t object from a string variable in "R,G,B,A" format.
static color_t from_rgb_string(const std::string &c)
Creates a new opaque color_t object from a string variable in "R,G,B" format.
const uint32_t RGBA_BLUE_MASK