23#define KTECH_DEFINITION
24#include "../ktech.hpp"
25#undef KTECH_DEFINITION
26#include "../basic/point.hpp"
27#include "../basic/upoint.hpp"
28#include "../basic/rgb.hpp"
29#include "../basic/rgba.hpp"
33constexpr uint8_t uint8Max = std::numeric_limits<uint8_t>::max();
44 else if (p_start.x >
static_cast<int>(p_res.x))
52 else if (p_start.y >
static_cast<int>(p_res.y))
56 if (p_end.x >
static_cast<int>(p_res.x))
64 if (p_end.y >
static_cast<int>(p_res.y))
76static inline auto DetermineCharacter(
char& p_char) ->
bool
82 if (p_char <
' ' ||
'~' < p_char)
99 p_dst.r = p_src.r * p_dst.a / uint8Max;
100 p_dst.g = p_src.g * p_dst.a / uint8Max;
101 p_dst.b = p_src.b * p_dst.a / uint8Max;
109 p_dst.a = p_src.a * p_alpha / uint8Max;
114 p_dst.r = p_src.r * p_dst.a / uint8Max;
115 p_dst.g = p_src.g * p_dst.a / uint8Max;
116 p_dst.b = p_src.b * p_dst.a / uint8Max;
124 p_dst.
r = p_src.
r + p_dst.
r * (uint8Max - p_src.
a) / uint8Max;
125 p_dst.
g = p_src.
g + p_dst.
g * (uint8Max - p_src.
a) / uint8Max;
126 p_dst.
b = p_src.
b + p_dst.
b * (uint8Max - p_src.
a) / uint8Max;
133 p_dst.
r = p_src.
r + p_dst.
r * (uint8Max - p_src.
a) / uint8Max;
134 p_dst.
g = p_src.
g + p_dst.
g * (uint8Max - p_src.
a) / uint8Max;
135 p_dst.
b = p_src.
b + p_dst.
b * (uint8Max - p_src.
a) / uint8Max;
136 p_dst.
a += (uint8Max - p_dst.
a) * p_src.
a / uint8Max;
139static inline auto GetThirdDigit(uint8_t uint8) ->
char
141 return (uint8 / 100) +
'0';
144static inline auto GetSecondDigit(uint8_t uint8) ->
char
146 return ((uint8 % 100) / 10) +
'0';
149static inline auto GetFirstDigit(uint8_t uint8) ->
char
151 return (uint8 % 10) +
'0';
2D vector, mostly used to store positions and directions.
Definition point.hpp:30
Like RGB, but also has an alpha channel representing transparency.
Definition rgba.hpp:30
uint8_t a
Alpha channel.
Definition rgba.hpp:31
24-bit color, able of representing 16,777,216 (2^24) different colors.
Definition rgb.hpp:29
uint8_t g
Green primary color.
Definition rgb.hpp:31
uint8_t r
Red primary color.
Definition rgb.hpp:30
uint8_t b
Blue primary color.
Definition rgb.hpp:32
Unsigned 2D vector, mostly used to store sizes and 2D indexes.
Definition upoint.hpp:29