00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __TIL_Image__
00020 #define __TIL_Image__
00021
00022 #include "TIL_API.h"
00023
00024 #define TIL_MIP_LEVELS 5
00025
00026 #include <iostream.h>
00027 #include <UT/UT_SmallObject.h>
00028 #include <UT/UT_String.h>
00029 #include "TIL_Defines.h"
00030
00031 class TIL_ImageSource;
00032 class TIL_Plane;
00033 class TIL_Raster;
00034 class TIL_Lookup;
00035 class UT_TokenString;
00036
00037 #define TIL_NO_IMAGE_MATCH 0
00038 #define TIL_EXACT_MATCH 1
00039 #define TIL_SCALED_MATCH 2
00040
00041 class TIL_API TIL_SoftwareEmulState
00042 : public UT_SmallObject<TIL_SoftwareEmulState,
00043 UT_SMALLOBJECT_CLEANPAGES_OFF, 256,
00044 UT_SMALLOBJECT_THREADSAFE_ON>
00045 {
00046 public:
00047 TIL_SoftwareEmulState();
00048 TIL_SoftwareEmulState(const TIL_SoftwareEmulState ©);
00049 ~TIL_SoftwareEmulState();
00050
00051 int operator==(const TIL_SoftwareEmulState &) const;
00052 TIL_SoftwareEmulState &operator=(const TIL_SoftwareEmulState &);
00053
00054 void loadLUT();
00055
00056 bool isNeeded(TIL_DataFormat forformat);
00057
00058 char *myLUT;
00059 float myBlack;
00060 float myWhite;
00061 float myScale;
00062 float myShift;
00063 float myGamma;
00064 int myComponent;
00065 TIL_Lookup *myLookup;
00066 float myAspectRatio;
00067 unsigned my8Bit : 1,
00068 myHardAccel : 1,
00069 myHardLUT : 1;
00070 };
00071
00072
00073 class TIL_API TIL_ImageState
00074 : public UT_SmallObject<TIL_ImageState,
00075 UT_SMALLOBJECT_CLEANPAGES_OFF, 128,
00076 UT_SMALLOBJECT_THREADSAFE_ON>
00077 {
00078 public:
00079 TIL_ImageState();
00080 ~TIL_ImageState();
00081
00082 void setSource(TIL_ImageSource *source);
00083
00084 TIL_ImageState & operator=(const TIL_ImageState &);
00085 int operator==(const TIL_ImageState &) const;
00086 int fitsRequirements(const TIL_ImageState &,
00087 bool scaled = false) const;
00088
00089 void debugDump(ostream &os);
00090 public:
00091 TIL_ImageSource *mySource;
00092 int myVersion;
00093 TIL_SoftwareEmulState *myEmulation;
00094
00095 UT_String myName;
00096 TIL_Plane *myPlane;
00097 int myPlaneIndex;
00098 UT_TokenString *myID;
00099 TIL_Packing myPacking;
00100 int myFrameIndex;
00101
00102 float myBlack, myWhite;
00103
00104 int myXRes, myYRes;
00105 int myFullImage;
00106 int myStartU;
00107 int myEndU;
00108 int myStartV;
00109 int myEndV;
00110 float myGamma;
00111 float myAspect;
00112 float myVAspect;
00113 bool mySolidAlpha;
00114 };
00115
00116
00117 class TIL_API TIL_Image
00118 : public UT_SmallObject<TIL_Image,
00119 UT_SMALLOBJECT_CLEANPAGES_OFF, 256,
00120 UT_SMALLOBJECT_THREADSAFE_ON>
00121 {
00122 public:
00123 TIL_Image();
00124 ~TIL_Image();
00125
00126 void setRaster(TIL_Raster *r);
00127 TIL_Raster *getRaster() { return myMipRasters[0]; }
00128 TIL_Raster **getMipRasters() { return myMipRasters; }
00129 void clearRasters();
00130
00131 void setState(TIL_ImageState *state);
00132 TIL_ImageState *getState() { return myState; }
00133
00134 TIL_Image *&next() { return myNext; }
00135 TIL_Image *&prev() { return myPrev; }
00136
00137 void incRef();
00138 void decRef();
00139 int inUse() const;
00140 void clearUsage();
00141 void setObsolete(bool o = true) { myObsoleteFlag = o; }
00142 bool isObsolete() const { return myObsoleteFlag; }
00143
00144 int64 getSize() const;
00145
00146 void debugDump(ostream &os);
00147
00148 private:
00149
00150 TIL_Raster *myMipRasters[TIL_MIP_LEVELS];
00151
00152
00153 TIL_ImageState *myState;
00154
00155
00156 TIL_Image *myNext;
00157 TIL_Image *myPrev;
00158 int myRefCount;
00159 bool myObsoleteFlag;
00160 };
00161
00162
00163
00164 #endif