8 inline uint8_t to8(
const uint16_t& shortval) {
9 return static_cast<uint8_t
>(shortval >> 8);
13 inline uint8_t to8hist(
const uint16_t& s,
const uint16_t& l,
const uint16_t& u) {
14 return ( (s <= l) ? 0 : (s >= u) ? 255 : to8(s) );
18 inline uint8_t to8hist_mod(
const uint16_t& s,
const uint16_t& l,
const uint16_t& u) {
23 uint8_t ranged = ( (s-l) * 255 / (u-l));
28 inline uint8_t to8hist_mod2(
const uint16_t& s,
const uint16_t& l,
const uint16_t& u,
const uint16_t& scaler) {
33 uint8_t ranged = ( (s-l) * scaler);
68 BGRA8Pixel(
const uint8_t& vB,
const uint8_t& vG,
const uint8_t& vR)
84 return BGRA8Pixel((B > (0xFF - adder.
B)) ? 0xFF : B + adder.
B
85 , (G > (0xFF - adder.
G)) ? 0xFF : G + adder.
G
86 , (R > (0xFF - adder.
R)) ? 0xFF : R + adder.
R);
91 B = (B > (0xFF - adder.
B)) ? 0xFF : B + adder.
B;
92 G = (G > (0xFF - adder.
G)) ? 0xFF : G + adder.
G;
93 R = (R > (0xFF - adder.
R)) ? 0xFF : R + adder.
R;
99 inline void to_blue(
const uint8_t& val) { B = val; }
100 inline void to_green(
const uint8_t& val) { G = val; }
101 inline void to_red(
const uint8_t& val) { R = val; }
102 inline void to_gray(
const uint8_t& val) { B = G = R = val; }
BGRA8Pixel & operator+=(const BGRA8Pixel &adder)
satured addition (evtl do with MMX / 8 pixel at the same time because 64bit?!)
BGRA8Pixel(const uint8_t &val)
Sets all colors to val (=> gray) and alpha to opaque.
Encapsulated a 4-byte pixel in BGRA format for use with Direct2D.
BGRA8Pixel & operator=(const uint8_t &val)
Sets all colors to val => gray and alpha to opaque.
BGRA8Pixel(const uint8_t &vB, const uint8_t &vG, const uint8_t &vR)
Sets all colors as desired.
BGRA8Pixel()
Initialize to opaque black.
BGRA8Pixel operator+(const BGRA8Pixel &adder)
satured addition (evtl do with MMX / 8 pixel at the same time because 64bit?!)