HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HioImage Class Referenceabstract

#include <image.h>

Classes

class  StorageSpec
 

Public Types

enum  ImageOriginLocation { OriginUpperLeft, OriginLowerLeft }
 
enum  SourceColorSpace { Raw, SRGB, Auto }
 

Public Member Functions

 HioImage ()=default
 
virtual HIO_API ~HioImage ()
 
 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)
 

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
 }@ More...
 
virtual bool GetMetadata (TfToken const &key, VtValue *value) const =0
 }@ More...
 
virtual bool GetSamplerMetadata (HioAddressDimension dim, HioAddressMode *param) const =0
 }@ More...
 
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
 }@ More...
 

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

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

Enumerator
OriginUpperLeft 
OriginLowerLeft 

Definition at line 60 of file image.h.

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)

Enumerator
Raw 
SRGB 
Auto 

Definition at line 70 of file image.h.

Constructor & Destructor Documentation

HioImage::HioImage ( )
default
virtual HIO_API HioImage::~HioImage ( )
virtual
HioImage::HioImage ( const HioImage )
delete

Member Function Documentation

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

}@

virtual bool HioImage::_OpenForWriting ( std::string const &  filename)
protectedpure virtual

}@

virtual int HioImage::GetBytesPerPixel ( ) const
pure virtual

Returns the number of bytes per pixel.

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

}@

Returns the image filename.

virtual HioFormat HioImage::GetFormat ( ) const
pure virtual

Returns the destination HioFormat.

virtual int HioImage::GetHeight ( ) const
pure virtual

Returns the image height.

template<typename T >
bool HioImage::GetMetadata ( TfToken const &  key,
T value 
) const

}@

Definition at line 194 of file image.h.

virtual bool HioImage::GetMetadata ( TfToken const &  key,
VtValue value 
) const
pure virtual

}@

virtual int HioImage::GetNumMipLevels ( ) const
pure virtual

Returns the number of mips available.

virtual bool HioImage::GetSamplerMetadata ( HioAddressDimension  dim,
HioAddressMode param 
) const
pure virtual

}@

virtual int HioImage::GetWidth ( ) const
pure virtual

Returns the image width.

virtual bool HioImage::IsColorSpaceSRGB ( ) const
pure virtual

Returns whether the image is in the sRGB color space.

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

Returns whether filename opened as a texture image.

static HIO_API HioImageSharedPtr HioImage::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

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

Opens filename for writing from the given storage.

HioImage& HioImage::operator= ( const HioImage )
delete
virtual bool HioImage::Read ( StorageSpec const &  storage)
pure virtual

Reads the image file into storage.

virtual bool HioImage::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.

virtual bool HioImage::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: