15 #ifndef PNMIMAGEHEADER_H 16 #define PNMIMAGEHEADER_H 18 #include "pandabase.h" 20 #include "pnmimage_base.h" 22 #include "typedObject.h" 27 #include "colorSpace.h" 46 INLINE PNMImageHeader(
const PNMImageHeader ©);
47 INLINE
void operator = (
const PNMImageHeader ©);
48 INLINE ~PNMImageHeader();
61 INLINE ColorType get_color_type()
const;
62 INLINE
int get_num_channels()
const;
64 INLINE
static bool is_grayscale(ColorType color_type);
65 INLINE
bool is_grayscale()
const;
67 INLINE
static bool has_alpha(ColorType color_type);
68 INLINE
bool has_alpha()
const;
70 INLINE xelval get_maxval()
const;
71 INLINE ColorSpace get_color_space()
const;
73 INLINE
int get_x_size()
const;
74 INLINE
int get_y_size()
const;
76 INLINE
string get_comment()
const;
77 INLINE
void set_comment(
const string &comment);
79 INLINE
bool has_type()
const;
84 bool report_unknown_type =
true);
85 BLOCKING
bool read_header(istream &data,
const string &filename =
string(),
86 PNMFileType *type = NULL,
bool report_unknown_type =
true);
90 bool report_unknown_type =
true)
const;
91 PNMReader *make_reader(istream *file,
bool owns_file =
true,
93 string magic_number =
string(),
95 bool report_unknown_type =
true)
const;
99 PNMWriter *make_writer(ostream *file,
bool owns_file =
true,
103 static bool read_magic_number(istream *file,
string &magic_number,
106 void output(ostream &out)
const;
114 INLINE PixelSpec(xelval gray_value, xelval alpha);
115 INLINE PixelSpec(xelval red, xelval green, xelval blue);
116 INLINE PixelSpec(xelval red, xelval green, xelval blue, xelval alpha);
117 INLINE PixelSpec(
const xel &rgb);
118 INLINE PixelSpec(
const xel &rgb, xelval alpha);
119 INLINE PixelSpec(
const PixelSpec ©);
120 INLINE
void operator = (
const PixelSpec ©);
122 INLINE
bool operator < (
const PixelSpec &other)
const;
123 INLINE
bool operator == (
const PixelSpec &other)
const;
124 INLINE
bool operator != (
const PixelSpec &other)
const;
125 INLINE
int compare_to(
const PixelSpec &other)
const;
127 INLINE xelval get_red()
const;
128 INLINE xelval get_green()
const;
129 INLINE xelval get_blue()
const;
130 INLINE xelval get_alpha()
const;
132 INLINE
void set_red(xelval red);
133 INLINE
void set_green(xelval green);
134 INLINE
void set_blue(xelval blue);
135 INLINE
void set_alpha(xelval alpha);
137 INLINE xelval operator [](
int n)
const;
138 INLINE
static int size();
140 void output(ostream &out)
const;
143 xelval _red, _green, _blue, _alpha;
151 INLINE
bool operator < (
const PixelSpecCount &other)
const;
166 INLINE
int get_num_pixels()
const;
167 INLINE
const PixelSpec &get_pixel(
int n)
const;
168 INLINE
int get_count(
int n)
const;
169 INLINE
int get_count(
const PixelSpec &pixel)
const;
170 MAKE_SEQ(get_pixels, get_num_pixels, get_pixel);
172 void write(ostream &out)
const;
175 INLINE
void swap(PixelCount &pixels, HistMap &hist_map);
183 bool compute_histogram(HistMap &hist,
xel *array, xelval *alpha,
185 bool compute_palette(Palette &palette,
xel *array, xelval *alpha,
189 int _x_size, _y_size;
192 ColorSpace _color_space;
197 INLINE ostream &operator << (ostream &out,
const PNMImageHeader &header) {
207 #include "pnmImageHeader.I"
This is the base class of a family of classes that represent particular image file types that PNMImag...
The name of a file, such as a texture file or an Egg file.
This is an abstract base class that defines the interface for reading image files of various types...
This is an abstract base class that defines the interface for writing image files of various types...
An STL function object class, this is intended to be used on any ordered collection of class objects ...