Magnum::PixelStorage class

Pixel storage parameters.

Descibes how to interpret data which are read from or stored into Image, ImageView, Trade::ImageData or for example GL::BufferImage.

Derived classes

class CompressedPixelStorage
Compressed pixel storage parameters.

Public static functions

template<class = void>
static auto pixelSize(GL::PixelFormat format, GL::PixelType type) -> std::size_t deprecated
Pixel size.
template<class T = void>
static auto pixelSize(PixelFormat format, GL::PixelType type) -> std::size_t deprecated
Pixel size.

Constructors, destructors, conversion operators

PixelStorage() constexpr noexcept
Default constructor.

Public functions

auto operator==(const PixelStorage& other) const -> bool
Equality comparison.
auto operator!=(const PixelStorage& other) const -> bool
Non-equality comparison.
auto alignment() const -> Int constexpr
Row alignment.
auto setAlignment(Int alignment) -> PixelStorage&
Set row alignment.
auto rowLength() const -> Int constexpr
Row length.
auto setRowLength(Int length) -> PixelStorage&
Set row length.
auto imageHeight() const -> Int constexpr
Image height.
auto setImageHeight(Int height) -> PixelStorage&
Set image height.
auto skip() const -> Vector3i constexpr
Pixel, row and image skipping.
auto setSkip(const Vector3i& skip) -> PixelStorage&
Set pixel, row and image skipping.
auto dataProperties(std::size_t pixelSize, const Vector3i& size) const -> std::pair<Math::Vector3<std::size_t>, Math::Vector3<std::size_t>>
Data properties for given parameters.
template<class = void>
auto dataProperties(GL::PixelFormat format, GL::PixelType type, const Vector3i& size) const -> std::tuple<Math::Vector3<std::size_t>, Math::Vector3<std::size_t>, std::size_t> deprecated
Data properties for given parameters.
template<class T = void>
auto dataProperties(PixelFormat format, GL::PixelType type, const Vector3i& size) const -> std::tuple<Math::Vector3<std::size_t>, Math::Vector3<std::size_t>, std::size_t> deprecated
Data properties for given parameters.

Function documentation

template<class = void>
static std::size_t Magnum::PixelStorage::pixelSize(GL::PixelFormat format, GL::PixelType type)

Pixel size.

template<class T = void>
static std::size_t Magnum::PixelStorage::pixelSize(PixelFormat format, GL::PixelType type)

Pixel size.

Magnum::PixelStorage::PixelStorage() constexpr noexcept

Default constructor.

Sets all parameters to default values, i.e. all values set to false / 0 except for alignment, which is 4.

PixelStorage& Magnum::PixelStorage::setAlignment(Int alignment)

Set row alignment.

Not applicable for CompressedPixelStorage. Valid values are 1, 2, 4 and 8. Default is 4.

PixelStorage& Magnum::PixelStorage::setRowLength(Int length)

Set row length.

Used only on 2D and 3D images. If set to 0, size information from the actual image is used. Default is 0.

PixelStorage& Magnum::PixelStorage::setImageHeight(Int height)

Set image height.

Used only on 3D images. If set to 0, size information from the actual image is used. Default is 0.

PixelStorage& Magnum::PixelStorage::setSkip(const Vector3i& skip)

Set pixel, row and image skipping.

The Y value is used only for 2D and 3D images, the Z value is used only for 3D images. Default is 0.

std::pair<Math::Vector3<std::size_t>, Math::Vector3<std::size_t>> Magnum::PixelStorage::dataProperties(std::size_t pixelSize, const Vector3i& size) const

Data properties for given parameters.

Returns byte offset in each direction and {rowLength, rowCount, layerCount} for image of given size with current pixel storage parameters, and given pixelSize. The offset reflects the skip() parameter. Sum of the byte offset vector gives the byte offset of first pixel in the data array.

template<class = void>
std::tuple<Math::Vector3<std::size_t>, Math::Vector3<std::size_t>, std::size_t> Magnum::PixelStorage::dataProperties(GL::PixelFormat format, GL::PixelType type, const Vector3i& size) const

Data properties for given parameters.

Returns byte offset in each direction, (row length, row count, layer count) and pixel size for image of given size with current pixel storage parameters, format and type.

template<class T = void>
std::tuple<Math::Vector3<std::size_t>, Math::Vector3<std::size_t>, std::size_t> Magnum::PixelStorage::dataProperties(PixelFormat format, GL::PixelType type, const Vector3i& size) const

Data properties for given parameters.

Returns byte offset in each direction, (row length, row count, layer count) and pixel size for image of given size with current pixel storage parameters, format and type.