20 INLINE PNMImageHeader::
26 _color_space = CS_unspecified;
35 INLINE PNMImageHeader::
37 _x_size(copy._x_size),
38 _y_size(copy._y_size),
39 _num_channels(copy._num_channels),
40 _maxval(copy._maxval),
41 _color_space(copy._color_space),
51 INLINE
void PNMImageHeader::
53 _x_size = copy._x_size;
54 _y_size = copy._y_size;
55 _num_channels = copy._num_channels;
56 _maxval = copy._maxval;
57 _color_space = copy._color_space;
58 _comment = copy._comment;
67 INLINE PNMImageHeader::
80 nassertr(_num_channels >= 1 && _num_channels <= 4, CT_invalid);
81 return (ColorType)_num_channels;
91 nassertr(_num_channels >= 1 && _num_channels <= 4, 0);
104 return (color_type == CT_grayscale || color_type == CT_two_channel);
130 return (color_type == CT_two_channel || color_type == CT_four_channel);
257 INLINE
void PNMImageHeader::
262 HistMap::iterator hi = hist.insert(HistMap::value_type(color, 0)).first;
275 INLINE PNMImageHeader::PixelSpec::
276 PixelSpec(xelval gray_value) :
289 INLINE PNMImageHeader::PixelSpec::
290 PixelSpec(xelval gray_value, xelval alpha) :
303 INLINE PNMImageHeader::PixelSpec::
304 PixelSpec(xelval red, xelval green, xelval blue) :
317 INLINE PNMImageHeader::PixelSpec::
318 PixelSpec(xelval red, xelval green, xelval blue, xelval alpha) :
331 INLINE PNMImageHeader::PixelSpec::
332 PixelSpec(
const xel &rgb) :
334 _green(PPM_GETG(rgb)),
335 _blue(PPM_GETB(rgb)),
345 INLINE PNMImageHeader::PixelSpec::
346 PixelSpec(
const xel &rgb, xelval alpha) :
348 _green(PPM_GETG(rgb)),
349 _blue(PPM_GETB(rgb)),
359 INLINE PNMImageHeader::PixelSpec::
373 INLINE
void PNMImageHeader::PixelSpec::
376 _green = copy._green;
378 _alpha = copy._alpha;
386 INLINE
bool PNMImageHeader::PixelSpec::
387 operator < (
const PixelSpec &other)
const {
396 INLINE
bool PNMImageHeader::PixelSpec::
397 operator == (
const PixelSpec &other)
const {
406 INLINE
bool PNMImageHeader::PixelSpec::
407 operator != (
const PixelSpec &other)
const {
416 INLINE
int PNMImageHeader::PixelSpec::
417 compare_to(
const PixelSpec &other)
const {
418 if (_red != other._red) {
419 return _red < other._red ? -1 : 1;
421 if (_green != other._green) {
422 return _green < other._green ? -1 : 1;
424 if (_blue != other._blue) {
425 return _blue < other._blue ? -1 : 1;
427 if (_alpha != other._alpha) {
428 return _alpha < other._alpha ? -1 : 1;
438 INLINE xelval PNMImageHeader::PixelSpec::
448 INLINE xelval PNMImageHeader::PixelSpec::
458 INLINE xelval PNMImageHeader::PixelSpec::
468 INLINE xelval PNMImageHeader::PixelSpec::
478 INLINE
void PNMImageHeader::PixelSpec::
479 set_red(xelval red) {
488 INLINE
void PNMImageHeader::PixelSpec::
489 set_green(xelval green) {
498 INLINE
void PNMImageHeader::PixelSpec::
499 set_blue(xelval blue) {
508 INLINE
void PNMImageHeader::PixelSpec::
509 set_alpha(xelval alpha) {
522 nassertr(n >= 0 && n < size(), 0);
546 INLINE PNMImageHeader::PixelSpecCount::
562 return _count > other._count;
570 INLINE PNMImageHeader::Histogram::
582 return _pixels.size();
594 nassertr(n >= 0 && n < (
int)_pixels.size(), _pixels[0]._pixel);
595 return _pixels[n]._pixel;
606 nassertr(n >= 0 && n < (
int)_pixels.size(), 0);
607 return _pixels[n]._count;
618 HistMap::const_iterator hi;
619 hi = _hist_map.find(pixel);
620 if (hi == _hist_map.end()) {
635 _pixels.swap(pixels);
636 _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 ...