template<UnsignedInt dimensions>
Magnum::Trade::ImageData class

Image data.

Used mainly by AbstractImporter classes to store either compressed or non-compressed multi-dimensional image data together with layout and pixel format description.

This class can act as a drop-in replacement for Image or CompressedImage, ImageView or CompressedImageView and is implicitly convertible to either ImageView or CompressedImageView. Particular graphics API wrappers provide additional image classes, for example GL::BufferImage or GL::CompressedBufferImage.

Basic usage

The image usually comes out of AbstractImporter::image1D(), image2D() or image3D() and, based on what format the particular imported data is in, it stores either compressed or uncompressed data.

Containers::Array<char> data;
Trade::ImageData2D image{PixelFormat::RGB8Unorm, {32, 32}, std::move(data)};
Containers::Array<char> data;
Trade::ImageData2D image{CompressedPixelFormat::Bc1RGBUnorm,
    {32, 32}, std::move(data)};

As with Image / ImageView, this class supports extra storage parameters and implementation-specific format specification, if the importer has a need for that. See the ImageView documentation for more information.

When using the image, its compression status can be distinguished using isCompressed(). Uncompressed image properties are available through storage(), format(), formatExtra() and pixelSize(); compressed properties through compressedStorage() and compressedFormat(). Example of uploading the image to GL::Texture:

Containers::Pointer<Trade::AbstractImporter> importer;
Containers::Optional<Trade::ImageData2D> image = importer->image2D(0);
if(!image) Fatal{} << "Oopsie!";

GL::Texture2D texture;
// ...
if(!image->isCompressed())
    texture.setSubImage(0, {}, *image);
else
    texture.setCompressedSubImage(0, {}, *image);

Mutable data access

The interfaces implicitly provide const views on the contained pixel data through the data() and pixels() accessors. This is done because in general case the data can also refer to a memory-mapped file or constant memory. In cases when it's desirable to modify the data in-place, there's the mutableData() and mutablePixels() set of functions. To use these, you need to check that the data are mutable using dataFlags() first. The following snippet flips the R and B channels of the imported image:

if(data.isCompressed() ||
   data.format() != PixelFormat::RGB8Unorm ||
   !(data.dataFlags() & Trade::DataFlag::Mutable))
    Fatal{} << ":(";

for(auto&& row: data.mutablePixels<Color3ub>())
    for(Color3ub& pixel: row)
        pixel = Math::gather<'b', 'g', 'r'>(pixel);

Public types

enum (anonymous): UnsignedInt { Dimensions = dimensions }

Constructors, destructors, conversion operators

