Loading...
Searching...
No Matches
HioImage Class Referenceabstract

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

#include <image.h>

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.
 

Reading

{@

virtual bool Read (StorageSpec const &storage)=0
 Reads the image file into storage.
 
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.
 
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.
 

Writing

}@

{@

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

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
 }@
 
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.

Texture paths are UTF-8 strings, resolvable by AR. Texture system dispatch is driven by extension, with [A-Z] (and no other characters) case folded.

Definition at line 54 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 60 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 70 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.

◆ GetMetadata()

bool GetMetadata ( TfToken const &  key,
T *  value 
) const

Definition at line 194 of file image.h.

◆ 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: