HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
IMG_Plane.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: IMG_Plane.h ( IMG Library, C++)
7  *
8  * COMMENTS:
9  * Description class of a single plane in a deep raster file.
10  * IMG_Stat contains a list of IMG_Plane structures.
11  */
12 #ifndef __IMG_PLANE_INFO_H__
13 #define __IMG_PLANE_INFO_H__
14 
15 #include "IMG_API.h"
16 
17 #include <SYS/SYS_Types.h>
18 #include <UT/UT_String.h>
19 #include <UT/UT_Rect.h>
20 #include <PXL/PXL_Common.h>
21 
22 #include "IMG_FileTypes.h"
23 
24 class IMG_Stat;
25 
26 /// @brief standard plane names.
28 {
29  static const char *Color; // "C"
30  static const char *Alpha; // "A"
31  static const char *Opacity; // "Of"
32  static const char *Depth; // "Pz"
33  static const char *Position; // "P"
34  static const char *Normal; // "N"
35 
36  /// For deep images, this plane contains the sample count for each pixel.
37  static const char *DepthComplexity; // "Depth-Complexity"
38 };
39 
40 /// @brief Describes the format and layout of a single plane in an image
41 /// The plane specifies the format and name of a single image plane in a deep
42 /// raster image. IMG_Stat contains a list of planes found in the image.
43 /// Non-deep raster formats only contain one plane.
45 {
46 public:
47  /// @{
48  /// Planes are generally not created by the user, but by
49  /// IMG_Stat::addPlane()
50  IMG_Plane();
51  IMG_Plane(const IMG_Plane &p);
52  IMG_Plane(const char *name, IMG_DataType dt, IMG_ColorModel cm,
53  int index);
54  /// @}
55 
56  /// Returns the amount of memory owned by this IMG_Plane object
57  int64 getMemoryUsage(bool inclusive) const;
58 
59  /// @{
60  /// plane name - must be unique in the list of planes found in IMG_Stat
61  void setName(const char *name);
62  const char *getName() const;
63  /// @}
64 
65  /// @{
66  /// data format of the individual pixel components (8bit - FP)
67  void setDataType(IMG_DataType dt);
68  IMG_DataType getDataType() const;
69  /// @}
70 
71  /// @{
72  /// color model of the pixel, which specifies the components per pixel.
73  /// (SINGLE_CHAN, RGB, RGBA)
74  void setColorModel(IMG_ColorModel cm);
75  IMG_ColorModel getColorModel() const;
76  /// @}
77 
78  /// @{
79  /// type info of the data contained in the plane. This is purely an
80  /// advisory indicator on how the data should be handled.
81  /// Note that this can affect the colorspace of the plane if not COLOR.
82  void setTypeInfo(IMG_TypeInfo ti);
83  IMG_TypeInfo getTypeInfo() const;
84  /// @}
85 
86  /// @{
87  /// colorspace of the image data in the plane. This helps determine how to
88  /// display the image data. If PXL_CS_UNKNOWN is returned, the format's
89  /// colorspace will be used instead. 'gamma' is only needed for
90  /// PXL_CS_CUSTOM_GAMMA.
91  void setColorSpace(PXL_ColorSpace cs, fpreal gamma = 0.0);
92  PXL_ColorSpace getColorSpace() const;
93  fpreal getColorSpaceGamma() const;
94  /// @}
95 
96  /// @{
97  /// Sets the individual component name(s) (default: r,g,b,a). Always call
98  /// after setColorModel().
99  void setComponentNames(const char *c1,
100  const char *c2=0,
101  const char *c3=0,
102  const char *c4=0);
103  void setComponentName(int comp, const char *name);
104 
105  /// Returns the name of the individual component of a pixel (r,g,b,a, x,y,z)
106  const char *getComponentName(int comp) const;
107  /// @}
108 
109 
110 
111  /// @{
112  /// Specifies black/white points for integer formats (not supported for FP)
113  /// always set the data type before setting the BW points.
114  /// The black and white points must be within the range of the intger data
115  /// format (ie, 8b - 0-255).
116  void setBlackWhitePoints(int64 b, int64 w);
117  bool hasBlackWhitePoints() const;
118  void getBlackWhitePoints(int64 &b, int64 &w) const;
119  /// @}
120 
121  /// the size of a single pixel, in bytes, including the data format and
122  /// the color model.
123  int getPixelSize() const;
124 
125  /// This is the index of this plane, in the list of planes found in
126  /// IMG_Stat (0 to getNumPlanes()-1).
127  int getPlaneIndex() const { return myIndex; }
128 
129  /// Returns the number of components this plane consists of.
130  int getComponentCount() const
131  { return IMGvectorSize(myColorModel); }
132 
133 private:
134  // only used by IMG_Stat.
135  void setParentStat(IMG_Stat *stat) { myStat = stat; }
136  void setPlaneIndex(int index) { myIndex = index; }
137  void updateComponentNames();
138 
139  // data members
140  UT_String myName;
141  UT_String myComponentNames[4];
142  int myIndex;
143 
144  IMG_DataType myDataType;
145  IMG_ColorModel myColorModel;
146  PXL_ColorSpace myColorSpace;
147  fpreal myColorSpaceGamma;
148  IMG_TypeInfo myTypeInfo;
149  int64 myBlackPoint;
150  int64 myWhitePoint;
151  IMG_Stat *myStat;
152 
153  friend class IMG_Stat;
154 };
155 
156 
157 
158 #endif
IMG_TypeInfo
How the channel data should be interpreted.
Definition: IMG_FileTypes.h:39
int getComponentCount() const
Returns the number of components this plane consists of.
Definition: IMG_Plane.h:130
static const char * Opacity
Definition: IMG_Plane.h:31
Describes the format and layout of a single plane in an image The plane specifies the format and name...
Definition: IMG_Plane.h:44
static const char * DepthComplexity
For deep images, this plane contains the sample count for each pixel.
Definition: IMG_Plane.h:37
static const char * Depth
Definition: IMG_Plane.h:32
long long int64
Definition: SYS_Types.h:106
#define IMG_API
Definition: IMG_API.h:10
static const char * Normal
Definition: IMG_Plane.h:34
IMG_DataType
Definition: IMG_FileTypes.h:17
standard plane names.
Definition: IMG_Plane.h:27
GLuint const GLchar * name
Definition: glcorearb.h:785
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
double fpreal
Definition: SYS_Types.h:269
GLuint index
Definition: glcorearb.h:785
PXL_ColorSpace
Definition: PXL_Common.h:42
IMG_ColorModel
Definition: IMG_FileTypes.h:53
static const char * Color
Definition: IMG_Plane.h:29
Contains the details of a specific image file, used by IMG_File. This class contains all the high-lev...
Definition: IMG_Stat.h:40
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
static const char * Alpha
Definition: IMG_Plane.h:30
int getPlaneIndex() const
Definition: IMG_Plane.h:127
static const char * Position
Definition: IMG_Plane.h:33