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 "PXL_API.h"
16 #include "PXL_Common.h"
17 #include <UT/UT_Lock.h>
18 #include <UT/UT_NonCopyable.h>
19 #include <iosfwd>
20 
21 class til_gamma8;
22 class til_gamma16;
23 
25 {
26 public:
27  PXL_FillParms();
28  ~PXL_FillParms();
29 
31 
32  // Source image parms
33 
34  void setSourceType(PXL_DataFormat type, unsigned b=0, unsigned w=0);
35 
36  // Source area is in inclusive rectangle format in pixels.
37  // Since PXL_FillParms has no color model associated with it (ie, RGB),
38  // multiple components need to be done in separate passes, or by assuming
39  // the source area is 'components' times wider.
40  void setSourceArea(exint x1, exint y1, exint x2, exint y2);
41 
42  const void *mySource;
44  exint mySX1, mySY1;
45  exint mySX2, mySY2;
46  unsigned int mySBlack, mySWhite;
50  int mySFast;
51 
52  // Dest image parms
53  void setDestType(PXL_DataFormat type, unsigned b=0, unsigned w=0);
54  void setDestArea(exint x1, exint y1, exint x2, exint y2);
55 
56  const void *myDest;
58  exint myDX1, myDY1;
59  exint myDX2, myDY2;
60  unsigned int myDBlack, myDWhite;
62  int myDFast;
63 
64  // transforms
65  exint myXShift, myYShift;
66  int myXFlip, myYFlip;
67 
68  // colour transforms
69  int myUseGrey;
70  float myFillColor;
71  float myGamma;
73  float *myMultData;
74  float myMultFactor;
75 
78 
79  void debugPrint(std::ostream &);
80 };
81 
83 {
84 public:
85  static void fill(const PXL_FillParms &parms);
86 
87  // only uses dest parms and fill colour.
88  static void clear(const PXL_FillParms &parms);
89 
90  static void invert(const PXL_FillParms &parms);
91  static void multiply(const PXL_FillParms &parms);
92  static void divide(const PXL_FillParms &parms);
93 };
94 
95 
96 // These are quick lookup gamma classes for 8 and 16 bit images.
98 {
99 public:
100  til_gamma8() : myTable(0), myBlack(0U), myWhite(0U),
101  myGamma(1.0f), myLock(0) {}
102  ~til_gamma8() { delete [] myTable; }
104 
105  unsigned char *build(float gamma, unsigned int b, unsigned int w);
106  unsigned char lookup(unsigned char val) { return myTable[val]; }
107 
108 private:
109  unsigned char *myTable;
110  unsigned int myBlack;
111  unsigned int myWhite;
112  float myGamma;
113  UT_Lock myLock;
114 };
115 
117 {
118 public:
119  til_gamma16() : myTable(0), myBlack(0U), myWhite(0U),
120  myGamma(1.0f), myLock(0) {}
121  ~til_gamma16() { delete [] myTable; }
123 
124  unsigned short *build(float gamma, unsigned int b, unsigned int w);
125  unsigned short lookup(unsigned short val) { return myTable[val]; }
126 
127 private:
128  unsigned short *myTable;
129  unsigned int myBlack;
130  unsigned int myWhite;
131  float myGamma;
132  UT_Lock myLock;
133 };
134 
135 #endif
exint mySVOff
Definition: PXL_Fill.h:49
int myUseGrey
Definition: PXL_Fill.h:69
PXL_DataFormat mySType
Definition: PXL_Fill.h:43
til_gamma8 * myGTable8
Definition: PXL_Fill.h:76
GLboolean invert
Definition: glcorearb.h:549
float myGamma
Definition: PXL_Fill.h:71
int64 exint
Definition: SYS_Types.h:125
exint myDInc
Definition: PXL_Fill.h:61
exint mySInc
Definition: PXL_Fill.h:47
~til_gamma16()
Definition: PXL_Fill.h:121
float myMultFactor
Definition: PXL_Fill.h:74
unsigned int myDWhite
Definition: PXL_Fill.h:60
#define PXL_API
Definition: PXL_API.h:10
FMT_NOINLINE FMT_CONSTEXPR auto fill(OutputIt it, size_t n, const fill_t< Char > &fill) -> OutputIt
Definition: format.h:1262
GLdouble GLdouble x2
Definition: glad.h:2349
PXL_DataFormat myDType
Definition: PXL_Fill.h:57
GLfloat f
Definition: glcorearb.h:1926
exint mySVInc
Definition: PXL_Fill.h:48
bool myMultPerPixel
Definition: PXL_Fill.h:72
unsigned int mySWhite
Definition: PXL_Fill.h:46
exint myDY2
Definition: PXL_Fill.h:59
float * myMultData
Definition: PXL_Fill.h:73
exint myYShift
Definition: PXL_Fill.h:65
GLdouble y1
Definition: glad.h:2349
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
exint myDY1
Definition: PXL_Fill.h:58
float myFillColor
Definition: PXL_Fill.h:70
PXL_DataFormat
Definition: PXL_Common.h:20
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
const void * mySource
Definition: PXL_Fill.h:42
til_gamma16 * myGTable16
Definition: PXL_Fill.h:77
exint mySY1
Definition: PXL_Fill.h:44
exint mySY2
Definition: PXL_Fill.h:45
til_gamma8()
Definition: PXL_Fill.h:100
GLuint GLfloat * val
Definition: glcorearb.h:1608
const void * myDest
Definition: PXL_Fill.h:56
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
GLdouble GLdouble GLdouble y2
Definition: glad.h:2349
type
Definition: core.h:1059
uint64_t multiply(uint64_t lhs, uint64_t rhs)
Definition: format-inl.h:258
std::enable_if<!std::is_integral< T >::value, T >::type divide(const T &a, const T &b)
Definition: Composite.h:133
~til_gamma8()
Definition: PXL_Fill.h:102