1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 09:15:07 +00:00

LibDraw: Add ImageLoader, a simple abstraction for image loading

An ImageLoader is a generic interface for loading encoded image data of
any supported format. It has an ImageLoaderPlugin internally that does
all the work.

This patch adds an initial PNGImageLoaderPlugin that knows how to
retrieve the size of a PNG, and the bitmap. The API is divided into
size() and bitmap() to facilitate geometry-only decoding.
This will be useful in places like LibHTML where we need dimensions for
layout purposes but can wait with the bitmap until later.
This commit is contained in:
Andreas Kling 2019-10-15 21:48:08 +02:00
parent 5c2b21705a
commit 1bd2941467
5 changed files with 138 additions and 12 deletions

View file

@ -0,0 +1,11 @@
#include <LibDraw/ImageLoader.h>
#include <LibDraw/PNGLoader.h>
ImageLoader::ImageLoader(const u8* data, size_t size)
{
m_plugin = make<PNGImageLoaderPlugin>(data, size);
}
ImageLoader::~ImageLoader()
{
}