This is a snapshot of a work-in-progress documentation theme. If you feel lost, miss something, or want to see the original Doxygen docs instead, head over to the archived version of this documentation page.

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

Image data.

Access to either uncompressed or compressed image data provided by AbstractImporter subclasses, the compression state is distinguished with isCompressed(). Uncompressed images have format(), type(), pixelSize() and dataProperties() properties and are convertible to ImageView. Compressed images have just the compressedFormat() property and are convertible to CompressedImageView.

Uncompressed image is interchangeable with Image, ImageView or BufferImage, compressed with CompressedImage, CompressedImageView or CompressedBufferImage.

Public types

enum (anonymous): UnsignedInt { Dimensions = dimensions }

Constructors, destructors, conversion operators

ImageData(PixelStorage storage, PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept
Construct uncompressed image data.
ImageData(PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept
ImageData(PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, void* data) explicit noexcept
ImageData(CompressedPixelStorage storage, CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept
Construct compressed image data.
ImageData(CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept
Construct compressed image data.
ImageData(const ImageData<dimensions>&) deleted
Copying is not allowed.
ImageData(ImageData<dimensions>&& other) noexcept
Move constructor.
operator ImageView<dimensions>() const
Conversion to view.
operator CompressedImageView<dimensions>() const
Conversion to 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 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 type() const -> PixelType
Data type of pixel data.
auto compressedStorage() const -> CompressedPixelStorage
Storage of compressed pixel data.
auto compressedFormat() const -> CompressedPixelFormat
Format of compressed pixel data.
auto pixelSize() const -> std::size_t
Pixel size (in bytes)
auto size() const -> VectorTypeFor<dimensions, Int>
Image size.
auto dataProperties() const -> std::tuple<VectorTypeFor<dimensions, std::size_t>, VectorTypeFor<dimensions, std::size_t>, std::size_t>
Uncompressed image data properties.
auto data() & -> Containers::ArrayView<char>
Raw data.
auto data() && -> Containers::ArrayView<char> deleted
auto data() const & -> Containers::ArrayView<const char>
auto data() const && -> Containers::ArrayView<const char> deleted
template<class T>
auto data() -> T*
template<class T>
auto data() const -> const T*
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, PixelType type, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const void* importerState = nullptr) explicit noexcept

Construct uncompressed image data.

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

The data are expected to be of proper size for given storage parameters.

template<UnsignedInt dimensions>
Magnum::Trade::ImageData<dimensions>::ImageData(PixelFormat format, PixelType type, 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. Similar to the above, but uses default PixelStorage parameters.

template<UnsignedInt dimensions>
Magnum::Trade::ImageData<dimensions>::ImageData(PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, void* data) explicit noexcept

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 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

Note that the image data are not copied on construction, but they are deleted on class destruction.

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 compressed image data.

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

Similar the above, but uses default CompressedPixelStorage parameters (or the hardcoded ones in OpenGL ES and WebGL).

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

Conversion to view.

The image is expected to be uncompressed.

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

Conversion to compressed view.

The image is expected to be compressed.

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.

The image is expected to be uncompressed.

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

Data type of pixel data.

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.

The image is expected to be compressed.

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

Pixel size (in bytes)

The image is expected to be uncompressed.

template<UnsignedInt dimensions>
std::tuple<VectorTypeFor<dimensions, std::size_t>, VectorTypeFor<dimensions, std::size_t>, 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<char> Magnum::Trade::ImageData<dimensions>::data() &

Raw data.

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

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<const char> Magnum::Trade::ImageData<dimensions>::data() const &

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<const char> Magnum::Trade::ImageData<dimensions>::data() const && deleted

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> template<class T>
T* Magnum::Trade::ImageData<dimensions>::data()

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> template<class T>
const T* Magnum::Trade::ImageData<dimensions>::data() const

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::Array<char> Magnum::Trade::ImageData<dimensions>::release()

Release data storage.

Releases the ownership of the data array and resets internal state to default.

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

Importer-specific state.

See AbstractImporter::importerState() for more information.