HioImage Class Referenceabstract

A base class for reading and writing texture image data. More...

Classes

class  StorageSpec
 Describes the memory layout and storage of a texture image. More...
 

Public Types

enum  ImageOriginLocation { OriginUpperLeft, OriginLowerLeft }
 Specifies whether to treat the image origin as the upper-left corner or the lower left. More...
 
enum  SourceColorSpace { Raw, SRGB, Auto }
 Specifies the source color space in which the texture is encoded, with "Auto" indicating the texture reader should determine color space based on hints from the image (e.g. More...
 

Public Member Functions

 HioImage (const HioImage &)=delete
 
HioImageoperator= (const HioImage &)=delete
 

Static Public Member Functions

static HIO_API bool IsSupportedImageFile (std::string const &filename)
 Returns whether filename opened as a texture image. More...
 

Reading

{@

virtual bool Read (StorageSpec const &storage)=0
 Reads the image file into storage. More...
 
virtual bool ReadCropped (int const cropTop, int const cropBottom, int const cropLeft, int const cropRight, StorageSpec const &storage)=0
 Reads the cropped sub-image into storage. More...
 
static HIO_API HioImageSharedPtr OpenForReading (std::string const &filename, int subimage=0, int mip=0, SourceColorSpace sourceColorSpace=SourceColorSpace::Auto, bool suppressErrors=false)
 Opens filename for reading from the given subimage at mip level mip, using sourceColorSpace to help determine the color space with which to interpret the texture. More...
 

Writing

}@

{@

virtual bool Write (StorageSpec const &storage, VtDictionary const &metadata=VtDictionary())=0
 Writes the image with metadata. More...
 
virtual std::string const & GetFilename () const =0
 }@ More...
 
virtual int GetWidth () const =0
 Returns the image width. More...
 
virtual int GetHeight () const =0
 Returns the image height. More...
 
virtual HioFormat GetFormat () const =0
 Returns the destination HioFormat. More...
 
virtual int GetBytesPerPixel () const =0
 Returns the number of bytes per pixel. More...
 
virtual int GetNumMipLevels () const =0
 Returns the number of mips available. More...
 
virtual bool IsColorSpaceSRGB () const =0
 Returns whether the image is in the sRGB color space. More...
 
static HIO_API HioImageSharedPtr OpenForWriting (std::string const &filename)
 Opens filename for writing from the given storage. More...
 

Metadata

{@

template<typename T >
bool GetMetadata (TfToken const &key, T *value) const
 
virtual bool GetMetadata (TfToken const &key, VtValue *value) const =0
 
virtual bool GetSamplerMetadata (HioAddressDimension dim, HioAddressMode *param) const =0
 
virtual bool _OpenForReading (std::string const &filename, int subimage, int mip, SourceColorSpace sourceColorSpace, bool suppressErrors)=0
 }@ More...
 
virtual bool _OpenForWriting (std::string const &filename)=0
 

Detailed Description

A base class for reading and writing texture image data.

The class allows basic access to texture image file data.

Definition at line 52 of file image.h.

Member Enumeration Documentation

◆ ImageOriginLocation

Specifies whether to treat the image origin as the upper-left corner or the lower left.

Definition at line 58 of file image.h.

◆ SourceColorSpace

Specifies the source color space in which the texture is encoded, with "Auto" indicating the texture reader should determine color space based on hints from the image (e.g.

file type, number of channels, image metadata)

Definition at line 68 of file image.h.

Member Function Documentation

◆ _OpenForReading()

virtual bool _OpenForReading ( std::string const &  filename,
int  subimage,
int  mip,
SourceColorSpace  sourceColorSpace,
bool  suppressErrors 
)
protectedpure virtual

}@

◆ GetBytesPerPixel()

virtual int GetBytesPerPixel ( ) const
pure virtual

Returns the number of bytes per pixel.

◆ GetFilename()

virtual std::string const& GetFilename ( ) const
pure virtual

}@

Returns the image filename.

◆ GetFormat()

virtual HioFormat GetFormat ( ) const
pure virtual

Returns the destination HioFormat.

◆ GetHeight()

virtual int GetHeight ( ) const
pure virtual

Returns the image height.

◆ GetNumMipLevels()

virtual int GetNumMipLevels ( ) const
pure virtual

Returns the number of mips available.

◆ GetWidth()

virtual int GetWidth ( ) const
pure virtual

Returns the image width.

◆ IsColorSpaceSRGB()

virtual bool IsColorSpaceSRGB ( ) const
pure virtual

Returns whether the image is in the sRGB color space.

◆ IsSupportedImageFile()

static HIO_API bool IsSupportedImageFile ( std::string const &  filename)
static

Returns whether filename opened as a texture image.

◆ OpenForReading()

static HIO_API HioImageSharedPtr OpenForReading ( std::string const &  filename,
int  subimage = 0,
int  mip = 0,
SourceColorSpace  sourceColorSpace = SourceColorSpace::Auto,
bool  suppressErrors = false 
)
static

Opens filename for reading from the given subimage at mip level mip, using sourceColorSpace to help determine the color space with which to interpret the texture.

◆ OpenForWriting()

static HIO_API HioImageSharedPtr OpenForWriting ( std::string const &  filename)
static

Opens filename for writing from the given storage.

◆ Read()

virtual bool Read ( StorageSpec const &  storage)
pure virtual

Reads the image file into storage.

◆ ReadCropped()

virtual bool ReadCropped ( int const  cropTop,
int const  cropBottom,
int const  cropLeft,
int const  cropRight,
StorageSpec const &  storage 
)
pure virtual

Reads the cropped sub-image into storage.

◆ Write()

virtual bool Write ( StorageSpec const &  storage,
VtDictionary const &  metadata = VtDictionary() 
)
pure virtual

Writes the image with metadata.


The documentation for this class was generated from the following file: