|
GREM 3.12.0
Game/Rendering Engine Modules for C++
|
Read-only non-owning view over a 2D image. More...
#include <GREM/resource/Image.hpp>
Public Member Functions | |
| constexpr | ImageView () noexcept=default |
| Construct a view that does not reference an image. | |
| constexpr | ImageView (ImageType type, ImageFormat format, Extent3D size3D, uint32_t mipLevelCount, Span< const byte > contents) |
| Construct an image view over arbitrary 2D pixel data. | |
| void | transcodeTo (byte *output, ImageFormat outputFormat) const |
| Transcode the image data to a specific format. | |
| constexpr ImageType | getType () const noexcept |
| Get the type of the image referenced by this view. | |
| constexpr ImageFormat | getFormat () const noexcept |
| Get the format of the image referenced by this view. | |
| constexpr Extent2D | getSize2D () const noexcept |
| Get the size, in pixels, of the image layers referenced by this view. | |
| constexpr Extent3D | getSize3D () const noexcept |
| Get the size, in pixels, and the depth, in layers, of the image referenced by this view. | |
| constexpr uint32_t | getWidth () const noexcept |
| Get the width of the image referenced by this view. | |
| constexpr uint32_t | getHeight () const noexcept |
| Get the height of the image referenced by this view. | |
| constexpr uint32_t | getDepth () const noexcept |
| Get the depth of the image referenced by this view. | |
| constexpr uint32_t | getMipLevelCount () const noexcept |
| Get the number of mip levels in the image referenced by this view. | |
| constexpr Span< const byte > | getContents () const noexcept |
| Get the image data referenced by this view. | |
| constexpr const byte * | data () const noexcept |
| Get a pointer to the image data referenced by this view. | |
| constexpr size_t | size () const noexcept |
| Get the size of the image data. | |
| template<typename Pixel> | |
| constexpr Pixel | readPixel (Offset3D position, uint32_t mipLevel=0) const |
| Read a specific pixel of the image. | |
| constexpr ImageView | getPixel (Offset3D position, uint32_t mipLevel=0) const |
| Get a view over a specific pixel of the image. | |
| constexpr ImageView | getLayer (uint32_t layer, uint32_t mipLevel=0) const |
| Get a view over a specific layer of a specific mip level of the image. | |
| constexpr ImageView | getMipLevel (uint32_t mipLevel) const |
| Get a view over all layers in a specific mip level of the image. | |
| constexpr ImageView | getMipLevels (uint32_t firstMipLevel, uint32_t mipLevels) const |
| Get a view over all layers in a specific range of mip levels of the image. | |
| constexpr ImageView | getMipLevels (uint32_t firstMipLevel) const |
| Get a view over all layers of all mip levels of the image at or above a specific mip level. | |
| Image | getPadded (uint32_t paddingLeft, uint32_t paddingRight, uint32_t paddingTop, uint32_t paddingBottom) const |
| Get a padded version of the image. | |
| Image | getPadded (uint32_t padding) const |
| Get a uniformly padded version of the image. | |
Read-only non-owning view over a 2D image.
|
constexprdefaultnoexcept |
Construct a view that does not reference an image.
|
inlineconstexpr |
Construct an image view over arbitrary 2D pixel data.
| type | image type. |
| format | image format. |
| size3D | size3D of the image, in pixels and layers. If type is ImageType::IMAGE_CUBE or ImageType::IMAGE_CUBE_ARRAY, width must be equal to height. If type is ImageType::IMAGE_2D, depth must be
|
| mipLevelCount | number of mip levels stored for the image. Must be less than or equal to the result of Image::getMaxMipLevelCount() for the given width and height. |
| contents | read-only view over the image data, or an empty span to create a view that doesn't reference an image. Must have a valid size for the given type and shape of the image, including all layers and mip levels. |
| void grem::resource::ImageView::transcodeTo | ( | byte * | output, |
| ImageFormat | outputFormat ) const |
Transcode the image data to a specific format.
| output | non-owning pointer to a block of memory to write the transcoded image data to. Must point to a valid block of memory of at least the size required for the full image in the given output format, including all layers and mip levels, and must not be nullptr. |
| outputFormat | image format to transcode to. |
| std::invalid_argument | if transcoding failed, or if transcoding from the image's current format to the given format is not supported. |
| std::length_error | if the maximum image size was exceeded. |
| std::bad_alloc | on allocation failure. |
|
inlinenodiscardconstexprnoexcept |
Get the type of the image referenced by this view.
|
inlinenodiscardconstexprnoexcept |
Get the format of the image referenced by this view.
|
inlinenodiscardconstexprnoexcept |
Get the size, in pixels, of the image layers referenced by this view.
|
inlinenodiscardconstexprnoexcept |
Get the size, in pixels, and the depth, in layers, of the image referenced by this view.
|
inlinenodiscardconstexprnoexcept |
Get the width of the image referenced by this view.
|
inlinenodiscardconstexprnoexcept |
Get the height of the image referenced by this view.
|
inlinenodiscardconstexprnoexcept |
Get the depth of the image referenced by this view.
|
inlinenodiscardconstexprnoexcept |
Get the number of mip levels in the image referenced by this view.
|
inlinenodiscardconstexprnoexcept |
Get the image data referenced by this view.
|
inlinenodiscardconstexprnoexcept |
Get a pointer to the image data referenced by this view.
|
inlinenodiscardconstexprnoexcept |
Get the size of the image data.
|
nodiscardconstexpr |
Read a specific pixel of the image.
| Pixel | pixel type to read. Must be a default-initializable, trivially copyable type that is binary-compatible with the current pixel format of the image. |
| position | coordinates of the pixel to get. Must be a valid position within the specified mip level. |
| mipLevel | index of the mip level to get the pixel from. Must be a valid mip level index that is less than getMipLevelCount(). |
| std::invalid_argument | if the image is not in a raw uncompressed format. |
|
nodiscardconstexpr |
Get a view over a specific pixel of the image.
| position | coordinates of the pixel to get. Must be a valid position within the specified mip level. |
| mipLevel | index of the mip level to get the pixel from. Must be a valid mip level index that is less than getMipLevelCount(). |
| std::invalid_argument | if the image is not in a raw uncompressed format. |
|
nodiscardconstexpr |
Get a view over a specific layer of a specific mip level of the image.
| layer | index of the layer to get. Must be a valid layer index that is less than getDepth(). |
| mipLevel | index of the mip level to get the layer from. Must be a valid mip level index that is less than getMipLevelCount(). |
| std::invalid_argument | if the image is not in a raw format. |
| std::length_error | if the maximum image size was exceeded. |
|
nodiscardconstexpr |
Get a view over all layers in a specific mip level of the image.
| mipLevel | index of the mip level to get. Must be a valid mip level index that is less than getMipLevelCount(). |
| std::invalid_argument | if the image is not in a raw format. |
| std::length_error | if the maximum image size was exceeded. |
|
nodiscardconstexpr |
Get a view over all layers in a specific range of mip levels of the image.
| firstMipLevel | index of the first mip level to get. Must be less than or equal to getMipLevelCount(). |
| mipLevels | number of mip levels to get. Must be less than or equal to getMipLevelCount() - firstMipLevel. |
| std::invalid_argument | if the image is not in a raw format. |
| std::length_error | if the maximum image size was exceeded. |
|
nodiscardconstexpr |
Get a view over all layers of all mip levels of the image at or above a specific mip level.
| firstMipLevel | index of the first mip level to get. Must be less than or equal to getMipLevelCount(). |
| std::invalid_argument | if the image is not in a raw format. |
| std::length_error | if the maximum image size was exceeded. |
|
nodiscard |
Get a padded version of the image.
The image must be in a raw format.
| paddingLeft | padding to add to the left of the image, in pixels. |
| paddingRight | padding to add to the right of the image, in pixels. |
| paddingTop | padding to add above the image, in pixels. |
| paddingBottom | padding to add below the image, in pixels. |
| std::invalid_argument | if the image is not in a raw format. |
| std::length_error | if the maximum image size was exceeded. |
| std::bad_alloc | on allocation failure. |
|
inlinenodiscard |
Get a uniformly padded version of the image.
The image must be in a raw format.
| padding | padding to add on each side of the image, in pixels. |
| std::invalid_argument | if the image is not in a raw format. |
| std::length_error | if the maximum image size was exceeded. |
| std::bad_alloc | on allocation failure. |