#include <SDL2/SDL_pixels.h>
#include <algorithm>
#include <cstdint>
#include <ostream>
#include <string>
#include <utility>
Go to the source code of this file.
Classes | |
struct | color_t |
The basic class for representing 8-bit RGB or RGBA colour values. More... | |
struct | std::hash< color_t > |
Functions | |
constexpr uint8_t | float_to_color (double n) |
Convert a double in the range [0.0,1.0] to an 8-bit colour value. More... | |
constexpr uint8_t | float_to_color (float n) |
Convert a float in the range [0.0,1.0] to an 8-bit colour value. More... | |
constexpr uint8_t | color_multiply (uint8_t n1, uint8_t n2) |
Multiply two 8-bit colour values as if in the range [0.0,1.0]. More... | |
constexpr uint8_t | color_blend (uint8_t n1, uint8_t n2, uint8_t p) |
Blend 8-bit colour value with another in the given proportion. More... | |
std::ostream & | operator<< (std::ostream &s, const color_t &c) |
Variables | |
constexpr uint32_t | SDL_ALPHA_MASK = 0xFF000000 |
constexpr uint32_t | SDL_RED_MASK = 0x00FF0000 |
constexpr uint32_t | SDL_GREEN_MASK = 0x0000FF00 |
constexpr uint32_t | SDL_BLUE_MASK = 0x000000FF |
constexpr uint32_t | SDL_ALPHA_BITSHIFT = 24 |
constexpr uint32_t | SDL_RED_BITSHIFT = 16 |
constexpr uint32_t | SDL_GREEN_BITSHIFT = 8 |
constexpr uint32_t | SDL_BLUE_BITSHIFT = 0 |
constexpr uint32_t | RGBA_ALPHA_MASK = 0x000000FF |
constexpr uint32_t | RGBA_RED_MASK = 0xFF000000 |
constexpr uint32_t | RGBA_GREEN_MASK = 0x00FF0000 |
constexpr uint32_t | RGBA_BLUE_MASK = 0x0000FF00 |
constexpr uint32_t | RGBA_ALPHA_BITSHIFT = 0 |
constexpr uint32_t | RGBA_RED_BITSHIFT = 24 |
constexpr uint32_t | RGBA_GREEN_BITSHIFT = 16 |
constexpr uint32_t | RGBA_BLUE_BITSHIFT = 8 |
constexpr uint8_t | ALPHA_OPAQUE = SDL_ALPHA_OPAQUE |
|
constexpr |
Blend 8-bit colour value with another in the given proportion.
A proportion of 0 returns the first value, 255 the second.
Definition at line 306 of file color.hpp.
References color_multiply(), and p.
Referenced by color_t::smooth_blend().
|
constexpr |
Multiply two 8-bit colour values as if in the range [0.0,1.0].
Definition at line 296 of file color.hpp.
Referenced by color_blend(), and image::o_modification::operator()().
|
constexpr |
Convert a double in the range [0.0,1.0] to an 8-bit colour value.
Definition at line 280 of file color.hpp.
References n.
Referenced by display::fade_to(), display::fade_tod_mask(), image::o_modification::operator()(), unit_frame::redraw(), unit_drawer::redraw_unit(), and display::update_fps_label().
|
constexpr |
|
inline |
|
constexpr |
Definition at line 45 of file color.hpp.
Referenced by gui2::typed_formula< T >::execute(), color_t::from_hex_string(), color_t::from_rgb_string(), color_t::from_rgba_string(), game_lua_kernel::intf_set_floating_label(), gui2::dialogs::story_viewer::nav_button_callback(), color_t::to_hex_string(), and gui2::dialogs::story_viewer::update().
|
constexpr |
Definition at line 40 of file color.hpp.
Referenced by color_t::from_rgba_bytes(), and color_t::to_rgba_bytes().
|
constexpr |
Definition at line 35 of file color.hpp.
Referenced by color_t::from_rgba_bytes().
|
constexpr |
Definition at line 43 of file color.hpp.
Referenced by color_t::from_rgba_bytes(), and color_t::to_rgba_bytes().
|
constexpr |
Definition at line 38 of file color.hpp.
Referenced by color_t::from_rgba_bytes().
|
constexpr |
Definition at line 42 of file color.hpp.
Referenced by color_t::from_rgba_bytes(), and color_t::to_rgba_bytes().
|
constexpr |
Definition at line 37 of file color.hpp.
Referenced by color_t::from_rgba_bytes().
|
constexpr |
Definition at line 41 of file color.hpp.
Referenced by color_t::from_rgba_bytes(), and color_t::to_rgba_bytes().
|
constexpr |
Definition at line 36 of file color.hpp.
Referenced by color_t::from_rgba_bytes().
|
constexpr |
Definition at line 30 of file color.hpp.
Referenced by color_t::from_argb_bytes(), and color_t::to_argb_bytes().
|
constexpr |
Definition at line 25 of file color.hpp.
Referenced by color_t::from_argb_bytes(), and surface::is_neutral().
|
constexpr |
Definition at line 33 of file color.hpp.
Referenced by color_t::from_argb_bytes(), and color_t::to_argb_bytes().
|
constexpr |
Definition at line 28 of file color.hpp.
Referenced by color_t::from_argb_bytes().
|
constexpr |
Definition at line 32 of file color.hpp.
Referenced by color_t::from_argb_bytes(), and color_t::to_argb_bytes().
|
constexpr |
Definition at line 27 of file color.hpp.
Referenced by color_t::from_argb_bytes().
|
constexpr |
Definition at line 31 of file color.hpp.
Referenced by color_t::from_argb_bytes(), and color_t::to_argb_bytes().
|
constexpr |
Definition at line 26 of file color.hpp.
Referenced by color_t::from_argb_bytes(), and surface::is_neutral().