|
GREM 3.12.0
Game/Rendering Engine Modules for C++
|
Container for a 2D image. More...
#include <GREM/resource/Image.hpp>
Public Member Functions | |
| Image () noexcept=default | |
| Construct an empty image without a value. | |
| Image (ImageType type, ImageFormat format, Extent3D size3D, uint32_t mipLevelCount, Span< const byte > contents={}) | |
| Construct an image. | |
| Image (ImageType type, ImageFormat format, Extent3D size3D, uint32_t mipLevelCount, Allocation< byte > contents) | |
| Construct an image. | |
| Image (const ImageView &image) | |
| Construct an image copied from an image view. | |
| Image (const Filesystem &filesystem, CStringView filepath, const ImageOptions &options={}) | |
| Load an image from a file. | |
| Image (Span< const byte > fileContents, const ImageOptions &options={}) | |
| Load an image from an in-memory file. | |
| operator ImageView () const noexcept | |
| Get a read-only view over this image. | |
| operator ImageReference () noexcept | |
| Get a view over this image. | |
| void | reset () noexcept |
| Remove the value from this image and reset it to an empty image. | |
| void | transcodeTo (byte *output, ImageFormat outputFormat) const |
| Transcode the image data to a specific format. | |
| void | transformFromStraightToPremultipliedAlpha (Color::TransferFunction transferFunction) |
| Transform the RGBA image pixel colors from straight to pre-multiplied alpha. | |
| void | transformFromPremultipliedToStraightAlpha (Color::TransferFunction transferFunction) |
| Transform the RGBA image pixel colors from pre-multiplied to straight alpha. | |
| ImageType | getType () const noexcept |
| Get the type of the image. | |
| ImageFormat | getFormat () const noexcept |
| Get the format of the image. | |
| Extent2D | getSize2D () const noexcept |
| Get the size, in pixels, of the image layers. | |
| Extent3D | getSize3D () const noexcept |
| Get the size, in pixels, and the depth, in layers, of the image. | |
| uint32_t | getWidth () const noexcept |
| Get the width of the image. | |
| uint32_t | getHeight () const noexcept |
| Get the height of the image. | |
| uint32_t | getDepth () const noexcept |
| Get the depth of the image. | |
| uint32_t | getMipLevelCount () const noexcept |
| Get the number of mip levels in the image referenced by this view. | |
| Span< byte > | getContents () noexcept |
| Get the data of this image. | |
| Span< const byte > | getContents () const noexcept |
| Get the data of this image. | |
| byte * | data () noexcept |
| Get a pointer to the data of this image. | |
| const byte * | data () const noexcept |
| Get a pointer to the data of this image. | |
| 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. | |
| ImageView | getPixel (Offset3D position, uint32_t mipLevel=0) const |
| Get a view over a specific pixel of the image. | |
| ImageReference | getPixel (Offset3D position, uint32_t mipLevel=0) |
| Get a view over a specific pixel of the image. | |
| 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. | |
| ImageReference | getLayer (uint32_t layer, uint32_t mipLevel=0) |
| Get a view over a specific layer of a specific mip level of the image. | |
| ImageView | getMipLevel (uint32_t mipLevel) const |
| Get a view over all layers in a specific mip level of the image. | |
| ImageReference | getMipLevel (uint32_t mipLevel) |
| Get a view over all layers in a specific mip level of the image. | |
| 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. | |
| ImageReference | getMipLevels (uint32_t firstMipLevel, uint32_t mipLevels) |
| Get a view over all layers in a specific range of mip levels of the image. | |
| 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. | |
| ImageReference | getMipLevels (uint32_t firstMipLevel) |
| 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 paddingBottom, uint32_t paddingTop) const |
| Get a uniformly padded version of the image. | |
| Image | getPadded (uint32_t padding) const |
| Get a uniformly padded version of the image. | |
Static Public Member Functions | |
| static constexpr uint32_t | getMaxMipLevelCount (Extent2D size2D) noexcept |
| Get the maximum number of mip levels for a specific 2D image size. | |
| static constexpr size_t | getLogicalChannelCount (ImageFormat format) |
| Get the number of logical pixel component channels in a specific image format (which doesn't necessarily correspond to the physical pixel size of the format). | |
| static constexpr bool | isRGBAColorFormat (ImageFormat format) |
| Check if a specific image format is an RGBA color format with an alpha channel. | |
| static constexpr bool | isRawFormat (ImageFormat format) |
| Check if a specific image format is a raw format. | |
| static constexpr bool | isPackedFormat (ImageFormat format) |
| Check if a specific image format is a bit-packed format. | |
| static constexpr bool | isCompressedFormat (ImageFormat format) |
| Check if a specific image format is a (potentially containerized) compressed format. | |
| static constexpr bool | isContainerizedFormat (ImageFormat format) |
| Check if a specific image format is a containerized format. | |
| static constexpr ImageFormat | getRawFormat (ImageFormat format) |
| Get the raw format corresponding to a specific image format. | |
| static constexpr ImageFormat | getUncompressedFormat (ImageFormat format) |
| Get the uncompressed format corresponding to a specific image format. | |
| static constexpr size_t | getPixelStride (ImageFormat format) |
| Get the stride in bytes of the pixels in a specific uncompressed image format. | |
| static constexpr Extent2D | getBlockSize2D (ImageFormat format) |
| Get the raw uncompressed size of the 2D blocks in a specific non-containerized image format, in pixels. | |
| static constexpr size_t | getBlockStride (ImageFormat format) |
| Get the stride in bytes of the blocks in a specific non-containerized image format. | |
| static constexpr Extent3D | getMipLevelSize3D (Extent3D size3D, uint32_t mipLevel) |
| Get the 3D size, in pixels, of all layers in a specific mip level of an image. | |
| static constexpr Extent2D | getMipLevelSize2D (Extent2D size2D, uint32_t mipLevel) |
| Get the 2D size, in pixels, of a single layer in a specific mip level of an image. | |
| static constexpr size_t | getRowStride (ImageFormat format, uint32_t width) |
| Get the stride in bytes of the rows in a specific uncompressed image format. | |
| static constexpr size_t | getLayerStride (ImageFormat format, Extent2D size2D) |
| Get the stride in bytes of the layers in a specific non-containerized image format. | |
| static constexpr size_t | getMipLevelStride (ImageFormat format, Extent3D size3D) |
| Get the size in bytes of a single-mip-level image in a specific non-containerized image format. | |
| static constexpr size_t | getSizeInBytes (ImageFormat format, Extent3D size3D, uint32_t mipLevelCount) |
| Get the size in bytes of an image in a specific non-containerized image format. | |
| template<typename OutputComponent, typename InputComponent> | |
| static OutputComponent | convertPixelComponent (const InputComponent &value) noexcept |
| Convert a single pixel component of a raw image to another pixel component type. | |
| template<typename OutputComponent, size_t OutputComponentCount, typename InputComponent, size_t InputComponentCount> | |
| static void | convertPixel (byte *output, const byte *input) |
| Convert a single pixel of a raw image to another raw pixel format. | |
| template<typename OutputComponent, size_t OutputComponentCount, typename InputComponent, size_t InputComponentCount> | |
| static void | convertPixels (Extent3D outputSize, byte *output, Offset3D outputOffset, Extent3D inputSize, const byte *input, Region3D inputRegion) |
| Convert the pixels in a region of a raw image to another raw pixel format. | |
| template<typename OutputComponent, size_t OutputComponentCount, typename InputComponent, size_t InputComponentCount> | |
| static void | convertPixels (Extent3D size3D, uint32_t mipLevelCount, byte *output, const byte *input) |
| Convert all pixels of a full raw image to another raw pixel format. | |
| static void | copyPixels (Extent3D outputSize, byte *output, Offset3D outputOffset, Extent3D inputSize, const byte *input, Region3D inputRegion, size_t pixelStride) |
| Copy the pixels in a region of a raw image to another image region in the same format. | |
| static void | copyPixels (Extent3D size3D, uint32_t mipLevelCount, byte *output, const byte *input, size_t pixelStride) |
| Copy all pixels of a full raw image to another image in the same format. | |
| static void | transformPixels (Extent3D size, byte *pixels, Region3D region, size_t pixelStride, auto op) |
| Transform the pixels in a region of a raw image by a given operation. | |
| static void | transformPixels (Extent3D size3D, uint32_t mipLevelCount, byte *pixels, size_t pixelStride, auto op) |
| Transform all pixels of a full raw image by a given operation. | |
| static void | fillPixels (Extent3D outputSize, byte *output, Region3D outputRegion, size_t pixelStride, const byte *inputPixel) |
| Set the pixels in a region of a raw image to a specific pixel value. | |
| static void | fillPixels (Extent3D size3D, uint32_t mipLevelCount, byte *output, size_t pixelStride, const byte *inputPixel) |
| Set all pixels of a full raw image to a specific pixel value. | |
| template<typename OutputComponent, size_t OutputComponentCount, size_t ComponentIndex> | |
| static void | setPixelsComponent (Extent3D outputSize, byte *output, Region3D outputRegion, const OutputComponent &value) |
| Set a component of the pixels in a region of a raw image to a specific value. | |
| template<typename OutputComponent, size_t OutputComponentCount, size_t ComponentIndex> | |
| static void | setPixelsComponent (Extent3D size3D, uint32_t mipLevelCount, byte *output, const OutputComponent &value) |
| Set a component of all pixels of a full raw image to a specific value. | |
| template<typename PixelComponent, Color::TransferFunction TransferFunction> | |
| static void | transformRGBAPixelsFromStraightToPremultipliedAlpha (Extent3D size3D, uint32_t mipLevelCount, byte *pixels) |
| Transform all pixels of a full raw RGBA image from straight to pre-multiplied alpha. | |
| template<typename PixelComponent, Color::TransferFunction TransferFunction> | |
| static void | transformRGBAPixelsFromPremultipliedToStraightAlpha (Extent3D size3D, uint32_t mipLevelCount, byte *pixels) |
| Transform all pixels of a full raw RGBA image from pre-multiplied to straight alpha. | |
| static void | flipVertically (Extent2D size2D, byte *pixels, size_t pixelStride) |
| Flip a layer of a raw image on the Y axis. | |
| static ImageFileType | determineFileType (Span< const byte > fileContents) |
| Determine which image file type a file should be parsed as based on the contents at the beginning of the file. | |
| static void | savePNG (const ImageView &image, Filesystem &filesystem, CStringView filepath, const ImageSavePNGOptions &options={}) |
| Save an 8-bit-per-channel image to a PNG file. | |
| static Allocation< byte > | savePNG (const ImageView &image, const ImageSavePNGOptions &options={}) |
| Save an 8-bit-per-channel image to an in-memory PNG file. | |
| static void | saveJPEG (const ImageView &image, Filesystem &filesystem, CStringView filepath, const ImageSaveJPEGOptions &options={}) |
| Save an 8-bit-per-channel image to a JPEG file. | |
| static Allocation< byte > | saveJPEG (const ImageView &image, const ImageSaveJPEGOptions &options={}) |
| Save an 8-bit-per-channel image to an in-memory JPEG file. | |
| static void | saveHDR (const ImageView &image, Filesystem &filesystem, CStringView filepath, const ImageSaveHDROptions &options={}) |
| Save a floating-point 32-bit-per-channel image to an RGBE/Radiance HDR file. | |
| static Allocation< byte > | saveHDR (const ImageView &image, const ImageSaveHDROptions &options={}) |
| Save a floating-point 32-bit-per-channel image to an in-memory RGBE/Radiance HDR file. | |
| static void | saveKTX2 (const ImageView &image, Filesystem &filesystem, CStringView filepath, const ImageSaveKTX2Options &options={}) |
| Save an image to a Khronos TeXture, version 2.0 file. | |
| static Allocation< byte > | saveKTX2 (const ImageView &image, const ImageSaveKTX2Options &options={}) |
| Save an image to an in-memory Khronos Texture, version 2.0 file. | |
| static void | save (const ImageView &image, Filesystem &filesystem, CStringView filepath, const ImageSaveOptions &options={}) |
| Save an image to a file. | |
Container for a 2D image.
|
defaultnoexcept |
Construct an empty image without a value.
| grem::resource::Image::Image | ( | ImageType | type, |
| ImageFormat | format, | ||
| Extent3D | size3D, | ||
| uint32_t | mipLevelCount, | ||
| Span< const byte > | contents = {} ) |
Construct an image.
| type | image type. |
| format | image format. |
| size3D | size of the image to allocate, 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 1. If type is ImageType::IMAGE_CUBE, 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 2D size. |
| contents | read-only view over the image data to copy, or an empty span to leave the data uninitialized. Must either be empty or have a valid size for the given shape of the image. |
| std::length_error | if the maximum image size was exceeded. |
| std::bad_alloc | on allocation failure. |
| grem::resource::Image::Image | ( | ImageType | type, |
| ImageFormat | format, | ||
| Extent3D | size3D, | ||
| uint32_t | mipLevelCount, | ||
| Allocation< byte > | contents ) |
Construct an image.
| type | image type. |
| format | image format. |
| size3D | size of the image to allocate, 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 1. If type is ImageType::IMAGE_CUBE, 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 2D size. |
| contents | array containing the image data, or an empty array to allocate new data and leave it uninitialized. Must either be empty or have a valid size for the given shape of the image. |
| std::length_error | if the maximum image size was exceeded. |
| std::bad_alloc | on allocation failure. |
|
explicit |
Construct an image copied from an image view.
| image | read-only view over the image to copy. |
| std::length_error | if the maximum image size was exceeded. |
| std::bad_alloc | on allocation failure. |
| grem::resource::Image::Image | ( | const Filesystem & | filesystem, |
| CStringView | filepath, | ||
| const ImageOptions & | options = {} ) |
Load an image from a file.
The supported file formats are:
| filesystem | filesystem to load the file from. |
| filepath | input filepath of the image file to load. |
| options | image options, see ImageOptions. |
| File::Error | on failure to open or read from the file. |
| resource::Error | on failure to load a valid image from the file. |
| std::length_error | if the maximum image or file size was exceeded. |
| std::bad_alloc | on allocation failure. |
|
explicit |
Load an image from an in-memory file.
The supported file formats are:
| fileContents | contents of the image file to load. |
| options | image options, see ImageOptions. |
| resource::Error | on failure to load a valid image from the file. |
| std::length_error | if the maximum image or file size was exceeded. |
| std::bad_alloc | on allocation failure. |
|
inlinestaticnodiscardconstexprnoexcept |
Get the maximum number of mip levels for a specific 2D image size.
| size2D | size of the 2D image at mip level 0. |
|
inlinestaticnodiscardconstexpr |
Get the number of logical pixel component channels in a specific image format (which doesn't necessarily correspond to the physical pixel size of the format).
| format | image format to get the number of channels in. |
|
inlinestaticnodiscardconstexpr |
Check if a specific image format is an RGBA color format with an alpha channel.
| format | image format to check. |
|
inlinestaticnodiscardconstexpr |
Check if a specific image format is a raw format.
| format | image format to check. |
|
inlinestaticnodiscardconstexpr |
Check if a specific image format is a bit-packed format.
| format | image format to check. |
|
inlinestaticnodiscardconstexpr |
Check if a specific image format is a (potentially containerized) compressed format.
| format | image format to check. |
|
inlinestaticnodiscardconstexpr |
Check if a specific image format is a containerized format.
| format | image format to check. |
|
inlinestaticnodiscardconstexpr |
Get the raw format corresponding to a specific image format.
| format | image format to get the raw image format of. |
|
inlinestaticnodiscardconstexpr |
Get the uncompressed format corresponding to a specific image format.
| format | image format to get the uncompressed image format of. |
|
inlinestaticnodiscardconstexpr |
Get the stride in bytes of the pixels in a specific uncompressed image format.
| format | image format. |
|
inlinestaticnodiscardconstexpr |
Get the raw uncompressed size of the 2D blocks in a specific non-containerized image format, in pixels.
| format | image format. |
|
inlinestaticnodiscardconstexpr |
Get the stride in bytes of the blocks in a specific non-containerized image format.
| format | image format. |
|
inlinestaticnodiscardconstexpr |
Get the 3D size, in pixels, of all layers in a specific mip level of an image.
| size3D | size of the full image, in pixels. |
| mipLevel | index of the mip level to get the size of. Must be less than the result of Image::getMaxMipLevelCount() for the given 2D size. |
|
inlinestaticnodiscardconstexpr |
Get the 2D size, in pixels, of a single layer in a specific mip level of an image.
| size2D | size of the full image, in pixels. |
| mipLevel | index of the mip level to get the size of. Must be less than the result of Image::getMaxMipLevelCount() for the given 2D size. |
|
inlinestaticnodiscardconstexpr |
Get the stride in bytes of the rows in a specific uncompressed image format.
| format | image format. |
| width | width of the image, in pixels. |
| std::length_error | if the maximum image size was exceeded. |
|
inlinestaticnodiscardconstexpr |
Get the stride in bytes of the layers in a specific non-containerized image format.
| format | image format. |
| size2D | size of the full image layer, in pixels. |
| std::length_error | if the maximum image size was exceeded. |
|
inlinestaticnodiscardconstexpr |
Get the size in bytes of a single-mip-level image in a specific non-containerized image format.
| format | image format. |
| size3D | size of the full image mip level, in pixels. |
| std::length_error | if the maximum image size was exceeded. |
|
inlinestaticnodiscardconstexpr |
Get the size in bytes of an image in a specific non-containerized image format.
| format | image format. |
| size3D | size of the full image, in pixels. |
| mipLevelCount | number of mip levels in the image. |
| std::length_error | if the maximum image size was exceeded. |
|
inlinestaticnodiscardnoexcept |
Convert a single pixel component of a raw image to another pixel component type.
| OutputComponent | component type to convert to. Must be a valid raw pixel component type (u8norm, float16_t or float32_t). |
| InputComponent | component type to convert from. Must be a valid raw pixel component type (u8norm, float16_t or float32_t). |
| value | component value to convert. |
|
inlinestatic |
Convert a single pixel of a raw image to another raw pixel format.
| OutputComponent | component type to convert to. Must be a valid raw pixel component type (u8norm, float16_t or float32_t). |
| OutputComponentCount | number of component channels in the output image. Must be in the range [1, 4] (inclusive). |
| InputComponent | component type to convert from. Must be a valid raw pixel component type (u8norm, float16_t or float32_t). |
| InputComponentCount | number of component channels in the input image. Must be in the range [1, 4] (inclusive). |
| output | non-owning pointer to a block of memory containing the output image. Must point to a valid block of memory of at least the size required for a pixel in the specified output pixel format, and must not be nullptr. |
| input | non-owning read-only pointer to a block of memory containing the input image. Must point to a valid block of memory of at least the size required for a pixel in the specified input pixel format, and must not be nullptr. |
|
inlinestatic |
Convert the pixels in a region of a raw image to another raw pixel format.
| OutputComponent | component type to convert to. Must be a valid raw pixel component type (u8norm, float16_t or float32_t). |
| OutputComponentCount | number of component channels in the output image. Must be in the range [1, 4] (inclusive). |
| InputComponent | component type to convert from. Must be a valid raw pixel component type (u8norm, float16_t or float32_t). |
| InputComponentCount | number of component channels in the input image. Must be in the range [1, 4] (inclusive). |
| outputSize | size of the full mip level in the output image, in pixels. |
| output | non-owning pointer to a block of memory containing a full mip level of the output image. Must point to a valid block of memory of at least the size required for the full specified mip level in the specified output pixel format, including all layers, and must not be nullptr. |
| outputOffset | offset, in pixels, from the top left corner of the first layer of the output image to start pasting at, where the top left corner of the first layer of the converted image region will begin. |
| inputSize | size of the full mip level in the input image, in pixels. |
| input | non-owning read-only pointer to a block of memory containing a full mip level of the input image. Must point to a valid block of memory of at least the size required for the full specified mip level in the specified input pixel format, including all layers, and must not be nullptr. |
| inputRegion | region of the input mip level to convert from, relative to the top left corner of its first layer. |
|
inlinestatic |
Convert all pixels of a full raw image to another raw pixel format.
| OutputComponent | component type to convert to. Must be a valid raw pixel component type (u8norm, float16_t or float32_t). |
| OutputComponentCount | number of component channels in the output image. Must be in the range [1, 4] (inclusive). |
| InputComponent | component type to convert from. Must be a valid raw pixel component type (u8norm, float16_t or float32_t). |
| InputComponentCount | number of component channels in the input image. Must be in the range [1, 4] (inclusive). |
| size3D | size of the full input and output images, in pixels and layers. |
| mipLevelCount | number of mip levels in the input and output images. |
| output | non-owning pointer to a block of memory containing the output image. Must point to a valid block of memory of at least the size required for the full image in the specified output pixel format, including all layers and mip levels, and must not be nullptr. |
| input | non-owning read-only pointer to a block of memory containing the input image. Must point to a valid block of memory of at least the size required for the full image in the specified input pixel format, including all layers, and mip levels, and must not be nullptr. |
|
inlinestatic |
Copy the pixels in a region of a raw image to another image region in the same format.
| outputSize | size of the full mip level in the output image, in pixels. |
| output | non-owning pointer to a block of memory containing a full mip level of the output image. Must point to a valid block of memory of at least the size required for the full specified mip level in the specified output pixel format, including all layers, and must not be nullptr. |
| outputOffset | offset, in pixels, from the top left corner of the first layer of the output image to start pasting at, where the top left corner of the first layer of the copied image region will begin. |
| inputSize | size of the full mip level in the input image, in pixels. |
| input | non-owning read-only pointer to a block of memory containing a full mip level of the input image. Must point to a valid block of memory of at least the size required for the full specified mip level in the specified input pixel format, including all layers, and must not be nullptr. |
| inputRegion | region of the input mip level to copy from, relative to the top left corner of its first layer. |
| pixelStride | size of a single pixel, in bytes. Must be positive. |
|
inlinestatic |
Copy all pixels of a full raw image to another image in the same format.
| size3D | size of the full input and output images, in pixels and layers. |
| mipLevelCount | number of mip levels in the input and output images. |
| output | non-owning pointer to a block of memory containing the output image. Must point to a valid block of memory of at least the size required for the full image in the specified output pixel format, including all layers and mip levels, and must not be nullptr. |
| input | non-owning read-only pointer to a block of memory containing the input image. Must point to a valid block of memory of at least the size required for the full image in the specified input pixel format, including all layers, and mip levels, and must not be nullptr. |
| pixelStride | size of a single pixel, in bytes. Must be positive. |
|
inlinestatic |
Transform the pixels in a region of a raw image by a given operation.
| size | size of the full mip level in the image, in pixels. |
| pixels | non-owning pointer to a block of memory containing a full mip level of the image to transform. Must point to a valid block of memory of at least the size required for the full specified mip level in the specified pixel format, including all layers, and must not be nullptr. |
| region | region, in pixels, relative to the top left corner of the first layer of the image, to transform. |
| pixelStride | size of a single pixel, in bytes. Must be positive. |
| op | transformation to execute for each pixel in the specified region. Should return void and accept a byte pointer to the pixel's memory. |
|
inlinestatic |
Transform all pixels of a full raw image by a given operation.
| size3D | size of the full image, in pixels and layers. |
| mipLevelCount | number of mip levels in the image. |
| pixels | non-owning pointer to a block of memory containing the image to transform. Must point to a valid block of memory of at least the size required for the full image in the specified pixel format, including all layers and mip levels, and must not be nullptr. |
| pixelStride | size of a single pixel, in bytes. Must be positive. |
| op | transformation to execute for each pixel. Should return void and accept a byte pointer to the pixel's memory. |
|
inlinestatic |
Set the pixels in a region of a raw image to a specific pixel value.
| outputSize | size of the full mip level in the output image, in pixels. |
| output | non-owning pointer to a block of memory containing a full mip level of the output image. Must point to a valid block of memory of at least the size required for the full specified mip level in the specified output pixel format, including all layers, and must not be nullptr. |
| outputRegion | region, in pixels, relative to the top left corner of the first layer of the output image, to fill. |
| pixelStride | size of a single pixel, in bytes. Must be positive. |
| inputPixel | non-owning read-only pointer to a block of memory containing the input pixel. Must point to a valid block of memory of at least the size required for the stride of one pixel in the specified input pixel format, and must not be nullptr. |
|
inlinestatic |
Set all pixels of a full raw image to a specific pixel value.
| size3D | size of the full output image, in pixels and layers. |
| mipLevelCount | number of mip levels in the output image. |
| output | non-owning pointer to a block of memory containing the output image. Must point to a valid block of memory of at least the size required for the full image in the specified output pixel format, including all layers and mip levels, and must not be nullptr. |
| pixelStride | size of a single pixel, in bytes. Must be positive. |
| inputPixel | non-owning read-only pointer to a block of memory containing the input pixel. Must point to a valid block of memory of at least the size required for the stride of one pixel in the specified input pixel format, and must not be nullptr. |
|
inlinestatic |
Set a component of the pixels in a region of a raw image to a specific value.
| OutputComponent | component type of the image. Must be a valid raw pixel component type (u8norm, float16_t or float32_t). |
| OutputComponentCount | number of component channels in the image. Must be in the range [1, 4] (inclusive). |
| ComponentIndex | index of the component to set the value of. Must be less than OutputComponentCount. |
| outputSize | size of the full mip level in the output image, in pixels. |
| output | non-owning pointer to a block of memory containing a full mip level of the output image. Must point to a valid block of memory of at least the size required for the full specified mip level in the specified output pixel format, including all layers, and must not be nullptr. |
| outputRegion | region, in pixels, relative to the top left corner of the first layer of the output image, to fill. |
| value | value to set the given component of each pixel to. |
|
inlinestatic |
Set a component of all pixels of a full raw image to a specific value.
| OutputComponent | component type of the image. Must be a valid raw pixel component type (u8norm, float16_t or float32_t). |
| OutputComponentCount | number of component channels in the image. Must be in the range [1, 4] (inclusive). |
| ComponentIndex | index of the component to set the value of. Must be less than OutputComponentCount. |
| size3D | size of the full output image, in pixels and layers. |
| mipLevelCount | number of mip levels in the output image. |
| output | non-owning pointer to a block of memory containing the output image. Must point to a valid block of memory of at least the size required for the full image in the specified output pixel format, including all layers and mip levels, and must not be nullptr. |
| value | value to set the given component of each pixel to. |
|
inlinestatic |
Transform all pixels of a full raw RGBA image from straight to pre-multiplied alpha.
| PixelComponent | component type of the pixels in the image. Must be a valid raw pixel component type (u8norm, float16_t or float32_t). |
| TransferFunction | transfer function of the pixels in the image. |
| size3D | size of the full image, in pixels and layers. |
| mipLevelCount | number of mip levels in the image. |
| pixels | non-owning pointer to a block of memory containing the image to transform. Must point to a valid block of memory of at least the size required for the full image in the specified pixel format, including all layers and mip levels, and must not be nullptr. |
|
inlinestatic |
Transform all pixels of a full raw RGBA image from pre-multiplied to straight alpha.
| PixelComponent | component type of the pixels in the image. Must be a valid raw pixel component type (u8norm, float16_t or float32_t). |
| TransferFunction | transfer function of the pixels in the image. |
| size3D | size of the full image, in pixels and layers. |
| mipLevelCount | number of mip levels in the image. |
| pixels | non-owning pointer to a block of memory containing the image to transform. Must point to a valid block of memory of at least the size required for the full image in the specified pixel format, including all layers and mip levels, and must not be nullptr. |
|
inlinestatic |
Flip a layer of a raw image on the Y axis.
| size2D | size of the full image layer, in pixels. |
| pixels | non-owning pointer to a block of memory containing the raw image to flip. Must point to a valid block of memory of at least the size required for the full image layer in the specified pixel format, and must not be nullptr. |
| pixelStride | size of a single pixel in the image layer, in bytes. Must be positive. |
| std::length_error | if the maximum image size was exceeded. |
| std::bad_alloc | on allocation failure. |
|
staticnodiscard |
Determine which image file type a file should be parsed as based on the contents at the beginning of the file.
| fileContents | file contents to be parsed. |
|
static |
Save an 8-bit-per-channel image to a PNG file.
| image | view over the image to save. |
| filesystem | filesystem to save the file to. |
| filepath | output filepath at which to save the image. |
| options | saving options, see ImageSavePNGOptions. |
| File::Error | on failure to create or write to the file. |
| resource::Error | on failure to write a valid image to the file. |
| std::length_error | if the maximum image size was exceeded. |
| std::bad_alloc | on allocation failure. |
|
staticnodiscard |
Save an 8-bit-per-channel image to an in-memory PNG file.
| image | view over the image to save. |
| options | saving options, see ImageSavePNGOptions. |
| resource::Error | on failure to write a valid image. |
| std::length_error | if the maximum image size was exceeded. |
| std::bad_alloc | on allocation failure. |
|
static |
Save an 8-bit-per-channel image to a JPEG file.
| image | view over the image to save. |
| filesystem | filesystem to save the file to. |
| filepath | output filepath at which to save the image. |
| options | saving options, see ImageSaveJPEGOptions. |
| File::Error | on failure to create or write to the file. |
| resource::Error | on failure to write a valid image to the file. |
| std::length_error | if the maximum image size was exceeded. |
| std::bad_alloc | on allocation failure. |
|
staticnodiscard |
Save an 8-bit-per-channel image to an in-memory JPEG file.
| image | view over the image to save. |
| options | saving options, see ImageSaveJPEGOptions. |
| resource::Error | on failure to write a valid image. |
| std::length_error | if the maximum image size was exceeded. |
| std::bad_alloc | on allocation failure. |
|
static |
Save a floating-point 32-bit-per-channel image to an RGBE/Radiance HDR file.
| image | view over the image to save. |
| filesystem | filesystem to save the file to. |
| filepath | output filepath at which to save the image. |
| options | saving options, see ImageSaveHDROptions. |
| File::Error | on failure to create or write to the file. |
| resource::Error | on failure to write a valid image to the file. |
| std::length_error | if the maximum image size was exceeded. |
| std::bad_alloc | on allocation failure. |
|
staticnodiscard |
Save a floating-point 32-bit-per-channel image to an in-memory RGBE/Radiance HDR file.
| image | view over the image to save. |
| options | saving options, see ImageSaveHDROptions. |
| resource::Error | on failure to write a valid image. |
| std::length_error | if the maximum image size was exceeded. |
| std::bad_alloc | on allocation failure. |
|
static |
Save an image to a Khronos TeXture, version 2.0 file.
| image | view over the image to save. |
| filesystem | filesystem to save the file to. |
| filepath | output filepath at which to save the image. |
| options | saving options, see ImageSaveKTX2Options. |
| File::Error | on failure to create or write to the file. |
| resource::Error | on failure to write a valid image to the file. |
| std::length_error | if the maximum image size was exceeded. |
| std::bad_alloc | on allocation failure. |
|
staticnodiscard |
Save an image to an in-memory Khronos Texture, version 2.0 file.
| image | view over the image to save. |
| options | saving options, see ImageSaveKTX2Options. |
| resource::Error | on failure to write a valid image. |
| std::length_error | if the maximum image size was exceeded. |
| std::bad_alloc | on allocation failure. |
|
static |
Save an image to a file.
If the given filepath has a file extension, then the image will be saved in the file format corresponding to the extension, or throw an error if the image cannot be saved in that format.
Otherwise, the file format will be chosen automatically based on the type and format of the image, and the corresponding file extension will be added to the filepath.
The supported file formats are:
| image | view over the image to save. |
| filesystem | filesystem to save the file to. |
| filepath | output filepath at which to save the image. |
| options | saving options, see ImageSaveOptions. |
| File::Error | on failure to create or write to the file. |
| resource::Error | on failure to write a valid image to the file. |
| std::length_error | if the maximum image size was exceeded. |
| std::bad_alloc | on allocation failure. |
|
inlinenoexcept |
Get a read-only view over this image.
|
inlinenoexcept |
Get a view over this image.
|
inlinenoexcept |
Remove the value from this image and reset it to an empty image.
|
inline |
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 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. |
|
inline |
Transform the RGBA image pixel colors from straight to pre-multiplied alpha.
| transferFunction | transfer function of the pixels stored in the image. |
| std::invalid_argument | if the image is not in a raw color format with an alpha channel. |
| std::length_error | if the maximum image size was exceeded. |
| std::bad_alloc | on allocation failure. |
|
inline |
Transform the RGBA image pixel colors from pre-multiplied to straight alpha.
| transferFunction | transfer function of the pixels stored in the image. |
| std::invalid_argument | if the image is not in a raw color format with an alpha channel. |
| std::length_error | if the maximum image size was exceeded. |
| std::bad_alloc | on allocation failure. |
|
inlinenodiscardnoexcept |
Get the type of the image.
|
inlinenodiscardnoexcept |
Get the format of the image.
|
inlinenodiscardnoexcept |
Get the size, in pixels, of the image layers.
|
inlinenodiscardnoexcept |
Get the size, in pixels, and the depth, in layers, of the image.
|
inlinenodiscardnoexcept |
Get the width of the image.
|
inlinenodiscardnoexcept |
Get the height of the image.
|
inlinenodiscardnoexcept |
Get the depth of the image.
|
inlinenodiscardnoexcept |
Get the number of mip levels in the image referenced by this view.
|
inlinenodiscardnoexcept |
Get the data of this image.
|
inlinenodiscardnoexcept |
Get the data of this image.
|
inlinenodiscardnoexcept |
Get a pointer to the data of this image.
|
inlinenodiscardnoexcept |
Get a pointer to the data of this image.
|
inlinenodiscardnoexcept |
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. |
|
inlinenodiscard |
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. |
|
inlinenodiscard |
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. |
|
inlinenodiscard |
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. |
|
inlinenodiscard |
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. |
|
inlinenodiscard |
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. |
|
inlinenodiscard |
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. |
|
inlinenodiscard |
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. |
|
inlinenodiscard |
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. |
|
inlinenodiscard |
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. |
|
inlinenodiscard |
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. |
|
inlinenodiscard |
Get a uniformly padded version of the image.
The image must be in a raw format.
| paddingLeft | padding to add on the left side of the image, in pixels. |
| paddingRight | padding to add on the right side of the image, in pixels. |
| paddingBottom | padding to add on the bottom of the image, in pixels. |
| paddingTop | padding to add on the top 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. |
|
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. |