HDK
|
Contains the details of a specific image file, used by IMG_File. This class contains all the high-level details needed to save an image file, or query a loaded image file's statistics. It contains such data as the resolution, pixel aspect ratios, data formats and image planes. The set() methods are used when creating a new IMG_Stat for writing an image file, while the get() methods are generally used when reading. More...
#include <IMG_Stat.h>
Public Types | |
using | img_DeepStatPtr = UT_SharedPtr< IMG_DeepStat > |
Public Member Functions | |
IMG_Stat () | |
IMG_Stat (unsigned xres, unsigned yres) | |
IMG_Stat (unsigned xres, unsigned yres, IMG_DataType dt, IMG_ColorModel cm) | |
IMG_Stat (const IMG_Stat &s) | |
~IMG_Stat () | |
int64 | getMemoryUsage (bool inclusive) const |
IMG_Stat & | operator= (const IMG_Stat &s) |
void | copy (const IMG_Stat &src) |
void | addEnvMapPlanes (IMG_DataType dt, IMG_ColorModel cm) |
bool | isEnvMap () const |
isEnvMap() will return true, only if the image is an environment map. More... | |
bool | setEnvMap () |
void | reorderPlane (IMG_Plane *plane, int beforeindex) |
Alters the order of planes in the stat. More... | |
int | getDataWidth () const |
int | getDataHeight () const |
int | getNumFrames () const |
void | setNumFrames (int nf) |
fpreal | getFPS () const |
void | setFPS (fpreal fps) |
void | setMetadataKey (const UT_StringHolder &k) |
Set the default metadata key for the format. More... | |
const UT_StringHolder & | metadataKey () const |
Get the format's default metadata key. More... | |
bool | metadataAsString (const UT_StringRef &key, UT_StringHolder &value, bool pretty_print) const |
void | setTypedMetadata (const UT_StringHolder &name, const char *val) |
Obsolete interface to set metadata based on a "typed" string. More... | |
fpreal | getRenderTime () const |
void | setRenderTime (fpreal t) |
Sets the render time from the image file. More... | |
bool | importTextureWrapModes (UT_StringHolder &swrap, UT_StringHolder &twrap) const |
Import the texture wrap modes from image metadata. More... | |
int64 | getRenderMemory () const |
void | setRenderMemory (int64 mem) |
Sets the render time from the image file. More... | |
int64 | getComponentCount () const |
Returns the total number of components across all planes. More... | |
int64 | getDeepPixelComponentCount () const |
int64 | bytesPerPixel () const |
Returns the number of bytes for a single pixel made up of all planes. More... | |
int64 | bytesPerImage () const |
int64 | bytesPerScanline () const |
void | setColorSpace (PXL_ColorSpace cs, fpreal gamma=0.0) |
void | setColorSpaceForUnknownPlanes (PXL_ColorSpace cs, fpreal gamma=0.0) |
void | setOCIOColorSpace (const UT_StringHolder &space) |
Set the OCIO color space for all planes. More... | |
int | getMipLevel () const |
void | setMipLevel (int n) |
IMG_MipRoundMode | getMipRoundMode () const |
void | setMipRoundMode (IMG_MipRoundMode mode) |
void | dump () const |
void | dump (UT_JSONWriter &w) const |
void | setImageType (IMG_ImageType it) |
IMG_ImageType | getImageType () const |
void | setResolution (unsigned xres, unsigned yres) |
unsigned | getXres () const |
unsigned | getYres () const |
void | setAspectRatio (fpreal aspect) |
fpreal | getAspectRatio () const |
void | setFilename (const char *name) |
const UT_String & | getFilename () const |
int | getNumPlanes () const |
Returns the number of image planes in the image a plane contains the actual structure of the image data. An image needs at least one. Deep rasters can have multiple planes. More... | |
IMG_Plane * | getPlane (int i=0) const |
Get an image plane by index. More... | |
IMG_Plane * | getPlaneName (const char *name) const |
Get an image plane by name Returns the plane with name 'name', or NULL if no matching plane is found. More... | |
int | getPlaneIndex (const char *name) const |
Returns the index of the plane with 'name' Returns the index of the plane with name 'name', or -1 if not found. More... | |
void | removePlane (int pindex) |
void | removePlane (const char *name) |
Remove a plane by index from the stat. Used only for writing files. More... | |
void | removeAllPlanes () |
Remove all planes from the stat. Used only for writing files. More... | |
void | swapPlaneOrder (int plane_a, int plane_b) |
void | swapPlaneOrder (const IMG_Plane *p, int plane_b) |
void | setDataWindow (const UT_DimRect &win) |
Manipulate the data window of an image. The data window is constant across all planes. It may be smaller than the actual resolution (crop region) or larger. The data window is inclusive in that x2 and y2 are part of the region. You can also use the UT_DimRect versions for easier manipulations of the area. Image data is only defined for the area contained by the data window. By default, it is (0,0) - (xres-1, yres-1) (the entire image). More... | |
void | setDataWindow (int x1, int y1, int x2, int y2) |
Manipulate the data window of an image. The data window is constant across all planes. It may be smaller than the actual resolution (crop region) or larger. The data window is inclusive in that x2 and y2 are part of the region. You can also use the UT_DimRect versions for easier manipulations of the area. Image data is only defined for the area contained by the data window. By default, it is (0,0) - (xres-1, yres-1) (the entire image). More... | |
void | clearDataWindow () |
Manipulate the data window of an image. The data window is constant across all planes. It may be smaller than the actual resolution (crop region) or larger. The data window is inclusive in that x2 and y2 are part of the region. You can also use the UT_DimRect versions for easier manipulations of the area. Image data is only defined for the area contained by the data window. By default, it is (0,0) - (xres-1, yres-1) (the entire image). More... | |
void | getDataWindow (UT_DimRect &r) const |
Get the data window of an image. More... | |
void | getDataWindow (int &x1, int &y1, int &x2, int &y2) const |
Get the data window of an image. More... | |
const UT_DimRect & | getDataWindow () const |
Return the data window for the image. More... | |
bool | hasDataWindow () const |
Returns true if the image has a data window. More... | |
void | setBackgroundColor (fpreal col[4]) |
void | getBackgroundColor (fpreal col[4]) const |
void | setBackgroundStreak (bool streak) |
bool | getBackgroundStreak () const |
IMG_Metadata & | metadata () |
const IMG_Metadata & | metadata () const |
bool | findMetadata (const UT_StringRef &key, IMG_MetadataItem &value) const |
IMG_Metadata::const_iterator | beginMetadata () const |
IMG_Metadata::const_iterator | endMetadata () const |
bool | importMetadata (const UT_StringRef &key, bool &val) const |
bool | importMetadata (const UT_StringRef &key, int32 &val) const |
bool | importMetadata (const UT_StringRef &key, int64 &val) const |
bool | importMetadata (const UT_StringRef &key, fpreal32 &val) const |
bool | importMetadata (const UT_StringRef &key, fpreal64 &val) const |
bool | importMetadata (const UT_StringRef &key, UT_Matrix4F &val) const |
bool | importMetadata (const UT_StringRef &key, UT_Matrix4D &val) const |
bool | importMetadata (const UT_StringRef &key, UT_StringHolder &val) const |
bool | setMetadata (const UT_StringHolder &key, const IMG_MetadataItem &item) |
bool | setMetadata (const UT_StringHolder &key, const UT_JSONValue &val) |
bool | setMetadata (const UT_StringHolder &key, bool val) |
bool | setMetadata (const UT_StringHolder &key, int64 val) |
bool | setMetadata (const UT_StringHolder &key, fpreal64 val) |
bool | setMetadata (const UT_StringHolder &key, const UT_StringHolder &val) |
void | setDeepStat (const img_DeepStatPtr &deep) |
Set how deep samples are interpolated. More... | |
const img_DeepStatPtr & | getDeepStat () const |
Set how deep samples are interpolated. More... | |
int64 | bytesPerPlaneScan (const IMG_Plane &pi) const |
int64 | bytesPerPlaneScan (int i) const |
int | planeOffset (const IMG_Plane &pi) const |
int | planeOffset (int i) const |
Static Public Member Functions | |
static bool | splitTextureWrapModes (const UT_StringRef &wrapmodes, UT_StringHolder &swrap, UT_StringHolder &twrap) |
Parse the "wrapmodes" metadata into the constituent parts. More... | |
static const char * | getColorModel (IMG_ColorModel cm) |
static const char * | getDataType (IMG_DataType dt) |
Protected Member Functions | |
void | recomputeOffsets () |
Friends | |
class | IMG_Plane |
IMG_Plane * | addPlane (const char *name, IMG_DataType d, IMG_ColorModel cm, const char *c0name=0, const char *c1name=0, const char *c2name=0, const char *c3name=0) |
Add a plane to an image file. Add a plane to the image file. This is only used when writing files. Plane names must be unique. To write a file, at least one plane must be present. More... | |
IMG_Plane * | addDefaultPlane () |
Add a default 8bit, RGBA plane to the image. More... | |
Contains the details of a specific image file, used by IMG_File. This class contains all the high-level details needed to save an image file, or query a loaded image file's statistics. It contains such data as the resolution, pixel aspect ratios, data formats and image planes. The set() methods are used when creating a new IMG_Stat for writing an image file, while the get() methods are generally used when reading.
Definition at line 38 of file IMG_Stat.h.
Definition at line 41 of file IMG_Stat.h.
IMG_Stat::IMG_Stat | ( | ) |
IMG_Stat::IMG_Stat | ( | unsigned | xres, |
unsigned | yres | ||
) |
Sets up the resolution of the image. addPlane() or addDefaultPlane() must be called to fill out the AOVs.
IMG_Stat::IMG_Stat | ( | unsigned | xres, |
unsigned | yres, | ||
IMG_DataType | dt, | ||
IMG_ColorModel | cm | ||
) |
sets up a single image plane format, without requiring addPlane(). Don't use this for deep raster images.
IMG_Stat::IMG_Stat | ( | const IMG_Stat & | s | ) |
IMG_Stat::~IMG_Stat | ( | ) |
|
inline |
Add a default 8bit, RGBA plane to the image.
Definition at line 140 of file IMG_Stat.h.
void IMG_Stat::addEnvMapPlanes | ( | IMG_DataType | dt, |
IMG_ColorModel | cm | ||
) |
Adds 6 planes named Left, Right, Top, Bottom, Front and Back, all using the same image format.
IMG_Plane* IMG_Stat::addPlane | ( | const char * | name, |
IMG_DataType | d, | ||
IMG_ColorModel | cm, | ||
const char * | c0name = 0 , |
||
const char * | c1name = 0 , |
||
const char * | c2name = 0 , |
||
const char * | c3name = 0 |
||
) |
Add a plane to an image file. Add a plane to the image file. This is only used when writing files. Plane names must be unique. To write a file, at least one plane must be present.
|
inline |
Metadata iterator
Definition at line 251 of file IMG_Stat.h.
|
inline |
Returns the total number of bytes for the entire image. Returns -1 for deep images, since the size is dependent on sample count.
Definition at line 455 of file IMG_Stat.h.
int64 IMG_Stat::bytesPerPixel | ( | ) | const |
Returns the number of bytes for a single pixel made up of all planes.
Returns the number bytes for a single scanline. Returns -1 for deep images, since the size is dependent on sample count.
Returns the number bytes for a single scanline. Returns -1 for deep images, since the size is dependent on sample count.
|
inline |
Returns the total number of bytes for a single scanline. Returns -1 for deep images, since the size is dependent on sample count.
Definition at line 449 of file IMG_Stat.h.
void IMG_Stat::clearDataWindow | ( | ) |
Manipulate the data window of an image. The data window is constant across all planes. It may be smaller than the actual resolution (crop region) or larger. The data window is inclusive in that x2 and y2 are part of the region. You can also use the UT_DimRect versions for easier manipulations of the area. Image data is only defined for the area contained by the data window. By default, it is (0,0) - (xres-1, yres-1) (the entire image).
void IMG_Stat::dump | ( | ) | const |
void IMG_Stat::dump | ( | UT_JSONWriter & | w | ) | const |
|
inline |
Metadata iterator
Definition at line 253 of file IMG_Stat.h.
|
inline |
Access metadata
Definition at line 238 of file IMG_Stat.h.
|
inline |
Pixel aspect ratio of the file (X/Y). Square pixels are 1.0 (default).
Definition at line 96 of file IMG_Stat.h.
The image data outside the data window can be represented one of two ways: with a constant color, or by streaking the edges of the window.
|
inline |
The image data outside the data window can be represented one of two ways: with a constant color, or by streaking the edges of the window.
Definition at line 210 of file IMG_Stat.h.
|
static |
int64 IMG_Stat::getComponentCount | ( | ) | const |
Returns the total number of components across all planes.
int IMG_Stat::getDataHeight | ( | ) | const |
This returns the height of the image. If no data window is present, then this is Yres. If a data window is present, then this is the height of the data window.
|
static |
int IMG_Stat::getDataWidth | ( | ) | const |
This returns the width of the image. If no data window is present, then this is Xres. If a data window is present, then this is the width of the data window.
void IMG_Stat::getDataWindow | ( | UT_DimRect & | r | ) | const |
Get the data window of an image.
Get the data window of an image.
|
inline |
Return the data window for the image.
Definition at line 197 of file IMG_Stat.h.
int64 IMG_Stat::getDeepPixelComponentCount | ( | ) | const |
Returns the number of components for the deep pixel image. This excludes any pseudo-planes, such as "Depth-Complexity".
|
inline |
Set how deep samples are interpolated.
Definition at line 333 of file IMG_Stat.h.
|
inline |
filename of the opened file. Files attached to streams may not have a filename.
Definition at line 104 of file IMG_Stat.h.
|
inline |
Definition at line 230 of file IMG_Stat.h.
|
inline |
Read/write image a specific mode. If the format does not support it, or the image being read is not of that type, IMG_File::open or IMG_File::create calls will fail. The default value is IMG_TYPE_2D.
Definition at line 73 of file IMG_Stat.h.
int64 IMG_Stat::getMemoryUsage | ( | bool | inclusive | ) | const |
|
inline |
Definition at line 390 of file IMG_Stat.h.
|
inline |
Definition at line 394 of file IMG_Stat.h.
|
inline |
Definition at line 224 of file IMG_Stat.h.
SYS_FORCE_INLINE int IMG_Stat::getNumPlanes | ( | ) | const |
Returns the number of image planes in the image a plane contains the actual structure of the image data. An image needs at least one. Deep rasters can have multiple planes.
Definition at line 436 of file IMG_Stat.h.
Get an image plane by index.
Definition at line 442 of file IMG_Stat.h.
int IMG_Stat::getPlaneIndex | ( | const char * | name | ) | const |
Returns the index of the plane with 'name' Returns the index of the plane with name 'name', or -1 if not found.
IMG_Plane* IMG_Stat::getPlaneName | ( | const char * | name | ) | const |
Get an image plane by name Returns the plane with name 'name', or NULL if no matching plane is found.
|
inline |
If the image file has a recorded render memory, this returns the render memory, else it returns 0.
Definition at line 325 of file IMG_Stat.h.
|
inline |
If the image file has a recorded render time, this returns the render time, else it returns -1.
Definition at line 311 of file IMG_Stat.h.
|
inline |
Returns the resolution of the image to be written or the one that was read.
Definition at line 89 of file IMG_Stat.h.
|
inline |
Sets the resolution for the image, if not specified by the constructor.
Definition at line 90 of file IMG_Stat.h.
bool IMG_Stat::hasDataWindow | ( | ) | const |
Returns true if the image has a data window.
|
inline |
Import metadata
Definition at line 259 of file IMG_Stat.h.
|
inline |
Import metadata
Definition at line 261 of file IMG_Stat.h.
|
inline |
Import metadata
Definition at line 263 of file IMG_Stat.h.
|
inline |
Import metadata
Definition at line 265 of file IMG_Stat.h.
|
inline |
Import metadata
Definition at line 267 of file IMG_Stat.h.
|
inline |
Import metadata
Definition at line 269 of file IMG_Stat.h.
|
inline |
Import metadata
Definition at line 271 of file IMG_Stat.h.
|
inline |
Import metadata
Definition at line 273 of file IMG_Stat.h.
bool IMG_Stat::importTextureWrapModes | ( | UT_StringHolder & | swrap, |
UT_StringHolder & | twrap | ||
) | const |
Import the texture wrap modes from image metadata.
|
inline |
isEnvMap() will return true, only if the image is an environment map.
Definition at line 149 of file IMG_Stat.h.
|
inline |
Access metadata
Definition at line 236 of file IMG_Stat.h.
|
inline |
Access metadata
Definition at line 237 of file IMG_Stat.h.
|
inline |
Convert metadata to a string value. When pretty_print
is true:
Definition at line 281 of file IMG_Stat.h.
|
inline |
Get the format's default metadata key.
Definition at line 247 of file IMG_Stat.h.
Definition at line 59 of file IMG_Stat.h.
For 2D images, returns the offset into the data for a plane in a given scanline. Plane data is arranged consecutively by scanline. For deep images, returns the offset into a pixel sample for a given plane's data. Planes are interleaved by a pixel sample.
For 2D images, returns the offset into the data for a plane in a given scanline. Plane data is arranged consecutively by scanline. For deep images, returns the offset into a pixel sample for a given plane's data. Planes are interleaved by a pixel sample.
|
protected |
void IMG_Stat::removeAllPlanes | ( | ) |
Remove all planes from the stat. Used only for writing files.
Remove a plane by index from the stat. Used only for writing files.
void IMG_Stat::removePlane | ( | const char * | name | ) |
Remove a plane by index from the stat. Used only for writing files.
Alters the order of planes in the stat.
Pixel aspect ratio of the file (X/Y). Square pixels are 1.0 (default).
Definition at line 95 of file IMG_Stat.h.
The image data outside the data window can be represented one of two ways: with a constant color, or by streaking the edges of the window.
|
inline |
The image data outside the data window can be represented one of two ways: with a constant color, or by streaking the edges of the window.
Definition at line 208 of file IMG_Stat.h.
void IMG_Stat::setColorSpace | ( | PXL_ColorSpace | cs, |
fpreal | gamma = 0.0 |
||
) |
Sets the color space for all planes. gamma is only needed for the PXL_CS_CUSTOM_GAMMA space.
void IMG_Stat::setColorSpaceForUnknownPlanes | ( | PXL_ColorSpace | cs, |
fpreal | gamma = 0.0 |
||
) |
Set the color space on planes with an unknown color space to 'cs'. gamma is only needed for the PXL_CS_CUSTOM_GAMMA space.
void IMG_Stat::setDataWindow | ( | const UT_DimRect & | win | ) |
Manipulate the data window of an image. The data window is constant across all planes. It may be smaller than the actual resolution (crop region) or larger. The data window is inclusive in that x2 and y2 are part of the region. You can also use the UT_DimRect versions for easier manipulations of the area. Image data is only defined for the area contained by the data window. By default, it is (0,0) - (xres-1, yres-1) (the entire image).
Manipulate the data window of an image. The data window is constant across all planes. It may be smaller than the actual resolution (crop region) or larger. The data window is inclusive in that x2 and y2 are part of the region. You can also use the UT_DimRect versions for easier manipulations of the area. Image data is only defined for the area contained by the data window. By default, it is (0,0) - (xres-1, yres-1) (the entire image).
|
inline |
Set how deep samples are interpolated.
Definition at line 331 of file IMG_Stat.h.
bool IMG_Stat::setEnvMap | ( | ) |
Sets the environment flag, if the image planes can be treated as an environment map.
|
inline |
filename of the opened file. Files attached to streams may not have a filename.
Definition at line 103 of file IMG_Stat.h.
Definition at line 232 of file IMG_Stat.h.
void IMG_Stat::setImageType | ( | IMG_ImageType | it | ) |
Read/write image a specific mode. If the format does not support it, or the image being read is not of that type, IMG_File::open or IMG_File::create calls will fail. The default value is IMG_TYPE_2D.
|
inline |
Set metadata
Definition at line 290 of file IMG_Stat.h.
|
inline |
Set metadata
Definition at line 292 of file IMG_Stat.h.
|
inline |
Set metadata
Definition at line 294 of file IMG_Stat.h.
|
inline |
Set metadata
Definition at line 296 of file IMG_Stat.h.
|
inline |
Set metadata
Definition at line 298 of file IMG_Stat.h.
|
inline |
Set metadata
Definition at line 300 of file IMG_Stat.h.
|
inline |
Set the default metadata key for the format.
Definition at line 244 of file IMG_Stat.h.
Definition at line 391 of file IMG_Stat.h.
|
inline |
Definition at line 395 of file IMG_Stat.h.
Definition at line 227 of file IMG_Stat.h.
void IMG_Stat::setOCIOColorSpace | ( | const UT_StringHolder & | space | ) |
Set the OCIO color space for all planes.
Sets the render time from the image file.
Definition at line 327 of file IMG_Stat.h.
Sets the render time from the image file.
Definition at line 313 of file IMG_Stat.h.
|
inline |
Sets the resolution for the image, if not specified by the constructor.
Definition at line 78 of file IMG_Stat.h.
|
inline |
Obsolete interface to set metadata based on a "typed" string.
Definition at line 306 of file IMG_Stat.h.
|
static |
Parse the "wrapmodes" metadata into the constituent parts.
Swap two planes
Definition at line 175 of file IMG_Stat.h.
Definition at line 402 of file IMG_Stat.h.