1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +00:00

LibGfx/ILBM: Add an IFF-ILBM decoder :)

IFF was a generic container fileformat that was popular on the Amiga
since it was the only file format supported by Deluxe Paint.

ILBM is an image format popular in the late eighties/nineties
that uses the IFF container.

This is a very first version of the decoder that only supports
(byterun) compressed files with bpp <= 8.

Only the minimal chunks are decoded: CMAP, BODY, BMHD.

I am planning to add support for the following variants:

- EHB (32 colours + lighter 32 colours)
- HAM6 / HAM8 (special mode that allowed to display the whole Amiga
4096 colours / 262 144 colours palette)
- TrueColor (24bit)

Things that could be fun to do:

- Still images could be animated using color cycle information
This commit is contained in:
Nicolas Ramz 2023-07-29 16:24:01 +02:00 committed by Sam Atkins
parent 66d6388b8a
commit fda5590313
12 changed files with 379 additions and 2 deletions

View file

@ -0,0 +1,32 @@
/*
* Copyright (c) 2023, Nicolas Ramz <nicolas.ramz@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGfx/ImageFormats/ImageDecoder.h>
namespace Gfx {
struct ILBMLoadingContext;
class ILBMImageDecoderPlugin final : public ImageDecoderPlugin {
public:
static bool sniff(ReadonlyBytes);
static ErrorOr<NonnullOwnPtr<ImageDecoderPlugin>> create(ReadonlyBytes);
virtual ~ILBMImageDecoderPlugin() override;
virtual IntSize size() override;
virtual ErrorOr<Optional<ReadonlyBytes>> icc_data() override;
virtual ErrorOr<ImageFrameDescriptor> frame(size_t index, Optional<IntSize> ideal_size = {}) override;
private:
ILBMImageDecoderPlugin(ReadonlyBytes, NonnullOwnPtr<ILBMLoadingContext>);
NonnullOwnPtr<ILBMLoadingContext> m_context;
};
}