mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 01:44:06 -04:00
compare_to
This commit is contained in:
parent
f15125ce30
commit
53486852f4
@ -365,22 +365,55 @@ operator = (const PixelSpec ©) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PNMImageHeader::PixelSpec::Comparison Operator
|
||||
// Function: PNMImageHeader::PixelSpec::operator <
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool PNMImageHeader::PixelSpec::
|
||||
operator < (const PixelSpec &other) const {
|
||||
return compare_to(other) < 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PNMImageHeader::PixelSpec::operator ==
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool PNMImageHeader::PixelSpec::
|
||||
operator == (const PixelSpec &other) const {
|
||||
return compare_to(other) == 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PNMImageHeader::PixelSpec::operator !=
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool PNMImageHeader::PixelSpec::
|
||||
operator != (const PixelSpec &other) const {
|
||||
return compare_to(other) != 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PNMImageHeader::PixelSpec::compare_to
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int PNMImageHeader::PixelSpec::
|
||||
compare_to(const PixelSpec &other) const {
|
||||
if (_red != other._red) {
|
||||
return _red < other._red;
|
||||
return _red < other._red ? -1 : 1;
|
||||
}
|
||||
if (_green != other._green) {
|
||||
return _green < other._green;
|
||||
return _green < other._green ? -1 : 1;
|
||||
}
|
||||
if (_blue != other._blue) {
|
||||
return _blue < other._blue;
|
||||
return _blue < other._blue ? -1 : 1;
|
||||
}
|
||||
return _alpha < other._alpha;
|
||||
if (_alpha != other._alpha) {
|
||||
return _alpha < other._alpha ? -1 : 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
@ -118,6 +118,9 @@ PUBLISHED:
|
||||
INLINE void operator = (const PixelSpec ©);
|
||||
|
||||
INLINE bool operator < (const PixelSpec &other) const;
|
||||
INLINE bool operator == (const PixelSpec &other) const;
|
||||
INLINE bool operator != (const PixelSpec &other) const;
|
||||
INLINE int compare_to(const PixelSpec &other) const;
|
||||
|
||||
INLINE xelval get_red() const;
|
||||
INLINE xelval get_green() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user