42#ifndef INCLUDE_GUARD_EUNOMIA_COLOUR_H
43#define INCLUDE_GUARD_EUNOMIA_COLOUR_H
70 RgbColour(std::uint8_t r, std::uint8_t g, std::uint8_t b) noexcept
77 {
return red == other.red &&
green == other.green &&
blue == other.blue; }
82 {
return !(*
this == other); }
108 std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t a) noexcept
126 red == other.red &&
green == other.green
127 &&
blue == other.blue &&
alpha == other.alpha;
133 {
return !(*
this == other); }
144 {
return x.red == y.red && x.green == y.green && x.blue == y.blue; }
149 {
return !(x == y); }
159 {
return !(x == y); }
175 dst.green = src.green;
182 dst.green = src.green;
198 dst.red = std::clamp(dst.red + src.red, 0, 255);
199 dst.green = std::clamp(dst.green + src.green, 0, 255);
200 dst.red = std::clamp(dst.blue + src.blue, 0, 255);
205 dst.red = std::clamp(dst.red + src.red, 0, 255);
206 dst.green = std::clamp(dst.green + src.green, 0, 255);
207 dst.red = std::clamp(dst.blue + src.blue, 0, 255);
212 dst.red = std::clamp(dst.red + src.red, 0, 255);
213 dst.green = std::clamp(dst.green + src.green, 0, 255);
214 dst.red = std::clamp(dst.blue + src.blue, 0, 255);
220 dst.red = std::clamp(dst.red + src.red, 0, 255);
221 dst.green = std::clamp(dst.green + src.green, 0, 255);
222 dst.red = std::clamp(dst.blue + src.blue, 0, 255);
237 dst.red = std::clamp(dst.red * src.red / 255, 0, 255);
238 dst.green = std::clamp(dst.green * src.green / 255, 0, 255);
239 dst.blue = std::clamp(dst.blue * src.blue / 255, 0, 255);
244 dst.red = std::clamp(dst.red * src.red / 255, 0, 255);
245 dst.green = std::clamp(dst.green * src.green / 255, 0, 255);
246 dst.blue = std::clamp(dst.blue * src.blue / 255, 0, 255);
251 dst.red = std::clamp(dst.red * src.red / 255, 0, 255);
252 dst.green = std::clamp(dst.green * src.green / 255, 0, 255);
253 dst.blue = std::clamp(dst.blue * src.blue / 255, 0, 255);
259 dst.red = std::clamp(dst.red * src.red / 255, 0, 255);
260 dst.green = std::clamp(dst.green * src.green / 255, 0, 255);
261 dst.blue = std::clamp(dst.blue * src.blue / 255, 0, 255);
278 src.red * src.alpha / 255 + dst.red * (255 - src.alpha) / 255,
282 src.green * src.alpha / 255 + dst.green * (255 - src.alpha) / 255,
286 src.blue * src.alpha / 255 + dst.blue * (255 - src.alpha) / 255,
294 src.red * src.alpha / 255 + dst.red * (255 - src.alpha) / 255,
298 src.green * src.alpha / 255 + dst.green * (255 - src.alpha) / 255,
302 src.blue * src.alpha / 255 + dst.blue * (255 - src.alpha) / 255,
306 src.alpha + dst.alpha * (255 - src.alpha) / 255,
331 src.red * alpha_ / 255 + dst.red * (255 - alpha_) / 255,
335 src.green * alpha_ / 255 + dst.green * (255 - alpha_) / 255,
339 src.blue * alpha_ / 255 + dst.blue * (255 - alpha_) / 255,
346 int a = alpha_ * src.alpha;
349 src.red * a / 65025 + dst.red * (65025 - a) / 65025,
353 src.green * a / 65025 + dst.green * (65025 - a) / 65025,
357 src.blue * a / 65025 + dst.blue * (65025 - a) / 65025,
365 src.red * alpha_ / 255 + dst.red * (255 - alpha_) / 255,
369 src.green * alpha_ / 255 + dst.green * (255 - alpha_) / 255,
373 src.blue * alpha_ / 255 + dst.blue * (255 - alpha_) / 255,
377 alpha_ + dst.alpha * (255 - alpha_) / 255,
384 int a = alpha_ * src.alpha;
387 src.red * a / 65025 + dst.red * (65025 - a) / 65025,
391 src.green * a / 65025 + dst.green * (65025 - a) / 65025,
395 src.blue * a / 65025 + dst.blue * (65025 - a) / 65025,
400 a / 255 + dst.alpha * (65025 - a) / 65025,
ImageBuffer<>::blt()で用ゐる加算ブレンドのための函數オブジェクトクラス
Definition colour.h:194
void operator()(const RgbColour &src, RgbaColour &dst) noexcept
Definition colour.h:210
void operator()(const RgbColour &src, RgbColour &dst) noexcept
Definition colour.h:196
void operator()(const RgbaColour &src, RgbColour &dst) noexcept
Definition colour.h:203
void operator()(const RgbaColour &src, RgbaColour &dst) noexcept
Definition colour.h:218
ImageBuffer<>::blt()で用ゐるαブレンドのための函數オブジェクトクラス
Definition colour.h:272
void operator()(const RgbaColour &src, RgbaColour &dst) noexcept
Definition colour.h:290
void operator()(const RgbaColour &src, RgbColour &dst) noexcept
Definition colour.h:274
ImageBuffer<>::blt()で用ゐるαブレンドのための函數オブジェクトクラス
Definition colour.h:320
void operator()(const RgbaColour &src, RgbColour &dst) const noexcept
Definition colour.h:343
void operator()(const RgbColour &src, RgbColour &dst) const noexcept
Definition colour.h:327
void operator()(const RgbColour &src, RgbaColour &dst) const noexcept
Definition colour.h:361
CopierUsingFixedAlpha(std::uint8_t a) noexcept
Definition colour.h:325
void operator()(const RgbaColour &src, RgbaColour &dst) const noexcept
Definition colour.h:381
ImageBuffer<>::blt()で用ゐる乘算ブレンドのための函數オブジェクトクラス
Definition colour.h:233
void operator()(const RgbaColour &src, RgbColour &dst) noexcept
Definition colour.h:242
void operator()(const RgbColour &src, RgbColour &dst) noexcept
Definition colour.h:235
void operator()(const RgbColour &src, RgbaColour &dst) noexcept
Definition colour.h:249
void operator()(const RgbaColour &src, RgbaColour &dst) noexcept
Definition colour.h:257
ImageBuffer<>::blt()で用ゐる單純轉送のための函數オブジェクトクラス
Definition colour.h:170
void operator()(const RgbColour &src, RgbaColour &dst) noexcept
Definition colour.h:179
void operator()(const RgbaColour &src, RgbColour &dst) noexcept
Definition colour.h:172
RGB24bit色情報クラス
Definition colour.h:54
std::uint8_t green
緑要素
Definition colour.h:57
constexpr bool operator==(const RgbColour &other) const noexcept
等價比較演算子
Definition colour.h:76
constexpr RgbColour(std::uint8_t r, std::uint8_t g, std::uint8_t b) noexcept
構築子
Definition colour.h:70
constexpr RgbColour() noexcept
構築子
Definition colour.h:64
constexpr bool operator!=(const RgbColour &other) const noexcept
非等價比較演算子
Definition colour.h:81
std::uint8_t red
赤要素
Definition colour.h:56
std::uint8_t blue
青要素
Definition colour.h:58
RGBA32bit色情報クラス
Definition colour.h:90
constexpr bool operator==(const RgbaColour &other) const noexcept
等價比較演算子
Definition colour.h:123
constexpr bool operator!=(const RgbaColour &other) const noexcept
非等價比較演算子
Definition colour.h:132
std::uint8_t alpha
アルファ値(不透過度)
Definition colour.h:95
std::uint8_t red
赤要素
Definition colour.h:92
std::uint8_t green
緑要素
Definition colour.h:93
std::uint8_t blue
青要素
Definition colour.h:94
constexpr RgbaColour(const RgbColour &rgb) noexcept
構築子
Definition colour.h:113
constexpr RgbaColour(std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t a) noexcept
構築子
Definition colour.h:107
constexpr RgbaColour() noexcept
構築子
Definition colour.h:101
constexpr bool operator==(const RgbaColour &x, const RgbColour &y) noexcept
Definition colour.h:143
constexpr bool operator!=(const RgbaColour &x, const RgbColour &y) noexcept
Definition colour.h:148