17INLINE PNMImageHeader::
23 _color_space = CS_unspecified;
30INLINE PNMImageHeader::
32 _x_size(copy._x_size),
33 _y_size(copy._y_size),
34 _num_channels(copy._num_channels),
35 _maxval(copy._maxval),
36 _color_space(copy._color_space),
44INLINE
void PNMImageHeader::
46 _x_size = copy._x_size;
47 _y_size = copy._y_size;
48 _num_channels = copy._num_channels;
49 _maxval = copy._maxval;
50 _color_space = copy._color_space;
51 _comment = copy._comment;
58INLINE PNMImageHeader::
68 nassertr(_num_channels >= 1 && _num_channels <= 4, CT_invalid);
69 return (ColorType)_num_channels;
77 nassertr(_num_channels >= 1 && _num_channels <= 4, 0);
87 return (color_type == CT_grayscale || color_type == CT_two_channel);
106has_alpha(PNMImageHeader::ColorType color_type) {
107 return (color_type == CT_two_channel || color_type == CT_four_channel);
163 return LVecBase2i(_x_size, _y_size);
187 return _type !=
nullptr;
213INLINE
void PNMImageHeader::
218 HistMap::iterator hi = hist.insert(HistMap::value_type(color, 0)).first;
229INLINE PNMImageHeader::PixelSpec::
230PixelSpec(xelval gray_value) :
241INLINE PNMImageHeader::PixelSpec::
242PixelSpec(xelval gray_value, xelval alpha) :
253INLINE PNMImageHeader::PixelSpec::
254PixelSpec(xelval red, xelval green, xelval blue) :
265INLINE PNMImageHeader::PixelSpec::
266PixelSpec(xelval red, xelval green, xelval blue, xelval alpha) :
277INLINE PNMImageHeader::PixelSpec::
278PixelSpec(
const xel &rgb) :
280 _green(PPM_GETG(rgb)),
281 _blue(PPM_GETB(rgb)),
289INLINE PNMImageHeader::PixelSpec::
290PixelSpec(
const xel &rgb, xelval alpha) :
292 _green(PPM_GETG(rgb)),
293 _blue(PPM_GETB(rgb)),
301INLINE
bool PNMImageHeader::PixelSpec::
302operator < (
const PixelSpec &other)
const {
309INLINE
bool PNMImageHeader::PixelSpec::
310operator == (
const PixelSpec &other)
const {
317INLINE
bool PNMImageHeader::PixelSpec::
318operator != (
const PixelSpec &other)
const {
325INLINE
int PNMImageHeader::PixelSpec::
326compare_to(
const PixelSpec &other)
const {
327 if (_red != other._red) {
328 return _red < other._red ? -1 : 1;
330 if (_green != other._green) {
331 return _green < other._green ? -1 : 1;
333 if (_blue != other._blue) {
334 return _blue < other._blue ? -1 : 1;
336 if (_alpha != other._alpha) {
337 return _alpha < other._alpha ? -1 : 1;
345INLINE xelval PNMImageHeader::PixelSpec::
353INLINE xelval PNMImageHeader::PixelSpec::
361INLINE xelval PNMImageHeader::PixelSpec::
369INLINE xelval PNMImageHeader::PixelSpec::
377INLINE
void PNMImageHeader::PixelSpec::
385INLINE
void PNMImageHeader::PixelSpec::
386set_green(xelval green) {
393INLINE
void PNMImageHeader::PixelSpec::
394set_blue(xelval blue) {
401INLINE
void PNMImageHeader::PixelSpec::
402set_alpha(xelval alpha) {
412 nassertr(n >= 0 && n < size(), 0);
431INLINE PNMImageHeader::PixelSpecCount::
444 return _count > other._count;
450INLINE PNMImageHeader::Histogram::
459 return _pixels.size();
468 nassertr(n >= 0 && n < (
int)_pixels.size(), _pixels[0]._pixel);
469 return _pixels[n]._pixel;
478 nassertr(n >= 0 && n < (
int)_pixels.size(), 0);
479 return _pixels[n]._count;
488 HistMap::const_iterator hi;
489 hi = _hist_map.find(
pixel);
490 if (hi == _hist_map.end()) {
502 _pixels.swap(pixels);
503 _hist_map.swap(hist_map);
This is the base class of a family of classes that represent particular image file types that PNMImag...
An STL function object class, this is intended to be used on any ordered collection of class objects ...