ImageData(PixelStorage storage, PixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept
Construct an uncompressed image data.
ImageData(PixelStorage storage, PixelFormat format, const VectorTypeFor<dimensions, Int>& size, DataFlags dataFlags, Containers::ArrayView<const void> data, const void* importerState = nullptr) explicit noexcept new in Git master
Construct a non-owned uncompressed image data.
ImageData(PixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept
Construct an uncompressed image data.
ImageData(PixelFormat format, const VectorTypeFor<dimensions, Int>& size, DataFlags dataFlags, Containers::ArrayView<const void> data, const void* importerState = nullptr) explicit noexcept new in Git master
Construct a non-owned uncompressed image data.
ImageData(PixelStorage storage, UnsignedInt format, UnsignedInt formatExtra, UnsignedInt pixelSize, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept
Construct an uncompressed image data with implementation-specific pixel format.
ImageData(PixelStorage storage, PixelFormat format, UnsignedInt formatExtra, UnsignedInt pixelSize, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept
ImageData(PixelStorage storage, UnsignedInt format, UnsignedInt formatExtra, UnsignedInt pixelSize, const VectorTypeFor<dimensions, Int>& size, DataFlags dataFlags, Containers::ArrayView<const void> data, const void* importerState = nullptr) explicit noexcept new in Git master
Construct a non-owned uncompressed image data with implementation-specific pixel format.
ImageData(PixelStorage storage, PixelFormat format, UnsignedInt formatExtra, UnsignedInt pixelSize, const VectorTypeFor<dimensions, Int>& size, DataFlags dataFlags, Containers::ArrayView<const void> data, const void* importerState = nullptr) explicit noexcept new in Git master
template<class T, class U>
ImageData(PixelStorage storage, T format, U formatExtra, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept
Construct an uncompressed image data with implementation-specific pixel format.
template<class T, class U>
ImageData(PixelStorage storage, T format, U formatExtra, const VectorTypeFor<dimensions, Int>& size, DataFlags dataFlags, Containers::ArrayView<const void> data, const void* importerState = nullptr) explicit noexcept new in Git master
Construct a non-owned uncompressed image data with implementation-specific pixel format.
template<class T>
ImageData(PixelStorage storage, T format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept
Construct an uncompressed image data with implementation-specific pixel format.
template<class T>
ImageData(PixelStorage storage, T format, const VectorTypeFor<dimensions, Int>& size, DataFlags dataFlags, Containers::ArrayView<const void> data, const void* importerState = nullptr) explicit noexcept new in Git master
Construct a non-owned uncompressed image data with implementation-specific pixel format.
ImageData(CompressedPixelStorage storage, CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept
Construct a compressed image data.
ImageData(CompressedPixelStorage storage, CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, DataFlags dataFlags, Containers::ArrayView<const void> data, const void* importerState = nullptr) explicit noexcept new in Git master
Construct a non-owned compressed image data.
ImageData(CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept
Construct a compressed image data.
ImageData(CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, DataFlags dataFlags, Containers::ArrayView<const void> data, const void* importerState = nullptr) explicit noexcept new in Git master
Construct a non-owned compressed image data.
template<class T>
ImageData(CompressedPixelStorage storage, T format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept
Construct a compressed image data.
template<class T>
ImageData(CompressedPixelStorage storage, T format, const VectorTypeFor<dimensions, Int>& size, DataFlags dataFlags, Containers::ArrayView<const void> data, const void* importerState = nullptr) explicit noexcept new in Git master
Construct a non-owned compressed image data.
ImageData(ImageData<dimensions>&& other, const void* importerState) explicit noexcept
Construct from existing data with attached importer state.
ImageData(const ImageData<dimensions>&) deleted
Copying is not allowed.
ImageData(ImageData<dimensions>&& other) noexcept
Move constructor.
operator BasicImageView<dimensions>() const
Conversion to a view.
operator BasicMutableImageView<dimensions>() new in 2019.10
Conversion to a mutable view.
operator BasicCompressedImageView<dimensions>() const
Conversion to a compressed view.
operator BasicMutableCompressedImageView<dimensions>() new in 2019.10
Conversion to a mutable compressed view.

Public functions

auto operator=(const ImageData<dimensions>&) -> ImageData<dimensions>& deleted
Copying is not allowed.
auto operator=(ImageData<dimensions>&& other) -> ImageData<dimensions>& noexcept
Move assignment.
auto dataFlags() const -> DataFlags new in Git master
Data flags.
auto isCompressed() const -> bool
Whether the image is compressed.
auto storage() const -> PixelStorage
Storage of pixel data.
auto format() const -> PixelFormat
Format of pixel data.
auto formatExtra() const -> UnsignedInt
Additional pixel format specifier.
auto compressedStorage() const -> CompressedPixelStorage
Storage of compressed pixel data.
auto compressedFormat() const -> CompressedPixelFormat
Format of compressed pixel data.
auto pixelSize() const -> UnsignedInt
Pixel size (in bytes)
auto size() const -> VectorTypeFor<dimensions, Int>
Image size.
auto dataProperties() const -> std::pair<VectorTypeFor<dimensions, std::size_t>, VectorTypeFor<dimensions, std::size_t>>
Uncompressed image data properties.
auto data() const & -> Containers::ArrayView<const char>
Image data.
auto data() && -> Containers::Array<char> new in 2019.10
Image data from a r-value.
auto data() const && -> Containers::Array<char> deleted new in 2019.10
auto mutableData() & -> Containers::ArrayView<char> new in Git master
Mutable image data.
template<class T>
auto data() -> T* deprecated in 2019.10
Image data in a particular type.
template<class T>
auto data() const -> const T* deprecated in 2019.10
Image data in a particular type.
auto pixels() const -> Containers::StridedArrayView<dimensions+1, const char> new in 2019.10
View on pixel data.
auto mutablePixels() -> Containers::StridedArrayView<dimensions+1, char> new in Git master
Mutable view on pixel data.
template<class T>
auto pixels() const -> Containers::StridedArrayView<dimensions, const T> new in 2019.10
View on pixel data with a concrete pixel type.
template<class T>
auto mutablePixels() -> Containers::StridedArrayView<dimensions, T> new in 2019.10
Mutable view on pixel data with a concrete pixel type.
auto release() -> Containers::Array<char>
Release data storage.
auto importerState() const -> const void*
Importer-specific state.

Enum documentation

template<UnsignedInt dimensions>
enum Magnum::Trade::ImageData<dimensions>::(anonymous): UnsignedInt

Enumerators
Dimensions

Image dimension count

Function documentation

template<UnsignedInt dimensions>
Magnum::Trade::ImageData<dimensions>::ImageData(PixelStorage storage, PixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept

Construct an uncompressed image data.

Parameters
storage Storage of pixel data
format Format of pixel data
size Image size
data Image data
importerState Importer-specific state

The data array is expected to be of proper size for given parameters.

The dataFlags() are implicitly set to a combination of DataFlag::Owned and DataFlag::Mutable. For non-owned data use the ImageData(PixelStorage, PixelFormat, const VectorTypeFor<dimensions, Int>&, DataFlags, Containers::ArrayView<const void>, const void*) constructor instead.

template<UnsignedInt dimensions>
Magnum::Trade::ImageData<dimensions>::ImageData(PixelStorage storage, PixelFormat format, const VectorTypeFor<dimensions, Int>& size, DataFlags dataFlags, Containers::ArrayView<const void> data, const void* importerState = nullptr) explicit noexcept new in Git master

Construct a non-owned uncompressed image data.

Parameters
storage Storage of pixel data
format Format of pixel data
size Image size
dataFlags Data flags
data View on image data
importerState Importer-specific state

Compared to ImageData(PixelStorage, PixelFormat, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, const void*) creates an instance that doesn't own the passed data. The dataFlags parameter can contain DataFlag::Mutable to indicate the external data can be modified, and is expected to not have DataFlag::Owned set.

template<UnsignedInt dimensions>
Magnum::Trade::ImageData<dimensions>::ImageData(PixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept

Construct an uncompressed image data.

Parameters
format Format of pixel data
size Image size
data Image data
importerState Importer-specific state

Equivalent to calling ImageData(PixelStorage, PixelFormat, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, const void*) with default-constructed PixelStorage.

template<UnsignedInt dimensions>
Magnum::Trade::ImageData<dimensions>::ImageData(PixelFormat format, const VectorTypeFor<dimensions, Int>& size, DataFlags dataFlags, Containers::ArrayView<const void> data, const void* importerState = nullptr) explicit noexcept new in Git master

Construct a non-owned uncompressed image data.

Parameters
format Format of pixel data
size Image size
dataFlags Data flags
data View on image data
importerState Importer-specific state

Compared to ImageData(PixelFormat, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, const void*) creates an instance that doesn't own the passed data. The dataFlags parameter can contain DataFlag::Mutable to indicate the external data can be modified, and is expected to not have DataFlag::Owned set.

template<UnsignedInt dimensions>
Magnum::Trade::ImageData<dimensions>::ImageData(PixelStorage storage, UnsignedInt format, UnsignedInt formatExtra, UnsignedInt pixelSize, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept

Construct an uncompressed image data with implementation-specific pixel format.

Parameters
storage Storage of pixel data
format Format of pixel data
formatExtra Additional pixel format specifier
pixelSize Size of a pixel in given format
size Image size
data Image data
importerState Importer-specific state

Unlike with ImageData(PixelStorage, PixelFormat, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, const void*), where pixel size is calculated automatically using pixelSize(PixelFormat), this allows you to specify an implementation-specific pixel format and pixel size directly. Uses pixelFormatWrap() internally to wrap format in PixelFormat.

The data array is expected to be of proper size for given parameters. The dataFlags() are implicitly set to a combination of DataFlag::Owned and DataFlag::Mutable. For non-owned data use the ImageData(PixelStorage, UnsignedInt, UnsignedInt, UnsignedInt, const VectorTypeFor<dimensions, Int>&, DataFlags, Containers::ArrayView<const void>, const void*) constructor instead.

template<UnsignedInt dimensions>
Magnum::Trade::ImageData<dimensions>::ImageData(PixelStorage storage, PixelFormat format, UnsignedInt formatExtra, UnsignedInt pixelSize, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Equivalent to the above for format already wrapped with pixelFormatWrap().

template<UnsignedInt dimensions>
Magnum::Trade::ImageData<dimensions>::ImageData(PixelStorage storage, UnsignedInt format, UnsignedInt formatExtra, UnsignedInt pixelSize, const VectorTypeFor<dimensions, Int>& size, DataFlags dataFlags, Containers::ArrayView<const void> data, const void* importerState = nullptr) explicit noexcept new in Git master

Construct a non-owned uncompressed image data with implementation-specific pixel format.

Parameters
storage Storage of pixel data
format Format of pixel data
formatExtra Additional pixel format specifier
pixelSize Size of a pixel in given format
size Image size
dataFlags Data flags
data View on image data
importerState Importer-specific state

Compared to ImageData(PixelStorage, UnsignedInt, UnsignedInt, UnsignedInt, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, const void*) creates an instance that doesn't own the passed data. The dataFlags parameter can contain DataFlag::Mutable to indicate the external data can be modified, and is expected to not have DataFlag::Owned set.

template<UnsignedInt dimensions>
Magnum::Trade::ImageData<dimensions>::ImageData(PixelStorage storage, PixelFormat format, UnsignedInt formatExtra, UnsignedInt pixelSize, const VectorTypeFor<dimensions, Int>& size, DataFlags dataFlags, Containers::ArrayView<const void> data, const void* importerState = nullptr) explicit noexcept new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Equivalent to the above for format already wrapped with pixelFormatWrap().

template<UnsignedInt dimensions> template<class T, class U>
Magnum::Trade::ImageData<dimensions>::ImageData(PixelStorage storage, T format, U formatExtra, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept

Construct an uncompressed image data with implementation-specific pixel format.

Parameters
storage Storage of pixel data
format Format of pixel data
formatExtra Additional pixel format specifier
size Image size
data Image data
importerState Importer-specific state

Uses ADL to find a corresponding pixelSize(T, U) overload, then calls ImageData(PixelStorage, UnsignedInt, UnsignedInt, UnsignedInt, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, const void*) with calculated pixel size.

template<UnsignedInt dimensions> template<class T, class U>
Magnum::Trade::ImageData<dimensions>::ImageData(PixelStorage storage, T format, U formatExtra, const VectorTypeFor<dimensions, Int>& size, DataFlags dataFlags, Containers::ArrayView<const void> data, const void* importerState = nullptr) explicit noexcept new in Git master

Construct a non-owned uncompressed image data with implementation-specific pixel format.

Parameters
storage Storage of pixel data
format Format of pixel data
formatExtra Additional pixel format specifier
size Image size
dataFlags Data flags
data View on image data
importerState Importer-specific state

Compared to ImageData(PixelStorage, T, U, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, const void*) creates an instance that doesn't own the passed data. The dataFlags parameter can contain DataFlag::Mutable to indicate the external data can be modified, and is expected to not have DataFlag::Owned set.

template<UnsignedInt dimensions> template<class T>
Magnum::Trade::ImageData<dimensions>::ImageData(PixelStorage storage, T format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept

Construct an uncompressed image data with implementation-specific pixel format.

Parameters
storage Storage of pixel data
format Format of pixel data
size Image size
data Image data
importerState Importer-specific state

Uses ADL to find a corresponding pixelSize(T) overload, then calls ImageData(PixelStorage, UnsignedInt, UnsignedInt, UnsignedInt, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, const void*) with calculated pixel size and formatExtra set to 0.

template<UnsignedInt dimensions> template<class T>
Magnum::Trade::ImageData<dimensions>::ImageData(PixelStorage storage, T format, const VectorTypeFor<dimensions, Int>& size, DataFlags dataFlags, Containers::ArrayView<const void> data, const void* importerState = nullptr) explicit noexcept new in Git master

Construct a non-owned uncompressed image data with implementation-specific pixel format.

Parameters
storage Storage of pixel data
format Format of pixel data
size Image size
dataFlags Data flags
data view on image data
importerState Importer-specific state

Compared to ImageData(PixelStorage, T, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, const void*) creates an instance that doesn't own the passed data. The dataFlags parameter can contain DataFlag::Mutable to indicate the external data can be modified, and is expected to not have DataFlag::Owned set.

template<UnsignedInt dimensions>
Magnum::Trade::ImageData<dimensions>::ImageData(CompressedPixelStorage storage, CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept

Construct a compressed image data.

Parameters
storage Storage of compressed pixel data
format Format of compressed pixel data
size Image size
data Image data
importerState Importer-specific state

template<UnsignedInt dimensions>
Magnum::Trade::ImageData<dimensions>::ImageData(CompressedPixelStorage storage, CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, DataFlags dataFlags, Containers::ArrayView<const void> data, const void* importerState = nullptr) explicit noexcept new in Git master

Construct a non-owned compressed image data.

Parameters
storage Storage of compressed pixel data
format Format of compressed pixel data
size Image size
dataFlags Data flags
data View on image data
importerState Importer-specific state

Compared to ImageData(CompressedPixelStorage, CompressedPixelFormat, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, const void*) creates an instance that doesn't own the passed data. The dataFlags parameter can contain DataFlag::Mutable to indicate the external data can be modified, and is expected to not have DataFlag::Owned set.

template<UnsignedInt dimensions>
Magnum::Trade::ImageData<dimensions>::ImageData(CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept

Construct a compressed image data.

Parameters
format Format of compressed pixel data
size Image size
data Image data
importerState Importer-specific state

Equivalent to calling ImageData(CompressedPixelStorage, CompressedPixelFormat, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, const void*) with default-constructed CompressedPixelStorage.

template<UnsignedInt dimensions>
Magnum::Trade::ImageData<dimensions>::ImageData(CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, DataFlags dataFlags, Containers::ArrayView<const void> data, const void* importerState = nullptr) explicit noexcept new in Git master

Construct a non-owned compressed image data.

Parameters
format Format of compressed pixel data
size Image size
dataFlags Data flags
data View on image data
importerState Importer-specific state

Compared to ImageData(CompressedPixelFormat, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, const void*) creates an instance that doesn't own the passed data. The dataFlags parameter can contain DataFlag::Mutable to indicate the external data can be modified, and is expected to not have DataFlag::Owned set.

template<UnsignedInt dimensions> template<class T>
Magnum::Trade::ImageData<dimensions>::ImageData(CompressedPixelStorage storage, T format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept

Construct a compressed image data.

Parameters
storage Storage of compressed pixel data
format Format of compressed pixel data
size Image size
data Image data
importerState Importer-specific state

Uses compressedPixelFormatWrap() internally to convert format to CompressedPixelFormat.

template<UnsignedInt dimensions> template<class T>
Magnum::Trade::ImageData<dimensions>::ImageData(CompressedPixelStorage storage, T format, const VectorTypeFor<dimensions, Int>& size, DataFlags dataFlags, Containers::ArrayView<const void> data, const void* importerState = nullptr) explicit noexcept new in Git master

Construct a non-owned compressed image data.

Parameters
storage Storage of compressed pixel data
format Format of compressed pixel data
size Image size
dataFlags Data flags
data View on image data
importerState Importer-specific state

Compared to ImageData(CompressedPixelStorage, T, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, const void*) creates an instance that doesn't own the passed data. The dataFlags parameter can contain DataFlag::Mutable to indicate the external data can be modified, and is expected to not have DataFlag::Owned set.

template<UnsignedInt dimensions>
Magnum::Trade::ImageData<dimensions>::ImageData(ImageData<dimensions>&& other, const void* importerState) explicit noexcept

Construct from existing data with attached importer state.

Useful in cases where importer plugins proxy image loading through other importers but want to attach its own importer state to the imported data. Importer state from the other object is replaced with importerState, data ownership is transferred and everything else stays the same.

template<UnsignedInt dimensions>
Magnum::Trade::ImageData<dimensions>::operator BasicImageView<dimensions>() const

Conversion to a view.

The image is expected to be uncompressed.

template<UnsignedInt dimensions>
Magnum::Trade::ImageData<dimensions>::operator BasicMutableImageView<dimensions>() new in 2019.10

Conversion to a mutable view.

The image is expected to be uncompressed and mutable.

template<UnsignedInt dimensions>
Magnum::Trade::ImageData<dimensions>::operator BasicCompressedImageView<dimensions>() const

Conversion to a compressed view.

The image is expected to be compressed.

template<UnsignedInt dimensions>
Magnum::Trade::ImageData<dimensions>::operator BasicMutableCompressedImageView<dimensions>() new in 2019.10

Conversion to a mutable compressed view.

The image is expected to be compressed and mutable.

template<UnsignedInt dimensions>
PixelStorage Magnum::Trade::ImageData<dimensions>::storage() const

Storage of pixel data.

The image is expected to be uncompressed.

template<UnsignedInt dimensions>
PixelFormat Magnum::Trade::ImageData<dimensions>::format() const

Format of pixel data.

Returns either a defined value from the PixelFormat enum or a wrapped implementation-specific value. Use isPixelFormatImplementationSpecific() to distinguish the case and pixelFormatUnwrap() to extract an implementation-specific value, if needed.

The image is expected to be uncompressed.

template<UnsignedInt dimensions>
UnsignedInt Magnum::Trade::ImageData<dimensions>::formatExtra() const

Additional pixel format specifier.

Some implementations (such as OpenGL) define a pixel format using two values. This field contains the second implementation-specific value verbatim, if any. See format() for more information.

The image is expected to be uncompressed.

template<UnsignedInt dimensions>
CompressedPixelStorage Magnum::Trade::ImageData<dimensions>::compressedStorage() const

Storage of compressed pixel data.

The image is expected to be compressed.

template<UnsignedInt dimensions>
CompressedPixelFormat Magnum::Trade::ImageData<dimensions>::compressedFormat() const

Format of compressed pixel data.

Returns either a defined value from the CompressedPixelFormat enum or a wrapped implementation-specific value. Use isCompressedPixelFormatImplementationSpecific() to distinguish the case and compressedPixelFormatUnwrap() to extract an implementation-specific value, if needed.

The image is expected to be compressed.

template<UnsignedInt dimensions>
UnsignedInt Magnum::Trade::ImageData<dimensions>::pixelSize() const

Pixel size (in bytes)

The image is expected to be uncompressed.

template<UnsignedInt dimensions>
std::pair<VectorTypeFor<dimensions, std::size_t>, VectorTypeFor<dimensions, std::size_t>> Magnum::Trade::ImageData<dimensions>::dataProperties() const

Uncompressed image data properties.

The image is expected to be uncompressed. See PixelStorage::dataProperties() for more information.

template<UnsignedInt dimensions>
Containers::ArrayView<const char> Magnum::Trade::ImageData<dimensions>::data() const &

Image data.

template<UnsignedInt dimensions>
Containers::Array<char> Magnum::Trade::ImageData<dimensions>::data() && new in 2019.10

Image data from a r-value.

Unlike data(), which returns a view, this is equivalent to release() to avoid a dangling view when the temporary instance goes out of scope. Note that the returned array has a custom no-op deleter when the data are not owned by the image, and while the returned array type is mutable, the actual memory might be not.

template<UnsignedInt dimensions>
Containers::Array<char> Magnum::Trade::ImageData<dimensions>::data() const && deleted new in 2019.10

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<UnsignedInt dimensions>
Containers::ArrayView<char> Magnum::Trade::ImageData<dimensions>::mutableData() & new in Git master

Mutable image data.

Like data(), but returns a non-const view. Expects that the image is mutable.

template<UnsignedInt dimensions> template<class T>
T* Magnum::Trade::ImageData<dimensions>::data()

Image data in a particular type.

template<UnsignedInt dimensions> template<class T>
const T* Magnum::Trade::ImageData<dimensions>::data() const

Image data in a particular type.

template<UnsignedInt dimensions>
Containers::StridedArrayView<dimensions+1, const char> Magnum::Trade::ImageData<dimensions>::pixels() const new in 2019.10

View on pixel data.

Provides direct and easy-to-use access to image pixels. Expects that the image is not compressed. The last dimension represents the actual data type (its size is equal to type size) and is guaranteed to be contiguous. Use the templated overload below to get pixels in a concrete type. See Obtaining a view on pixel data for more information.

template<UnsignedInt dimensions>
Containers::StridedArrayView<dimensions+1, char> Magnum::Trade::ImageData<dimensions>::mutablePixels() new in Git master

Mutable view on pixel data.

Like pixels() const, but returns a non-const view. Expects that the image is mutable.

template<UnsignedInt dimensions> template<class T>
Containers::StridedArrayView<dimensions, const T> Magnum::Trade::ImageData<dimensions>::pixels() const new in 2019.10

View on pixel data with a concrete pixel type.

Compared to non-templated pixels() in addition casts the pixel data to a specified type. The user is responsible for choosing correct type for given format() — checking it on the library side is not possible for the general case.

template<UnsignedInt dimensions> template<class T>
Containers::StridedArrayView<dimensions, T> Magnum::Trade::ImageData<dimensions>::mutablePixels() new in 2019.10

Mutable view on pixel data with a concrete pixel type.

Like pixels() const, but returns a non-const view. Expects that the image is mutable.

template<UnsignedInt dimensions>
Containers::Array<char> Magnum::Trade::ImageData<dimensions>::release()

Release data storage.

Releases the ownership of the data array and resets internal state to default. The image then behaves like it's empty. Note that the returned array has a custom no-op deleter when the data are not owned by the image, and while the returned array type is mutable, the actual memory might be not.

template<UnsignedInt dimensions>
const void* Magnum::Trade::ImageData<dimensions>::importerState() const

Importer-specific state.

See AbstractImporter::importerState() for more information.