| #pragma once |
| |
| #ifndef _PIXEL_GR_H |
| #define _PIXEL_GR_H |
| |
| #include "tcommon.h" |
| |
| #include <math.h> |
| |
| #undef DVAPI |
| #undef DVVAR |
| #ifdef TCOLOR_EXPORTS |
| #define DVAPI DV_EXPORT_API |
| #define DVVAR DV_EXPORT_VAR |
| #else |
| #define DVAPI DV_IMPORT_API |
| #define DVVAR DV_IMPORT_VAR |
| #endif |
| |
| |
| class TPixelRGBM32; |
| |
| class TPixelRGBM64; |
| |
| class TPixelD; |
| |
| class TPixelGR8; |
| |
| class TPixelGR16; |
| |
| |
| |
| |
| |
| class DVAPI TPixelGR8 { |
| public: |
| static const int maxChannelValue; |
| typedef UCHAR Channel; |
| |
| UCHAR value; |
| TPixelGR8(int v = 0) : value(v){}; |
| TPixelGR8(const TPixelGR8 &pix) : value(pix.value){}; |
| |
| inline bool operator==(const TPixelGR8 &p) const { return value == p.value; }; |
| inline bool operator!=(const TPixelGR8 &p) const { return value != p.value; }; |
| inline bool operator<(const TPixelGR8 &p) const { return value < p.value; }; |
| inline bool operator<=(const TPixelGR8 &p) const { return value <= p.value; }; |
| inline bool operator>(const TPixelGR8 &p) const { return value > p.value; }; |
| inline bool operator>=(const TPixelGR8 &p) const { return value >= p.value; }; |
| |
| inline void setValue(int _value) { value = (UCHAR)_value; } |
| |
| |
| |
| |
| static inline TPixelGR8 from(const TPixelGR16 &pix, |
| TUINT32 randomNumber); |
| |
| |
| |
| |
| static TPixelGR8 from(const TPixelRGBM64 &pix, |
| TUINT32 randomNumber); |
| |
| static TPixelGR8 from(const TPixelRGBM32 &pix); |
| |
| static inline TPixelGR8 from(const TPixelGR16 &pix); |
| |
| static TPixelGR8 from(const TPixelD &pix); |
| |
| static const TPixelGR8 White; |
| static const TPixelGR8 Black; |
| }; |
| |
| |
| |
| |
| class DVAPI TPixelGR16 { |
| public: |
| static const int maxChannelValue; |
| typedef USHORT Channel; |
| |
| USHORT value; |
| TPixelGR16(int v = 0) : value(v){}; |
| TPixelGR16(const TPixelGR16 &pix) : value(pix.value){}; |
| |
| inline bool operator==(const TPixelGR16 &p) const { |
| return value == p.value; |
| }; |
| inline bool operator!=(const TPixelGR16 &p) const { |
| return value != p.value; |
| }; |
| inline bool operator<(const TPixelGR16 &p) const { return value < p.value; }; |
| inline bool operator<=(const TPixelGR16 &p) const { |
| return value <= p.value; |
| }; |
| inline bool operator>(const TPixelGR16 &p) const { return value > p.value; }; |
| inline bool operator>=(const TPixelGR16 &p) const { |
| return value >= p.value; |
| }; |
| |
| inline void setValue(int _value) { value = (USHORT)_value; } |
| static TPixelGR16 from(const TPixelRGBM64 &pix); |
| |
| static TPixelGR16 from(const TPixelD &pix); |
| |
| static const TPixelGR16 White; |
| static const TPixelGR16 Black; |
| }; |
| |
| |
| |
| class DVAPI TPixelGRD { |
| public: |
| typedef double Channel; |
| |
| double value; |
| TPixelGRD(double v = 0.0) : value(v){}; |
| TPixelGRD(const TPixelGRD &pix) : value(pix.value){}; |
| inline bool operator==(const TPixelGRD &p) const { return value == p.value; }; |
| inline bool operator<(const TPixelGRD &p) const { return value < p.value; }; |
| |
| inline void setValue(double _value) { value = (double)_value; } |
| static TPixelGRD from(const TPixelGR8 &pix) { |
| return TPixelGRD((double)(pix.value)); |
| } |
| }; |
| |
| #endif |