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 #include "TIL_Defines.h"
16 #include <UT/UT_NonCopyable.h>
17 #include <UT/UT_SmallObject.h>
18 #include <UT/UT_String.h>
19 #include <iosfwd>
20 
21 class TIL_ImageSource;
22 class TIL_Plane;
23 class TIL_Raster;
24 class TIL_Lookup;
25 class UT_TokenString;
26 
27 #define TIL_MIP_LEVELS 5
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(const TIL_ImageState &) = delete;
42  ~TIL_ImageState();
43 
44  int64 getMemoryUsage(bool inclusive) const;
45 
47 
49  int operator==(const TIL_ImageState &) const;
50  int fitsRequirements(const TIL_ImageState &,
51  bool scaled = false) const;
52 
53  void debugDump(std::ostream &os);
54 public:
56  int myVersion;
57 
64 
65  float myBlack, myWhite;
66 
67  exint myXRes, myYRes;
73  float myGamma;
74  float myAspect;
75  float myVAspect;
77 };
78 
79 
81  : public UT_SmallObject<TIL_Image,
82  UT_SMALLOBJECT_CLEANPAGES_OFF, 256,
83  UT_SMALLOBJECT_THREADSAFE_ON>
84 {
85 public:
86  TIL_Image();
87  ~TIL_Image();
88 
90 
91  void setRaster(TIL_Raster *r);
92  TIL_Raster *getRaster() { return myMipRasters[0]; }
93  TIL_Raster **getMipRasters() { return myMipRasters; }
94  void clearRasters();
95 
96  void setState(TIL_ImageState *state);
97  TIL_ImageState *getState() { return myState; }
98 
99  TIL_Image *&next() { return myNext; }
100  TIL_Image *&prev() { return myPrev; }
101 
102  void incRef();
103  void decRef();
104  int inUse() const;
105  void clearUsage();
106  void setObsolete(bool o = true) { myObsoleteFlag = o; }
107  bool isObsolete() const { return myObsoleteFlag; }
108 
109  int64 getMemoryUsage(bool inclusive) const;
110 
111  void debugDump(std::ostream &os);
112 
113 private:
114  // the image raster.
115  TIL_Raster *myMipRasters[TIL_MIP_LEVELS];
116 
117  // raster identification.
118  TIL_ImageState *myState;
119 
120  // don't touch.
121  TIL_Image *myNext;
122  TIL_Image *myPrev;
123  int myRefCount;
124  bool myObsoleteFlag;
125 };
126 
127 
128 
129 #endif
bool isObsolete() const
Definition: TIL_Image.h:107
TIL_Raster * getRaster()
Definition: TIL_Image.h:92
exint myEndU
Definition: TIL_Image.h:70
TIL_Packing myPacking
Definition: TIL_Image.h:62
TIL_Image *& prev()
Definition: TIL_Image.h:100
int64 exint
Definition: SYS_Types.h:125
TIL_Image *& next()
Definition: TIL_Image.h:99
#define TIL_Lookup
Definition: TIL_Defines.h:24
void setObsolete(bool o=true)
Definition: TIL_Image.h:106
#define TIL_Packing
Definition: TIL_Defines.h:73
float myGamma
Definition: TIL_Image.h:73
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
exint myStartU
Definition: TIL_Image.h:69
TIL_ImageState * getState()
Definition: TIL_Image.h:97
exint myPlaneIndex
Definition: TIL_Image.h:60
UT_TokenString * myID
Definition: TIL_Image.h:61
int myFrameIndex
Definition: TIL_Image.h:63
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
long long int64
Definition: SYS_Types.h:116
UT_String myName
Definition: TIL_Image.h:58
float myAspect
Definition: TIL_Image.h:74
exint myStartV
Definition: TIL_Image.h:71
float myWhite
Definition: TIL_Image.h:65
TIL_ImageSource * mySource
Definition: TIL_Image.h:55
LeafData & operator=(const LeafData &)=delete
GLboolean r
Definition: glcorearb.h:1222
int setSource(int source) override
exint myYRes
Definition: TIL_Image.h:67
#define TIL_API
Definition: TIL_API.h:10
#define TIL_MIP_LEVELS
Definition: TIL_Image.h:27
float myVAspect
Definition: TIL_Image.h:75
bool mySolidAlpha
Definition: TIL_Image.h:76
exint myEndV
Definition: TIL_Image.h:72
TIL_Raster ** getMipRasters()
Definition: TIL_Image.h:93
TIL_Plane * myPlane
Definition: TIL_Image.h:59