XII Release 0.1.0
Loading...
Searching...
No Matches
xiiImage Class Reference

#include <Image.h>

Inheritance diagram for xiiImage:
[legend]

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 xiiGALTextureCreationDescription &description)
void ResetAndUseExternalStorage (const xiiGALTextureCreationDescription &description, xiiByteBlobPtr pExternalData)
void ResetAndMove (xiiImage &&other)
void ResetAndCopy (const xiiImageView &other)
xiiResult LoadFrom (xiiStringView sFileName)
 Convenience function to load the image from the given file.
xiiResult Convert (xiiGALResourceFormat::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 xiiGALTextureCreationDescription &description, xiiConstByteBlobPtr imageData)
 Constructs an image view with the given description 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 xiiGALTextureCreationDescription &description, xiiConstByteBlobPtr imageData)
 Constructs an image view with the given description and image data.
xiiResult SaveTo (xiiStringView sFileName) const
 Convenience function to save the image to the given file.
const xiiGALTextureCreationDescription & GetDescription () const
 Returns the description this image was constructed from.
xiiEnum< xiiGALResourceFormat > GetImageFormat () const
 Returns the image resource format.
xiiUInt32 GetWidth (xiiUInt32 uiMipLevel=0) const
 Returns width/height/depth for the given mip level.
xiiUInt32 GetHeight (xiiUInt32 uiMipLevel=0) const
xiiUInt32 GetDepth (xiiUInt32 uiMipLevel=0) const
xiiUInt32 GetMipLevelCount () const
xiiUInt32 GetNumFaces () const
xiiUInt32 GetNumArrayIndices () const
xiiUInt32 GetPlaneCount () const
xiiUInt32 GetNumBlocksX (xiiUInt32 uiMipLevel=0, xiiUInt32 uiPlaneIndex=0) const
xiiUInt32 GetNumBlocksY (xiiUInt32 uiMipLevel=0, xiiUInt32 uiPlaneIndex=0) const
xiiUInt32 GetNumBlocksZ (xiiUInt32 uiMipLevel=0, xiiUInt32 uiPlaneIndex=0) const
xiiUInt64 GetRowPitch (xiiUInt32 uiMipLevel=0, xiiUInt32 uiPlaneIndex=0) const
xiiUInt64 GetDepthPitch (xiiUInt32 uiMipLevel=0, xiiUInt32 uiPlaneIndex=0) const
xiiUInt64 ComputeDataSize () const
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 (xiiGALResourceFormat::Enum format)
 Reinterprets the image with a given format; the format must have the same size in bits per pixel as the current one.

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 Attributes inherited from xiiImageView
xiiHybridArray< xiiUInt64, 16 > m_SubImageOffsets
xiiBlobPtr< xiiUInt8 > m_DataPtr
xiiGALTextureCreationDescription m_Description

Detailed Description

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.

Member Function Documentation

◆ ResetAndAlloc()

void xiiImage::ResetAndAlloc ( const xiiGALTextureCreationDescription & description)

Constructs an image with the given header and ensures sufficient storage is allocated.

Note
If this xiiImage was previously attached to external storage, this will reuse that storage. However, if the external storage is not sufficiently large, ResetAndAlloc() will detach from it and allocate internal storage.

◆ ResetAndCopy()

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.

◆ ResetAndMove()

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.

◆ ResetAndUseExternalStorage()

void xiiImage::ResetAndUseExternalStorage ( const xiiGALTextureCreationDescription & description,
xiiByteBlobPtr pExternalData )

Constructs an image with the given description 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.


The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Engine/Texture/Image/Image.h
  • /home/runner/work/XII/XII/Source/Engine/Texture/Image/Implementation/Image.cpp
  • /home/runner/work/XII/XII/Source/Engine/Texture/Image/Implementation/Image_inl.h