BLPixelConverter Class Reference

Pixel converter [C++ API].

Provides an interface to convert pixels between various pixel formats. The primary purpose of this class is to allow efficient conversion between pixel formats used natively by Blend2D and pixel formats used elsewhere, for example image codecs or native framebuffers.

Note
A default-initialized converter has a valid conversion function that would return BL_ERROR_NOT_INITIALIZED if invoked. Use isInitialized() member function to test whether the pixel converter was properly initialized.

Member Functions

Additional Inherited Members

- Public Attributes inherited from BLPixelConverterCore

Constructor & Destructor Documentation

BLPixelConverter::BLPixelConverter()[1/2]

Creates a new default-initialized pixel converter.

BLPixelConverter::BLPixelConverter(const BLPixelConverter& other)[2/2]

Creates a copy of the other converter.

If the other converter has dynamically allocated resources they will be properly managed (reference counting). Only very specific converters require such resources so this operation should be considered very cheap.

BLPixelConverter::~BLPixelConverter()

Destroys the pixel-converter and releases all resources allocated by it.

Member Function Documentation

bool BLPixelConverter::isInitialized() const

Returns true if the converter is initialized.

BLResult BLPixelConverter::reset()

Reset the pixel converter.

BLResult BLPixelConverter::assign(const BLPixelConverter& other)

Assigns the other pixel converter into this one.

BLResult BLPixelConverter::create(const BLFormatInfo& dstInfo, const BLFormatInfo& srcInfo, uint32_t createFlags = 0)

Creates a new pixel converter that will convert pixels described by srcInfo into pixels described by dstInfo.

Use createFlags to further specify the parameters of the conversion, see BLPixelConverterCreateFlags for more details.

Note
Destination and source format informattion must be valid, otherwise BL_ERROR_INVALID_VALUE would be returned.

BLResult BLPixelConverter::convertSpan(void* dstData, const void* srcData, uint32_t w, const BLPixelConverterOptions* options = nullptr) const

Converts a single span of pixels of w width.

BLResult BLPixelConverter::convertRect(void* dstData, intptr_t dstStride, const void* srcData, intptr_t srcStride, uint32_t w, uint32_t h, const BLPixelConverterOptions* options = nullptr) const

Converts a rectangular area of pixels from source format to destination.