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::Image class

Image.

Stores image data on client memory. Interchangeable with ImageView, BufferImage or Trade::ImageData.

Public types

enum (anonymous): UnsignedInt { Dimensions = dimensions }

Constructors, destructors, conversion operators

Image(PixelStorage storage, PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data) explicit noexcept
Constructor.
Image(PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data) explicit noexcept
Image(PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, void* data) explicit noexcept
Image(PixelStorage storage, PixelFormat format, PixelType type) noexcept
Constructor.
Image(PixelFormat format, PixelType type) noexcept
Image(const Image<dimensions>&) deleted
Copying is not allowed.
Image(Image<dimensions>&& other) noexcept
Move constructor.
operator ImageView<dimensions>() const
Conversion to view.

Public functions

auto operator=(const Image<dimensions>&) -> Image<dimensions>& deleted
Copying is not allowed.
auto operator=(Image<dimensions>&& other) -> Image<dimensions>& noexcept
Move assignment.
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 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>
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 = char>
auto data() -> T*
template<class T = char>
auto data() const -> const T*
void setData(PixelStorage storage, PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data)
Set image data.
void setData(PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data)
void setData(PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, void* data)
auto release() -> Containers::Array<char>
Release data storage.

Enum documentation

template<UnsignedInt dimensions>
enum Magnum::Image<dimensions>::(anonymous): UnsignedInt

Enumerators
Dimensions

Image dimension count

Function documentation

template<UnsignedInt dimensions>
Magnum::Image<dimensions>::Image(PixelStorage storage, PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data) explicit noexcept

Constructor.

Parameters
storage Storage of pixel data
format Format of pixel data
type Data type of pixel data
size Image size
data Image data

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

template<UnsignedInt dimensions>
Magnum::Image<dimensions>::Image(PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data) 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::Image<dimensions>::Image(PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, void* data) explicit noexcept

template<UnsignedInt dimensions>
Magnum::Image<dimensions>::Image(PixelStorage storage, PixelFormat format, PixelType type) noexcept

Constructor.

Parameters
storage Storage of pixel data
format Format of pixel data
type Data type of pixel data

Dimensions are set to zero and data pointer to nullptr, call setData() to fill the image with data or use *Texture::image()/ *Texture::subImage()/ *Framebuffer::read() to fill the image with data using storage settings.

template<UnsignedInt dimensions>
Magnum::Image<dimensions>::Image(PixelFormat format, PixelType type) 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>
std::size_t Magnum::Image<dimensions>::pixelSize() const

Pixel size (in bytes)

template<UnsignedInt dimensions>
std::tuple<VectorTypeFor<dimensions, std::size_t>, VectorTypeFor<dimensions, std::size_t>, std::size_t> Magnum::Image<dimensions>::dataProperties() const

Image data properties.

See PixelStorage::dataProperties() for more information.

template<UnsignedInt dimensions>
Containers::ArrayView<char> Magnum::Image<dimensions>::data() &

Raw data.

template<UnsignedInt dimensions>
Containers::ArrayView<char> Magnum::Image<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::Image<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::Image<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 = char>
T* Magnum::Image<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 = char>
const T* Magnum::Image<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>
void Magnum::Image<dimensions>::setData(PixelStorage storage, PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data)

Set 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

Deletes previous data and replaces them with new. The data are expected to be of proper size for given storage parameters.

template<UnsignedInt dimensions>
void Magnum::Image<dimensions>::setData(PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data)

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>
void Magnum::Image<dimensions>::setData(PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, void* data)

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

Release data storage.

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