namespace STB_RESTORE_WARNINGS

Overview

namespace STB_RESTORE_WARNINGS {

// global variables

const thread_local bool MRPT_DEBUG_IMG_LAZY_LOAD =     mrpt::get_env<bool>("MRPT_DEBUG_IMG_LAZY_LOAD", false);

// global functions

int stbDesiredChannels(mrpt::img::TImageChannels loadChannels, int sourceChannels);
stbir_pixel_layout mrpt_image_channel_to_stbir_layout(const mrpt::img::TImageChannels channels);
stbir_datatype mrpt_pixel_depth_to_stbir_type(const mrpt::img::PixelDepth depth);
void stbWriteToVectorCallback(void* context, void* data, int size);
void readPixelBuffer(mrpt::serialization::CArchive& in, uint8_t* data, std::size_t numBytes, mrpt::img::PixelDepth depth);
void writePixelBuffer(mrpt::serialization::CArchive& out, const uint8_t* data, std::size_t numBytes, mrpt::img::PixelDepth depth);

} // namespace STB_RESTORE_WARNINGS

Global Functions

int stbDesiredChannels(mrpt::img::TImageChannels loadChannels, int sourceChannels)

Number of channels to ask stb for.

CImage has no 2-channel layout, so gray+alpha sources are expanded to RGBA instead of dropping their alpha.

void stbWriteToVectorCallback(void* context, void* data, int size)

stb_image_write callback that appends the encoded bytes to a std::vector<uint8_t>, used by CImage::saveToStreamAsJPEG().

void readPixelBuffer(mrpt::serialization::CArchive& in, uint8_t* data, std::size_t numBytes, mrpt::img::PixelDepth depth)

Reads raw pixel bytes, converting 16-bit pixels from the little-endian stream format.

void writePixelBuffer(mrpt::serialization::CArchive& out, const uint8_t* data, std::size_t numBytes, mrpt::img::PixelDepth depth)

Writes raw pixel bytes, storing 16-bit pixels in little-endian order.