BLImage Class Referencefinal

2D raster image [C++ API].

Member Functions

Construction & Destruction
Overloaded Operators
Common Functionality
Create Functionality
Accessors
Image Utilities
Image IO

Static Functions

Additional Inherited Members

- Public Attributes inherited from BLObjectCore

Member Function Documentation

BLResult BLImage::assignDeep(const BLImage& other)◆ 

Create a deep copy of the other image.

bool BLImage::empty() const◆ 

Tests whether the image is empty (has no size).

BLResult BLImage::create(int w, int h, BLFormat format)◆ 

Create a new image of a specified width w, height h, and format.

Note
It's important to always test whether the function succeeded as allocating pixel-data can fail. If invalid arguments (invalid size or format) were passed to the function a BL_ERROR_INVALID_VALUE result will be returned and no data will be allocated. It's also important to notice that BLImage::create() would not change anything if the function fails (the previous image content would be kept as is).

BLResult BLImage::createFromData(int w, int h, BLFormat format, void* pixelData, intptr_t stride, BLDataAccessFlags accessFlags = BL_DATA_ACCESS_RW, BLDestroyExternalDataFunc destroyFunc = nullptr, void* userData = nullptr)◆ 

Create a new image from external data.

int BLImage::width() const◆ 

Returns image width.

int BLImage::height() const◆ 

Returns image height.

BLSizeI BLImage::size() const◆ 

Returns image size.

BLFormat BLImage::format() const◆ 

Returns image format, see BLFormat.

uint32_t BLImage::depth() const◆ 

Returns image depth, in bits.

BLResult BLImage::getData(BLImageData* dataOut) const◆ 

Returns immutable in dataOut, which contains pixel pointer, stride, and other image properties like size and pixel format.

Note
Although the data is filled in BLImageData, which holds a non-const pixelData pointer, the data is immutable. If you intend to modify the data, use makeMutable() function instead, which would copy the image data if it's shared with another BLImage instance.

BLResult BLImage::makeMutable(BLImageData* dataOut)◆ 

Makes the image data mutable and returns them in dataOut.