HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PXL_Fill.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_Fill.h
7  *
8  * COMMENTS:
9  * Class for filling regions with image data, possibly with
10  * type conversion.
11  */
12 #ifndef PXL_FILL_H
13 #define PXL_FILL_H
14 
15 #include <UT/UT_Lock.h>
16 #include "PXL_API.h"
17 #include "PXL_Common.h"
18 #include <iosfwd>
19 
20 class til_gamma8;
21 class til_gamma16;
22 
24 {
25 public:
26  PXL_FillParms();
27  ~PXL_FillParms();
28 
29  // Source image parms
30 
31  void setSourceType(PXL_DataFormat type, unsigned b=0, unsigned w=0);
32 
33  // Source area is in inclusive rectangle format in pixels.
34  // Since PXL_FillParms has no color model associated with it (ie, RGB),
35  // multiple components need to be done in separate passes, or by assuming
36  // the source area is 'components' times wider.
37  void setSourceArea(exint x1, exint y1, exint x2, exint y2);
38 
39  const void *mySource;
41  exint mySX1, mySY1;
42  exint mySX2, mySY2;
43  unsigned int mySBlack, mySWhite;
47  int mySFast;
48 
49  // Dest image parms
50  void setDestType(PXL_DataFormat type, unsigned b=0, unsigned w=0);
51  void setDestArea(exint x1, exint y1, exint x2, exint y2);
52 
53  const void *myDest;
55  exint myDX1, myDY1;
56  exint myDX2, myDY2;
57  unsigned int myDBlack, myDWhite;
59  int myDFast;
60 
61  // transforms
62  exint myXShift, myYShift;
63  int myXFlip, myYFlip;
64 
65  // colour transforms
66  int myUseGrey;
67  float myFillColor;
68  float myGamma;
70  float *myMultData;
71  float myMultFactor;
72 
75 
76  void debugPrint(std::ostream &);
77 };
78 
80 {
81 public:
82  static void fill(const PXL_FillParms &parms);
83 
84  // only uses dest parms and fill colour.
85  static void clear(const PXL_FillParms &parms);
86 
87  static void invert(const PXL_FillParms &parms);
88  static void multiply(const PXL_FillParms &parms);
89  static void divide(const PXL_FillParms &parms);
90 };
91 
92 
93 // These are quick lookup gamma classes for 8 and 16 bit images.
95 {
96 public:
97  til_gamma8() : myTable(0), myBlack(0U), myWhite(0U),
98  myGamma(1.0f), myLock(0) {}
99  ~til_gamma8() { delete [] myTable; }
100 
101  unsigned char *build(float gamma, unsigned int b, unsigned int w);
102  unsigned char lookup(unsigned char val) { return myTable[val]; }
103 
104 private:
105  unsigned char *myTable;
106  unsigned int myBlack;
107  unsigned int myWhite;
108  float myGamma;
109  UT_Lock myLock;
110 };
111 
113 {
114 public:
115  til_gamma16() : myTable(0), myBlack(0U), myWhite(0U),
116  myGamma(1.0f), myLock(0) {}
117  ~til_gamma16() { delete [] myTable; }
118 
119  unsigned short *build(float gamma, unsigned int b, unsigned int w);
120  unsigned short lookup(unsigned short val) { return myTable[val]; }
121 
122 private:
123  unsigned short *myTable;
124  unsigned int myBlack;
125  unsigned int myWhite;
126  float myGamma;
127  UT_Lock myLock;
128 };
129 
130 #endif
exint mySVOff
Definition: PXL_Fill.h:46
int myUseGrey
Definition: PXL_Fill.h:66
PXL_DataFormat mySType
Definition: PXL_Fill.h:40
til_gamma8 * myGTable8
Definition: PXL_Fill.h:73
GLboolean invert
Definition: glcorearb.h:548
float myGamma
Definition: PXL_Fill.h:68
exint myDInc
Definition: PXL_Fill.h:58
exint mySInc
Definition: PXL_Fill.h:44
~til_gamma16()
Definition: PXL_Fill.h:117
float myMultFactor
Definition: PXL_Fill.h:71
unsigned int myDWhite
Definition: PXL_Fill.h:57
#define PXL_API
Definition: PXL_API.h:10
PXL_DataFormat myDType
Definition: PXL_Fill.h:54
GLfloat f
Definition: glcorearb.h:1925
exint mySVInc
Definition: PXL_Fill.h:45
bool myMultPerPixel
Definition: PXL_Fill.h:69
unsigned int mySWhite
Definition: PXL_Fill.h:43
int64 exint
Definition: SYS_Types.h:116
exint myDY2
Definition: PXL_Fill.h:56
float * myMultData
Definition: PXL_Fill.h:70
exint myYShift
Definition: PXL_Fill.h:62
exint myDY1
Definition: PXL_Fill.h:55
float myFillColor
Definition: PXL_Fill.h:67
PXL_DataFormat
Definition: PXL_Common.h:19
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
const void * mySource
Definition: PXL_Fill.h:39
til_gamma16 * myGTable16
Definition: PXL_Fill.h:74
exint mySY1
Definition: PXL_Fill.h:41
exint mySY2
Definition: PXL_Fill.h:42
til_gamma8()
Definition: PXL_Fill.h:97
GLuint GLfloat * val
Definition: glcorearb.h:1607
unsigned short lookup(unsigned short val)
Definition: PXL_Fill.h:120
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
const void * myDest
Definition: PXL_Fill.h:53
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
unsigned char lookup(unsigned char val)
Definition: PXL_Fill.h:102
std::enable_if<!std::is_integral< T >::value, T >::type divide(const T &a, const T &b)
Definition: Composite.h:156
~til_gamma8()
Definition: PXL_Fill.h:99