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  /// Used to tell if postprocessing on the image source has changed.
58  /// A value of -1 indicates that no postprocessor was run on the image.
59  /// @see TIL_ImageSourcePostprocessor
61 
68 
69  float myBlack, myWhite;
70 
71  exint myXRes, myYRes;
77  float myGamma;
78  float myAspect;
79  float myVAspect;
81 };
82 
83 
85  : public UT_SmallObject<TIL_Image,
86  UT_SMALLOBJECT_CLEANPAGES_OFF, 256,
87  UT_SMALLOBJECT_THREADSAFE_ON>
88 {
89 public:
90  TIL_Image();
91  ~TIL_Image();
92 
94 
95  void setRaster(TIL_Raster *r);
96  TIL_Raster *getRaster() { return myMipRasters[0]; }
97  UT_Array<TIL_Raster*>& getMipRasters() { return myMipRasters; }
98  void clearRasters();
99 
100  void setState(TIL_ImageState *state);
101  TIL_ImageState *getState() { return myState; }
102 
103  TIL_Image *&next() { return myNext; }
104  TIL_Image *&prev() { return myPrev; }
105 
106  void incRef();
107  void decRef();
108  int inUse() const;
109  void clearUsage();
110  void setObsolete(bool o = true) { myObsoleteFlag = o; }
111  bool isObsolete() const { return myObsoleteFlag; }
112 
113  int64 getMemoryUsage(bool inclusive) const;
114 
115  void debugDump(std::ostream &os);
116 
117 private:
118  // the image raster.
120 
121  // raster identification.
122  TIL_ImageState *myState;
123 
124  // don't touch.
125  TIL_Image *myNext;
126  TIL_Image *myPrev;
127  int myRefCount;
128  bool myObsoleteFlag;
129 };
130 
131 
132 
133 #endif
bool isObsolete() const
Definition: TIL_Image.h:111
TIL_Raster * getRaster()
Definition: TIL_Image.h:96
exint myEndU
Definition: TIL_Image.h:74
TIL_Packing myPacking
Definition: TIL_Image.h:66
TIL_Image *& prev()
Definition: TIL_Image.h:104
int64 exint
Definition: SYS_Types.h:125
TIL_Image *& next()
Definition: TIL_Image.h:103
#define TIL_Lookup
Definition: TIL_Defines.h:25
int myPostprocessVersion
Definition: TIL_Image.h:60
void setObsolete(bool o=true)
Definition: TIL_Image.h:110
#define TIL_Packing
Definition: TIL_Defines.h:72
float myGamma
Definition: TIL_Image.h:77
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
exint myStartU
Definition: TIL_Image.h:73
TIL_ImageState * getState()
Definition: TIL_Image.h:101
exint myPlaneIndex
Definition: TIL_Image.h:64
UT_TokenString * myID
Definition: TIL_Image.h:65
int myFrameIndex
Definition: TIL_Image.h:67
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:62
float myAspect
Definition: TIL_Image.h:78
exint myStartV
Definition: TIL_Image.h:75
float myWhite
Definition: TIL_Image.h:69
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:71
#define TIL_API
Definition: TIL_API.h:10
#define TIL_MIP_LEVELS
Definition: TIL_Image.h:27
float myVAspect
Definition: TIL_Image.h:79
state
Definition: core.h:2289
bool mySolidAlpha
Definition: TIL_Image.h:80
exint myEndV
Definition: TIL_Image.h:76
UT_Array< TIL_Raster * > & getMipRasters()
Definition: TIL_Image.h:97
TIL_Plane * myPlane
Definition: TIL_Image.h:63