struct mrpt::img::CImage::Impl

Overview

PIMPL actual struct holding the image data.

#include <mrpt/img/CImage.h>

struct Impl
{
    // fields

    int32_t width = 0;
    int32_t height = 0;
    TImageChannels channels = TImageChannels::CH_GRAY;
    PixelDepth depth = PixelDepth::D8U;
    uint8_t* image_data = nullptr;
    bool imgIsExternalStorage {false};
    std::string externalFile;

    // construction

    Impl();
    Impl(const Impl&);
    Impl(Impl&&);

    // methods

    Impl& operator = (const Impl&);
    Impl& operator = (Impl&&);
    bool empty() const;
    void clear();
    void clear_image_data();
    void deep_copy(const Impl& o);
    std::size_t image_buffer_size_bytes() const;
    std::size_t row_stride_in_bytes() const;
    std::size_t pixel_size_in_bytes() const;
};

Fields

uint8_t* image_data = nullptr

Pointer to the loaded image data.

bool imgIsExternalStorage {false}

Set to true only when using setExternalStorage.

See also:

setExternalStorage

std::string externalFile

The file name of a external storage image.

Methods

void clear()

Clears the image data, external image data, etc.

To clear just the image data, use clear_image_data()

std::size_t image_buffer_size_bytes() const

Returns the image buffer size according to width, height, channels, and pixel depth.

This function just computes the size of the image buffer in bytes from the properties filled in in the structure.