40class EXPCL_PANDA_PNMIMAGE PNMImageHeader {
42 INLINE PNMImageHeader();
43 INLINE PNMImageHeader(
const PNMImageHeader ©);
44 INLINE
void operator = (
const PNMImageHeader ©);
45 INLINE ~PNMImageHeader();
65 INLINE
static bool has_alpha(ColorType color_type);
79 INLINE
void set_comment(
const std::string &comment);
88 bool report_unknown_type =
true);
89 BLOCKING
bool read_header(std::istream &data,
const std::string &filename = std::string(),
90 PNMFileType *type =
nullptr,
bool report_unknown_type =
true);
94 bool report_unknown_type =
true)
const;
97 std::string magic_number = std::string(),
99 bool report_unknown_type =
true)
const;
110 void output(std::ostream &out)
const;
115 class EXPCL_PANDA_PNMIMAGE PixelSpec {
117 INLINE PixelSpec() =
default;
120 INLINE PixelSpec(xelval gray_value);
121 INLINE PixelSpec(xelval gray_value, xelval alpha);
122 INLINE PixelSpec(xelval red, xelval green, xelval blue);
123 INLINE PixelSpec(xelval red, xelval green, xelval blue, xelval alpha);
124 INLINE PixelSpec(
const xel &rgb);
125 INLINE PixelSpec(
const xel &rgb, xelval alpha);
127 INLINE
bool operator < (
const PixelSpec &other)
const;
128 INLINE
bool operator == (
const PixelSpec &other)
const;
129 INLINE
bool operator != (
const PixelSpec &other)
const;
130 INLINE
int compare_to(
const PixelSpec &other)
const;
132 INLINE xelval get_red()
const;
133 INLINE xelval get_green()
const;
134 INLINE xelval get_blue()
const;
135 INLINE xelval get_alpha()
const;
137 INLINE
void set_red(xelval red);
138 INLINE
void set_green(xelval green);
139 INLINE
void set_blue(xelval blue);
140 INLINE
void set_alpha(xelval alpha);
142 INLINE xelval operator [](
int n)
const;
143 INLINE
static int size();
145 void output(std::ostream &out)
const;
148 xelval _red, _green, _blue, _alpha;
153 class EXPCL_PANDA_PNMIMAGE PixelSpecCount {
156 INLINE
bool operator < (
const PixelSpecCount &other)
const;
162 typedef pmap<PixelSpec, int> HistMap;
163 typedef pvector<PixelSpecCount> PixelCount;
164 typedef pvector<PixelSpec> Palette;
167 class EXPCL_PANDA_PNMIMAGE Histogram {
177 void write(std::ostream &out)
const;
180 INLINE
void swap(PixelCount &pixels, HistMap &hist_map);
188 bool compute_histogram(HistMap &hist, xel *
array, xelval *alpha,
190 bool compute_palette(Palette &palette, xel *
array, xelval *alpha,
192 INLINE
void record_color(HistMap &hist,
const PixelSpec &color);
194 int _x_size, _y_size;
197 ColorSpace _color_space;
198 std::string _comment;