Skip to content

IImageLoader#

Decoder of one image file format.

Header:#include <AUI/Image/IImageLoader.h>
CMake:aui_link(my_target PUBLIC aui::image)

Detailed Description#

Implement this interface to teach AUI a new image format, then register the implementation in AImageLoaderRegistry. See Adding a custom image format for a walkthrough.

matches is asked first; it should sniff the magic bytes of the file, not the file name. If it returns true, the registry calls getRasterImage (raster loaders) or getImageFactory (vector and animated loaders).

Public Methods#

getImageFactory#


virtual _<IImageFactory> IImageLoader::getImageFactory(AByteBufferView buffer)

The drawable (vector) image loader implementation.

Returns
image factory. Can be nullptr if getRasterImage implemented.

Called if and only if matches returned true.

getRasterImage#


virtual _<AImage> IImageLoader::getRasterImage(AByteBufferView buffer)

The image loader implementation (raster).

Returns
raster image. Can be nullptr if getDrawable implemented.

Called if and only if matches returned true.

matches#


virtual bool IImageLoader::matches(AByteBufferView buffer)
Arguments
buffer
buffer with the raw image file contents.
Returns
true, if this IImageLoader accepts image stored in this buffer