00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef PXL_FILL_H
00022 #define PXL_FILL_H
00023
00024 #include <iostream.h>
00025 #include <UT/UT_Lock.h>
00026 #include "PXL_API.h"
00027 #include "PXL_Common.h"
00028
00029 class til_gamma8;
00030 class til_gamma16;
00031
00032 class PXL_API PXL_FillParms
00033 {
00034 public:
00035 PXL_FillParms();
00036 ~PXL_FillParms();
00037
00038
00039
00040 void setSourceType(PXL_DataFormat type, unsigned b=0, unsigned w=0);
00041
00042
00043
00044
00045
00046 void setSourceArea(int x1, int y1, int x2, int y2);
00047
00048 const void *mySource;
00049 PXL_DataFormat mySType;
00050 int mySX1, mySY1;
00051 int mySX2, mySY2;
00052 unsigned int mySBlack, mySWhite;
00053 int mySInc;
00054 int mySVInc;
00055 int mySVOff;
00056 int mySFast;
00057
00058
00059 void setDestType(PXL_DataFormat type, unsigned b=0, unsigned w=0);
00060 void setDestArea(int x1, int y1, int x2, int y2);
00061
00062 const void *myDest;
00063 PXL_DataFormat myDType;
00064 int myDX1, myDY1;
00065 int myDX2, myDY2;
00066 unsigned int myDBlack, myDWhite;
00067 int myDInc;
00068 int myDFast;
00069
00070
00071 int myXShift, myYShift;
00072 int myXFlip, myYFlip;
00073
00074
00075 int myUseGrey;
00076 float myFillColor;
00077 float myGamma;
00078 bool myMultPerPixel;
00079 float *myMultData;
00080 float myMultFactor;
00081
00082 til_gamma8 *myGTable8;
00083 til_gamma16 *myGTable16;
00084
00085 void debugPrint(ostream &);
00086 };
00087
00088 class PXL_API PXL_Fill
00089 {
00090 public:
00091 static void fill(const PXL_FillParms &parms);
00092
00093
00094 static void clear(const PXL_FillParms &parms);
00095
00096 static void invert(const PXL_FillParms &parms);
00097 static void multiply(const PXL_FillParms &parms);
00098 static void divide(const PXL_FillParms &parms);
00099 };
00100
00101
00102
00103 class PXL_API til_gamma8
00104 {
00105 public:
00106 til_gamma8() : myTable(0), myBlack(0U), myWhite(0U),
00107 myGamma(1.0f), myLock(0) {}
00108 ~til_gamma8() { delete [] myTable; }
00109
00110 unsigned char *build(float gamma, unsigned int b, unsigned int w);
00111 unsigned char lookup(unsigned char val) { return myTable[val]; }
00112
00113 private:
00114 unsigned char *myTable;
00115 unsigned int myBlack;
00116 unsigned int myWhite;
00117 float myGamma;
00118 UT_Lock myLock;
00119 };
00120
00121 class PXL_API til_gamma16
00122 {
00123 public:
00124 til_gamma16() : myTable(0), myBlack(0U), myWhite(0U),
00125 myGamma(1.0f), myLock(0) {}
00126 ~til_gamma16() { delete [] myTable; }
00127
00128 unsigned short *build(float gamma, unsigned int b, unsigned int w);
00129 unsigned short lookup(unsigned short val) { return myTable[val]; }
00130
00131 private:
00132 unsigned short *myTable;
00133 unsigned int myBlack;
00134 unsigned int myWhite;
00135 float myGamma;
00136 UT_Lock myLock;
00137 };
00138
00139 #endif