![]() |
ezEngine Release 26.3
|
A lightweight view to image data without owning the memory. More...
#include <Image.h>

Public Member Functions | |
| ezImageView () | |
| Constructs an empty image view. | |
| ezImageView (const ezImageHeader &header, ezConstByteBlobPtr imageData) | |
| Constructs an image view with the given header and image data. | |
| void | Clear () |
| Resets to an empty state, releasing the reference to external data. | |
| bool | IsValid () const |
| Returns false if the image view does not reference any data yet. | |
| void | ResetAndViewExternalStorage (const ezImageHeader &header, ezConstByteBlobPtr imageData) |
| Resets the view to reference new external image data. | |
| ezResult | SaveTo (ezStringView sFileName) const |
| Convenience function to save the image to the given file. | |
| const ezImageHeader & | GetHeader () const |
| Returns the header this image was constructed from. | |
| template<typename T > | |
| ezBlobPtr< const T > | GetBlobPtr () const |
| Returns a view to the entire data contained in this image. | |
| ezConstByteBlobPtr | GetByteBlobPtr () const |
| ezImageView | GetSubImageView (ezUInt32 uiMipLevel=0, ezUInt32 uiFace=0, ezUInt32 uiArrayIndex=0) const |
| Returns a view to the given sub-image. | |
| ezImageView | GetPlaneView (ezUInt32 uiMipLevel=0, ezUInt32 uiFace=0, ezUInt32 uiArrayIndex=0, ezUInt32 uiPlaneIndex=0) const |
| Returns a view to a sub-plane. | |
| ezImageView | GetSliceView (ezUInt32 uiMipLevel=0, ezUInt32 uiFace=0, ezUInt32 uiArrayIndex=0, ezUInt32 z=0, ezUInt32 uiPlaneIndex=0) const |
| Returns a view to z slice of the image. | |
| ezImageView | GetRowView (ezUInt32 uiMipLevel=0, ezUInt32 uiFace=0, ezUInt32 uiArrayIndex=0, ezUInt32 y=0, ezUInt32 z=0, ezUInt32 uiPlaneIndex=0) const |
| Returns a view to a row of pixels resp. blocks. | |
| template<typename T > | |
| const T * | GetPixelPointer (ezUInt32 uiMipLevel=0, ezUInt32 uiFace=0, ezUInt32 uiArrayIndex=0, ezUInt32 x=0, ezUInt32 y=0, ezUInt32 z=0, ezUInt32 uiPlaneIndex=0) const |
| Returns a pointer to a given pixel or block contained in a sub-image. | |
| void | ReinterpretAs (ezImageFormat::Enum format) |
| Reinterprets the image with a given format; the format must have the same size in bits per pixel as the current one. | |
| ezUInt32 | GetDepth (ezUInt32 uiMipLevel=0) const |
| Returns the image depth for a given mip level, clamped to 1. | |
| ezUInt32 | GetHeight (ezUInt32 uiMipLevel=0) const |
| Returns the image height for a given mip level, clamped to 1. | |
| ezUInt32 | GetWidth (ezUInt32 uiMipLevel=0) const |
| Returns the image width for a given mip level, clamped to 1. | |
| ezUInt32 | GetNumArrayIndices () const |
| Returns the number of array indices. | |
| ezUInt32 | GetNumFaces () const |
| Returns the number of cubemap faces, or 1 for a non-cubemap. | |
| ezUInt32 | GetNumMipLevels () const |
| Returns the number of mip levels, including the full-size image. | |
| ezUInt32 | GetPlaneCount () const |
| Returns the number of image planes. | |
| ezImageFormat::Enum | GetImageFormat () const |
| Returns the image format. | |
| ezUInt32 | GetNumBlocksX (ezUInt32 uiMipLevel=0, ezUInt32 uiPlaneIndex=0) const |
| Returns the number of blocks contained in a given mip level in the horizontal direction. | |
| ezUInt32 | GetNumBlocksY (ezUInt32 uiMipLevel=0, ezUInt32 uiPlaneIndex=0) const |
| Returns the number of blocks contained in a given mip level in the horizontal direction. | |
| ezUInt32 | GetNumBlocksZ (ezUInt32 uiMipLevel=0, ezUInt32 uiPlaneIndex=0) const |
| Returns the number of blocks contained in a given mip level in the depth direction. | |
| ezUInt64 | GetDepthPitch (ezUInt32 uiMipLevel=0, ezUInt32 uiPlaneIndex=0) const |
| Returns the offset in bytes between two subsequent depth slices of the given mip level. | |
| ezUInt64 | GetRowPitch (ezUInt32 uiMipLevel=0, ezUInt32 uiPlaneIndex=0) const |
| Returns the offset in bytes between two subsequent rows of the given mip level. | |
Protected Member Functions | |
| ezUInt64 | ComputeLayout () |
| void | ValidateSubImageIndices (ezUInt32 uiMipLevel, ezUInt32 uiFace, ezUInt32 uiArrayIndex, ezUInt32 uiPlaneIndex) const |
| template<typename T > | |
| void | ValidateDataTypeAccessor (ezUInt32 uiPlaneIndex) const |
| const ezUInt64 & | GetSubImageOffset (ezUInt32 uiMipLevel, ezUInt32 uiFace, ezUInt32 uiArrayIndex, ezUInt32 uiPlaneIndex) const |
Protected Member Functions inherited from ezImageHeader | |
| ezImageHeader () | |
| 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 ezImageFormat::Enum &format) |
| Sets the image format. | |
| ezImageFormat::Enum | GetImageFormat () const |
| Returns the image format. | |
| void | SetWidth (ezUInt32 uiWidth) |
| Sets the image width. | |
| ezUInt32 | GetWidth (ezUInt32 uiMipLevel=0) const |
| Returns the image width for a given mip level, clamped to 1. | |
| void | SetHeight (ezUInt32 uiHeight) |
| Sets the image height. | |
| ezUInt32 | GetHeight (ezUInt32 uiMipLevel=0) const |
| Returns the image height for a given mip level, clamped to 1. | |
| void | SetDepth (ezUInt32 uiDepth) |
| Sets the image depth. The default is 1. | |
| ezUInt32 | GetDepth (ezUInt32 uiMipLevel=0) const |
| Returns the image depth for a given mip level, clamped to 1. | |
| void | SetNumMipLevels (ezUInt32 uiNumMipLevels) |
| Sets the number of mip levels, including the full-size image. | |
| ezUInt32 | GetNumMipLevels () const |
| Returns the number of mip levels, including the full-size image. | |
| void | SetNumFaces (ezUInt32 uiNumFaces) |
| Sets the number of cubemap faces. Use 1 for a non-cubemap. | |
| ezUInt32 | GetNumFaces () const |
| Returns the number of cubemap faces, or 1 for a non-cubemap. | |
| void | SetNumArrayIndices (ezUInt32 uiNumArrayIndices) |
| Sets the number of array indices. | |
| ezUInt32 | GetNumArrayIndices () const |
| Returns the number of array indices. | |
| ezUInt32 | GetPlaneCount () const |
| Returns the number of image planes. | |
| ezUInt32 | GetNumBlocksX (ezUInt32 uiMipLevel=0, ezUInt32 uiPlaneIndex=0) const |
| Returns the number of blocks contained in a given mip level in the horizontal direction. | |
| ezUInt32 | GetNumBlocksY (ezUInt32 uiMipLevel=0, ezUInt32 uiPlaneIndex=0) const |
| Returns the number of blocks contained in a given mip level in the horizontal direction. | |
| ezUInt32 | GetNumBlocksZ (ezUInt32 uiMipLevel=0, ezUInt32 uiPlaneIndex=0) const |
| Returns the number of blocks contained in a given mip level in the depth direction. | |
| ezUInt64 | GetRowPitch (ezUInt32 uiMipLevel=0, ezUInt32 uiPlaneIndex=0) const |
| Returns the offset in bytes between two subsequent rows of the given mip level. | |
| ezUInt64 | GetDepthPitch (ezUInt32 uiMipLevel=0, ezUInt32 uiPlaneIndex=0) const |
| Returns the offset in bytes between two subsequent depth slices of the given mip level. | |
| ezUInt64 | ComputeDataSize () const |
| Computes the data size required for an image with the header's format and dimensions. | |
| ezUInt32 | ComputeNumberOfMipMaps () const |
| Computes the number of mip maps in the full mip chain. | |
| bool | operator== (const ezImageHeader &other) const |
| bool | operator!= (const ezImageHeader &other) const |
Protected Attributes | |
| ezHybridArray< ezUInt64, 16 > | m_SubImageOffsets |
| ezBlobPtr< ezUInt8 > | m_DataPtr |
Protected Attributes inherited from ezImageHeader | |
| ezUInt32 | m_uiNumMipLevels |
| ezUInt32 | m_uiNumFaces |
| ezUInt32 | m_uiNumArrayIndices |
| ezUInt32 | m_uiWidth |
| ezUInt32 | m_uiHeight |
| ezUInt32 | m_uiDepth |
| ezImageFormat::Enum | m_Format |
A lightweight view to image data without owning the memory.
ezImageView provides read-only access to image data along with the metadata needed to interpret it. It does not own the image data, so the underlying memory must remain valid for the lifetime of the view. This class is ideal for passing image data around without unnecessary copying.
Use cases:
| void ezImageView::ResetAndViewExternalStorage | ( | const ezImageHeader & | header, |
| ezConstByteBlobPtr | imageData | ||
| ) |
Resets the view to reference new external image data.
Any previous data reference is released. The new data must remain valid for the lifetime of this view.