7 #ifndef PACKAGER_MEDIA_DVB_DVB_IMAGE_H_
8 #define PACKAGER_MEDIA_DVB_DVB_IMAGE_H_
11 #include <type_traits>
22 bool operator==(
const RgbaColor& other)
const {
23 return r == other.r && g == other.g && b == other.b && a == other.a;
25 bool operator!=(
const RgbaColor& other)
const {
return !(*
this == other); }
29 static_assert(std::is_pod<RgbaColor>::value,
"RgbaColor must be POD");
30 static_assert(
sizeof(
RgbaColor) == 4,
"RgbaColor not packed correctly");
32 enum class BitDepth : uint8_t {
55 RgbaColor GetColor(BitDepth bit_depth, uint8_t entry_id)
const;
57 void SetColor(BitDepth bit_depth, uint8_t entry_id,
RgbaColor color);
66 RgbaColor GetColorRaw(BitDepth bit_depth, uint8_t entry_id)
const;
74 uint8_t bit_depth_2_to_4_[4] = {0x0, 0x7, 0x8, 0xf};
75 uint8_t bit_depth_2_to_8_[4] = {0x0, 0x77, 0x88, 0xff};
76 uint8_t bit_depth_4_to_8_[16] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
77 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
78 0xcc, 0xdd, 0xee, 0xff};
100 uint16_t max_width()
const {
return max_width_; }
101 uint16_t max_height()
const {
return max_height_; }
103 bool AddPixel(BitDepth bit_depth, uint8_t byte_code,
bool is_top_rows);
104 void NewRow(
bool is_top_rows);
119 uint16_t* height)
const;
126 const std::unique_ptr<RgbaColor[]> pixels_;
128 Position top_pos_, bottom_pos_;
129 const uint16_t max_width_;
130 const uint16_t max_height_;
137 #endif // PACKAGER_MEDIA_DVB_DVB_IMAGE_H_