HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TIL_Image.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: TIL_Image.h (IMGUI library, C++)
7  *
8  * COMMENTS:
9  * Cacheable raster definition for the image viewer cache.
10  */
11 #ifndef __TIL_Image__
12 #define __TIL_Image__
13 
14 #include "TIL_API.h"
15 
16 #define TIL_MIP_LEVELS 5
17 
18 #include <iosfwd>
19 #include <UT/UT_SmallObject.h>
20 #include <UT/UT_String.h>
21 #include "TIL_Defines.h"
22 
23 class TIL_ImageSource;
24 class TIL_Plane;
25 class TIL_Raster;
26 class TIL_Lookup;
27 class UT_TokenString;
28 
29 #define TIL_NO_IMAGE_MATCH 0
30 #define TIL_EXACT_MATCH 1
31 #define TIL_SCALED_MATCH 2
32 
33 // describes the full state of the raster.
35  : public UT_SmallObject<TIL_ImageState,
36  UT_SMALLOBJECT_CLEANPAGES_OFF, 128,
37  UT_SMALLOBJECT_THREADSAFE_ON>
38 {
39 public:
41  ~TIL_ImageState();
42 
43  int64 getMemoryUsage(bool inclusive) const;
44 
46 
47  TIL_ImageState & operator=(const TIL_ImageState &);
48  int operator==(const TIL_ImageState &) const;
49  int fitsRequirements(const TIL_ImageState &,
50  bool scaled = false) const;
51 
52  void debugDump(std::ostream &os);
53 public:
55  int myVersion;
56 
63 
64  float myBlack, myWhite;
65 
66  exint myXRes, myYRes;
72  float myGamma;
73  float myAspect;
74  float myVAspect;
76 };
77 
78 
80  : public UT_SmallObject<TIL_Image,
81  UT_SMALLOBJECT_CLEANPAGES_OFF, 256,
82  UT_SMALLOBJECT_THREADSAFE_ON>
83 {
84 public:
85  TIL_Image();
86  ~TIL_Image();
87 
88  void setRaster(TIL_Raster *r);
89  TIL_Raster *getRaster() { return myMipRasters[0]; }
90  TIL_Raster **getMipRasters() { return myMipRasters; }
91  void clearRasters();
92 
93  void setState(TIL_ImageState *state);
94  TIL_ImageState *getState() { return myState; }
95 
96  TIL_Image *&next() { return myNext; }
97  TIL_Image *&prev() { return myPrev; }
98 
99  void incRef();
100  void decRef();
101  int inUse() const;
102  void clearUsage();
103  void setObsolete(bool o = true) { myObsoleteFlag = o; }
104  bool isObsolete() const { return myObsoleteFlag; }
105 
106  int64 getMemoryUsage(bool inclusive) const;
107 
108  void debugDump(std::ostream &os);
109 
110 private:
111  // the image raster.
112  TIL_Raster *myMipRasters[TIL_MIP_LEVELS];
113 
114  // raster identification.
115  TIL_ImageState *myState;
116 
117  // don't touch.
118  TIL_Image *myNext;
119  TIL_Image *myPrev;
120  int myRefCount;
121  bool myObsoleteFlag;
122 };
123 
124 
125 
126 #endif
bool isObsolete() const
Definition: TIL_Image.h:104
TIL_Raster * getRaster()
Definition: TIL_Image.h:89
exint myEndU
Definition: TIL_Image.h:69
TIL_Packing myPacking
Definition: TIL_Image.h:61
TIL_Image *& prev()
Definition: TIL_Image.h:97
TIL_Image *& next()
Definition: TIL_Image.h:96
#define TIL_Lookup
Definition: TIL_Defines.h:23
void setObsolete(bool o=true)
Definition: TIL_Image.h:103
#define TIL_Packing
Definition: TIL_Defines.h:72
float myGamma
Definition: TIL_Image.h:72
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
long long int64
Definition: SYS_Types.h:107
exint myStartU
Definition: TIL_Image.h:68
TIL_ImageState * getState()
Definition: TIL_Image.h:94
exint myPlaneIndex
Definition: TIL_Image.h:59
UT_TokenString * myID
Definition: TIL_Image.h:60
int myFrameIndex
Definition: TIL_Image.h:62
int64 exint
Definition: SYS_Types.h:116
virtual int setSource(int source)
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:802
UT_String myName
Definition: TIL_Image.h:57
float myAspect
Definition: TIL_Image.h:73
exint myStartV
Definition: TIL_Image.h:70
float myWhite
Definition: TIL_Image.h:64
TIL_ImageSource * mySource
Definition: TIL_Image.h:54
GLboolean r
Definition: glcorearb.h:1221
exint myYRes
Definition: TIL_Image.h:66
#define TIL_API
Definition: TIL_API.h:10
#define TIL_MIP_LEVELS
Definition: TIL_Image.h:16
float myVAspect
Definition: TIL_Image.h:74
bool mySolidAlpha
Definition: TIL_Image.h:75
exint myEndV
Definition: TIL_Image.h:71
TIL_Raster ** getMipRasters()
Definition: TIL_Image.h:90
TIL_Plane * myPlane
Definition: TIL_Image.h:58