HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PXL_Pixel.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: PXL_Pixel.h
7  *
8  * COMMENTS:
9  * Utility class for manipulating different types of pixel data (uint8,
10  * uint16, int32, float32)
11  * fast - setting to zero does white/black point calculations,
12  * 1 does the faster int calculations.
13  */
14 
15 #ifndef PXL_PIXEL_H
16 #define PXL_PIXEL_H
17 
18 #include "PXL_Common.h"
19 
20 template<class Type, int fast> class PXL_Pixel
21 {
22 public:
23  PXL_Pixel(unsigned int black=0, unsigned int white=0, Type value =0);
24  PXL_Pixel(const PXL_Pixel &pix);
25 
26  inline bool isSameType(PXL_DataFormat format,
27  unsigned b,
28  unsigned w) const;
29 
30  inline void setBWPoints(float b, float w);
31 
32  inline Type operator + (int) const;
33  inline Type operator - (int) const;
34  inline Type operator / (int) const;
35  inline Type operator * (int) const;
36 
37  inline Type operator +=(int);
38  inline Type operator -=(int);
39  inline Type operator /=(int);
40  inline Type operator *=(int);
41 
42  // Float addition and subtraction treated as (0.0 = black, 1.0 = white)
43  inline Type operator + (float) const;
44  inline Type operator - (float) const;
45  inline Type operator / (float) const;
46  inline Type operator * (float) const;
47 
48  inline Type operator +=(float);
49  inline Type operator -=(float);
50  inline Type operator /=(float);
51  inline Type operator *=(float);
52 
53  inline operator unsigned char () const;
54  inline operator unsigned short () const;
55  inline operator unsigned int () const;
56  inline operator float () const;
57 
58  // just assigns explicitly (no conversion), though clamping is done.
59  inline Type assign(unsigned int);
60 
61  // assigns explicitly.
62  inline Type set(Type );
63 
64  inline Type operator= (float);
65 
66  inline bool operator==(unsigned int) const;
67  inline bool operator!=(unsigned int v) const
68  { return !(*this == v); }
69  inline bool operator==(float) const;
70  inline bool operator!=(float v) const
71  { return !(*this == v); }
72 
73  inline Type maxValue() const;
74  inline Type minValue() const;
75 
76  inline void setRange(unsigned int b, unsigned int w);
77 
78  inline unsigned int getWhite() const { return myWhite; }
79  inline unsigned int getBlack() const { return myBlack; }
80  inline Type getValue() const { return myValue; }
81  inline PXL_DataFormat getFormat() const { return myType; }
82 
83  inline void mapValue(unsigned int val);
84 
85  inline int getIntFromFloat(float f) const;
86 
87 
88  inline const char *formatName() const;
89 private:
90  Type myValue;
91  unsigned int myBlack;
92  unsigned int myWhite;
93  PXL_DataFormat myType;
94  float myPntScale;
95 };
96 
97 
98 #include "PXL_PixelImpl.h"
99 
100 #endif
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
bool isSameType(PXL_DataFormat format, unsigned b, unsigned w) const
Type operator/=(int)
const GLdouble * v
Definition: glcorearb.h:837
bool operator!=(unsigned int v) const
Definition: PXL_Pixel.h:67
Type operator+(int) const
unsigned int getBlack() const
Definition: PXL_Pixel.h:79
bool operator==(unsigned int) const
Type operator*(int) const
GLfloat f
Definition: glcorearb.h:1926
IMATH_NAMESPACE::V2f float
unsigned int getWhite() const
Definition: PXL_Pixel.h:78
GLint GLint GLsizei GLint GLenum format
Definition: glcorearb.h:108
PXL_Pixel(unsigned int black=0, unsigned int white=0, Type value=0)
Type operator-(int) const
PXL_DataFormat
Definition: PXL_Common.h:20
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
int getIntFromFloat(float f) const
void mapValue(unsigned int val)
Type getValue() const
Definition: PXL_Pixel.h:80
Type operator/(int) const
Type assign(unsigned int)
Type operator-=(int)
const char * formatName() const
Type maxValue() const
Type operator*=(int)
void setBWPoints(float b, float w)
GLuint GLfloat * val
Definition: glcorearb.h:1608
Type set(Type)
Type minValue() const
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
Definition: core.h:1131
Type operator=(float)
void setRange(unsigned int b, unsigned int w)
bool operator!=(float v) const
Definition: PXL_Pixel.h:70
PXL_DataFormat getFormat() const
Definition: PXL_Pixel.h:81
Type operator+=(int)