![]() |
XII Release 0.1.0
|
A class containing image data and associated meta data. More...
#include <Image.h>
Public Member Functions | |
| XII_DECLARE_MEM_RELOCATABLE_TYPE () | |
| xiiImage () | |
| Constructs an empty image. | |
| xiiImage (xiiImage &&other) | |
| Move constructor. | |
| void | operator= (xiiImage &&rhs) |
| void | Clear () |
| Constructs an empty image. If the image is attached to an external storage, the attachment is discarded. | |
| void | ResetAndAlloc (const xiiImageHeader &header) |
| Constructs an image with the given header and ensures sufficient storage is allocated. | |
| void | ResetAndUseExternalStorage (const xiiImageHeader &header, xiiByteBlobPtr externalData) |
| Constructs an image with the given header and attaches to the user-supplied external storage. | |
| void | ResetAndMove (xiiImage &&other) |
| Moves the given data into this object. | |
| void | ResetAndCopy (const xiiImageView &other) |
| Constructs from an image view. Copies the image data to internal storage. | |
| xiiResult | LoadFrom (xiiStringView sFileName) |
| Convenience function to load the image from the given file. | |
| xiiResult | Convert (xiiImageFormat::Enum targetFormat) |
| Convenience function to convert the image to the given format. | |
| template<typename T> | |
| xiiBlobPtr< T > | GetBlobPtr () |
| Returns a view to the entire data contained in this image. | |
| xiiByteBlobPtr | GetByteBlobPtr () |
| xiiImage | GetSubImageView (xiiUInt32 uiMipLevel=0, xiiUInt32 uiFace=0, xiiUInt32 uiArrayIndex=0) |
| Returns a view to the given sub-image. | |
| xiiImage | GetPlaneView (xiiUInt32 uiMipLevel=0, xiiUInt32 uiFace=0, xiiUInt32 uiArrayIndex=0, xiiUInt32 uiPlaneIndex=0) |
| Returns a view to a sub-plane. | |
| xiiImage | GetSliceView (xiiUInt32 uiMipLevel=0, xiiUInt32 uiFace=0, xiiUInt32 uiArrayIndex=0, xiiUInt32 z=0, xiiUInt32 uiPlaneIndex=0) |
| Returns a view to z slice of the image. | |
| xiiImage | GetRowView (xiiUInt32 uiMipLevel=0, xiiUInt32 uiFace=0, xiiUInt32 uiArrayIndex=0, xiiUInt32 y=0, xiiUInt32 z=0, xiiUInt32 uiPlaneIndex=0) |
| Returns a view to a row of pixels resp. blocks. | |
| template<typename T> | |
| T * | GetPixelPointer (xiiUInt32 uiMipLevel=0, xiiUInt32 uiFace=0, xiiUInt32 uiArrayIndex=0, xiiUInt32 x=0, xiiUInt32 y=0, xiiUInt32 z=0, xiiUInt32 uiPlaneIndex=0) |
| Returns a pointer to a given pixel or block contained in a sub-image. | |
| template<typename T> | |
| xiiBlobPtr< const T > | GetBlobPtr () const |
| Returns a view to the entire data contained in this image. | |
| xiiConstByteBlobPtr | GetByteBlobPtr () const |
| xiiImageView | GetSubImageView (xiiUInt32 uiMipLevel=0, xiiUInt32 uiFace=0, xiiUInt32 uiArrayIndex=0) const |
| Returns a view to the given sub-image. | |
| xiiImageView | GetPlaneView (xiiUInt32 uiMipLevel=0, xiiUInt32 uiFace=0, xiiUInt32 uiArrayIndex=0, xiiUInt32 uiPlaneIndex=0) const |
| Returns a view to a sub-plane. | |
| xiiImageView | GetSliceView (xiiUInt32 uiMipLevel=0, xiiUInt32 uiFace=0, xiiUInt32 uiArrayIndex=0, xiiUInt32 z=0, xiiUInt32 uiPlaneIndex=0) const |
| Returns a view to z slice of the image. | |
| xiiImageView | GetRowView (xiiUInt32 uiMipLevel=0, xiiUInt32 uiFace=0, xiiUInt32 uiArrayIndex=0, xiiUInt32 y=0, xiiUInt32 z=0, xiiUInt32 uiPlaneIndex=0) const |
| Returns a view to a row of pixels resp. blocks. | |
| template<typename T> | |
| const T * | GetPixelPointer (xiiUInt32 uiMipLevel=0, xiiUInt32 uiFace=0, xiiUInt32 uiArrayIndex=0, xiiUInt32 x=0, xiiUInt32 y=0, xiiUInt32 z=0, xiiUInt32 uiPlaneIndex=0) const |
| Returns a pointer to a given pixel or block contained in a sub-image. | |
Public Member Functions inherited from xiiImageView | |
| xiiImageView () | |
| Constructs an empty image view. | |
| xiiImageView (const xiiImageHeader &header, xiiConstByteBlobPtr imageData) | |
| Constructs an image view with the given header and image data. | |
| void | Clear () |
| Constructs an empty image view. | |
| bool | IsValid () const |
| Returns false if the image view does not reference any data yet. | |
| void | ResetAndViewExternalStorage (const xiiImageHeader &header, xiiConstByteBlobPtr imageData) |
| Constructs an image view with the given header and image data. | |
| xiiResult | SaveTo (xiiStringView sFileName) const |
| Convenience function to save the image to the given file. | |
| const xiiImageHeader & | GetHeader () const |
| Returns the header this image was constructed from. | |
| template<typename T> | |
| xiiBlobPtr< const T > | GetBlobPtr () const |
| Returns a view to the entire data contained in this image. | |
| xiiConstByteBlobPtr | GetByteBlobPtr () const |
| xiiImageView | GetSubImageView (xiiUInt32 uiMipLevel=0, xiiUInt32 uiFace=0, xiiUInt32 uiArrayIndex=0) const |
| Returns a view to the given sub-image. | |
| xiiImageView | GetPlaneView (xiiUInt32 uiMipLevel=0, xiiUInt32 uiFace=0, xiiUInt32 uiArrayIndex=0, xiiUInt32 uiPlaneIndex=0) const |
| Returns a view to a sub-plane. | |
| xiiImageView | GetSliceView (xiiUInt32 uiMipLevel=0, xiiUInt32 uiFace=0, xiiUInt32 uiArrayIndex=0, xiiUInt32 z=0, xiiUInt32 uiPlaneIndex=0) const |
| Returns a view to z slice of the image. | |
| xiiImageView | GetRowView (xiiUInt32 uiMipLevel=0, xiiUInt32 uiFace=0, xiiUInt32 uiArrayIndex=0, xiiUInt32 y=0, xiiUInt32 z=0, xiiUInt32 uiPlaneIndex=0) const |
| Returns a view to a row of pixels resp. blocks. | |
| template<typename T> | |
| const T * | GetPixelPointer (xiiUInt32 uiMipLevel=0, xiiUInt32 uiFace=0, xiiUInt32 uiArrayIndex=0, xiiUInt32 x=0, xiiUInt32 y=0, xiiUInt32 z=0, xiiUInt32 uiPlaneIndex=0) const |
| Returns a pointer to a given pixel or block contained in a sub-image. | |
| void | ReinterpretAs (xiiImageFormat::Enum format) |
| Reinterprets the image with a given format; the format must have the same size in bits per pixel as the current one. | |
| xiiUInt32 | GetDepth (xiiUInt32 uiMipLevel=0) const |
| Returns the image depth for a given mip level, clamped to 1. | |
| xiiUInt32 | GetHeight (xiiUInt32 uiMipLevel=0) const |
| Returns the image height for a given mip level, clamped to 1. | |
| xiiUInt32 | GetWidth (xiiUInt32 uiMipLevel=0) const |
| Returns the image width for a given mip level, clamped to 1. | |
| xiiUInt32 | GetNumArrayIndices () const |
| Returns the number of array indices. | |
| xiiUInt32 | GetNumFaces () const |
| Returns the number of cubemap faces, or 1 for a non-cubemap. | |
| xiiUInt32 | GetNumMipLevels () const |
| Returns the number of mip levels, including the full-size image. | |
| xiiUInt32 | GetPlaneCount () const |
| Returns the number of image planes. | |
| xiiImageFormat::Enum | GetImageFormat () const |
| Returns the image format. | |
| xiiUInt32 | GetNumBlocksX (xiiUInt32 uiMipLevel=0, xiiUInt32 uiPlaneIndex=0) const |
| Returns the number of blocks contained in a given mip level in the horizontal direction. | |
| xiiUInt32 | GetNumBlocksY (xiiUInt32 uiMipLevel=0, xiiUInt32 uiPlaneIndex=0) const |
| Returns the number of blocks contained in a given mip level in the horizontal direction. | |
| xiiUInt32 | GetNumBlocksZ (xiiUInt32 uiMipLevel=0, xiiUInt32 uiPlaneIndex=0) const |
| Returns the number of blocks contained in a given mip level in the depth direction. | |
| xiiUInt64 | GetDepthPitch (xiiUInt32 uiMipLevel=0, xiiUInt32 uiPlaneIndex=0) const |
| Returns the offset in bytes between two subsequent depth slices of the given mip level. | |
| xiiUInt64 | GetRowPitch (xiiUInt32 uiMipLevel=0, xiiUInt32 uiPlaneIndex=0) const |
| Returns the offset in bytes between two subsequent rows of the given mip level. | |
Additional Inherited Members | |
Protected Member Functions inherited from xiiImageView | |
| xiiUInt64 | ComputeLayout () |
| void | ValidateSubImageIndices (xiiUInt32 uiMipLevel, xiiUInt32 uiFace, xiiUInt32 uiArrayIndex, xiiUInt32 uiPlaneIndex) const |
| template<typename T> | |
| void | ValidateDataTypeAccessor (xiiUInt32 uiPlaneIndex) const |
| const xiiUInt64 & | GetSubImageOffset (xiiUInt32 uiMipLevel, xiiUInt32 uiFace, xiiUInt32 uiArrayIndex, xiiUInt32 uiPlaneIndex) const |
Protected Member Functions inherited from xiiImageHeader | |
| xiiImageHeader () | |
| Constructs an image using an unknown format and zero size. | |
| void | Clear () |
| Constructs an image using an unknown format and zero size. | |
| void | SetImageFormat (const xiiImageFormat::Enum &format) |
| Sets the image format. | |
| xiiImageFormat::Enum | GetImageFormat () const |
| Returns the image format. | |
| void | SetWidth (xiiUInt32 uiWidth) |
| Sets the image width. | |
| xiiUInt32 | GetWidth (xiiUInt32 uiMipLevel=0) const |
| Returns the image width for a given mip level, clamped to 1. | |
| void | SetHeight (xiiUInt32 uiHeight) |
| Sets the image height. | |
| xiiUInt32 | GetHeight (xiiUInt32 uiMipLevel=0) const |
| Returns the image height for a given mip level, clamped to 1. | |
| void | SetDepth (xiiUInt32 uiDepth) |
| Sets the image depth. The default is 1. | |
| xiiUInt32 | GetDepth (xiiUInt32 uiMipLevel=0) const |
| Returns the image depth for a given mip level, clamped to 1. | |
| void | SetNumMipLevels (xiiUInt32 uiNumMipLevels) |
| Sets the number of mip levels, including the full-size image. | |
| xiiUInt32 | GetNumMipLevels () const |
| Returns the number of mip levels, including the full-size image. | |
| void | SetNumFaces (xiiUInt32 uiNumFaces) |
| Sets the number of cubemap faces. Use 1 for a non-cubemap. | |
| xiiUInt32 | GetNumFaces () const |
| Returns the number of cubemap faces, or 1 for a non-cubemap. | |
| void | SetNumArrayIndices (xiiUInt32 uiNumArrayIndices) |
| Sets the number of array indices. | |
| xiiUInt32 | GetNumArrayIndices () const |
| Returns the number of array indices. | |
| xiiUInt32 | GetPlaneCount () const |
| Returns the number of image planes. | |
| xiiUInt32 | GetNumBlocksX (xiiUInt32 uiMipLevel=0, xiiUInt32 uiPlaneIndex=0) const |
| Returns the number of blocks contained in a given mip level in the horizontal direction. | |
| xiiUInt32 | GetNumBlocksY (xiiUInt32 uiMipLevel=0, xiiUInt32 uiPlaneIndex=0) const |
| Returns the number of blocks contained in a given mip level in the horizontal direction. | |
| xiiUInt32 | GetNumBlocksZ (xiiUInt32 uiMipLevel=0, xiiUInt32 uiPlaneIndex=0) const |
| Returns the number of blocks contained in a given mip level in the depth direction. | |
| xiiUInt64 | GetRowPitch (xiiUInt32 uiMipLevel=0, xiiUInt32 uiPlaneIndex=0) const |
| Returns the offset in bytes between two subsequent rows of the given mip level. | |
| xiiUInt64 | GetDepthPitch (xiiUInt32 uiMipLevel=0, xiiUInt32 uiPlaneIndex=0) const |
| Returns the offset in bytes between two subsequent depth slices of the given mip level. | |
| xiiUInt64 | ComputeDataSize () const |
| Computes the data size required for an image with the header's format and dimensions. | |
| xiiUInt32 | ComputeNumberOfMipMaps () const |
| Computes the number of mip maps in the full mip chain. | |
| bool | operator== (const xiiImageHeader &other) const |
Protected Attributes inherited from xiiImageView | |
| xiiHybridArray< xiiUInt64, 16 > | m_SubImageOffsets |
| xiiBlobPtr< xiiUInt8 > | m_DataPtr |
Protected Attributes inherited from xiiImageHeader | |
| xiiUInt32 | m_uiNumMipLevels |
| xiiUInt32 | m_uiNumFaces |
| xiiUInt32 | m_uiNumArrayIndices |
| xiiUInt32 | m_uiWidth |
| xiiUInt32 | m_uiHeight |
| xiiUInt32 | m_uiDepth |
| xiiImageFormat::Enum | m_Format |
A class containing image data and associated meta data.
This class is a lightweight container for image data and the description required for interpreting the data, such as the image format, its dimensions, number of sub-images (i.e. cubemap faces, mip levels and array sub-images). However, it does not provide any methods for interpreting or modifying of the image data.
The sub-images are stored in a predefined order compatible with the layout of DDS files, that is, it first stores the mip chain for each image, then all faces in a case of a cubemap, then the individual images of an image array.
| void xiiImage::ResetAndAlloc | ( | const xiiImageHeader & | header | ) |
Constructs an image with the given header and ensures sufficient storage is allocated.
| void xiiImage::ResetAndCopy | ( | const xiiImageView & | other | ) |
Constructs from an image view. Copies the image data to internal storage.
If the image is currently attached to external storage, the attachment is discarded.
| void xiiImage::ResetAndMove | ( | xiiImage && | other | ) |
Moves the given data into this object.
If other is attached to an external storage, this object will also be attached to it, so life-time requirements for the external storage are now bound to this instance.
| void xiiImage::ResetAndUseExternalStorage | ( | const xiiImageHeader & | header, |
| xiiByteBlobPtr | externalData ) |
Constructs an image with the given header and attaches to the user-supplied external storage.
The user is responsible to keep the external storage alive as long as this xiiImage is alive.