Warning, file /include/root/TASPngWriter.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 #ifndef ROOT_TASPngWriter
0002 #define ROOT_TASPngWriter
0003
0004 #include <string_view>
0005 #include <vector>
0006
0007 class TASPngWriter {
0008 int width = 0;
0009 int height = 0;
0010 unsigned char color_type = 0;
0011 unsigned char bit_depth = 8;
0012 std::vector<unsigned char *> row_pointers;
0013
0014 public:
0015 TASPngWriter() = default;
0016 TASPngWriter(int w, int h, unsigned char t = 2, unsigned char d = 8)
0017 : width(w), height(h), color_type(t), bit_depth(d)
0018 {
0019 }
0020
0021 void set_type(bool is_rgb, bool has_alpha)
0022 {
0023 color_type = is_rgb ? 2 : 0;
0024 if (has_alpha)
0025 color_type |= 4;
0026 }
0027 void set_luminance() { color_type = 0; }
0028 void set_luminance_alpha() { color_type = 4; }
0029 void set_rgb() { color_type = 2; }
0030 void set_rgba() { color_type = 6; }
0031
0032 std::vector<unsigned char *> &ref_row_pointers() { return row_pointers; }
0033
0034 int write_png_file(std::string_view filename);
0035 };
0036
0037 #endif