ladybird/Userland/Libraries/LibGfx/ImageFormats/JPEGXLLoader.h
Lucas CHOLLET e8a63eeb0e LibGfx/JPEGXL: Add a JPEG-XL decoder :^)
JPEG-XL is a new image format standardized by the same committee as the
original JPEG image format. It has all the nice feature of recent
formats, and great compression ratios. For more details, look at:
https://jpegxl.info/

This decoder is far from being feature-complete, as it features a grand
total of 60 FIXMEs and TODOs but anyway, it's still a good start.

I developed this decoder in the Serenity way, I just try to decode a
specific image while staying as close as possible to the specification.

Considering that the format supports a lot of options, and that we
basically support only one possibility for each of them, I'm pretty sure
that we can only decode the image I've developed this decoder for.

Which is:
0aff 3ffa 9101 0688 0001 004c 384b bc41
5ced 86e5 2a19 0696 03e5 4920 8038 000b
2023-07-21 10:47:34 -06:00

39 lines
1012 B
C++

/*
* Copyright (c) 2023, Lucas Chollet <lucas.chollet@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/MemoryStream.h>
#include <LibGfx/ImageFormats/ImageDecoder.h>
namespace Gfx {
class JPEGXLLoadingContext;
class JPEGXLImageDecoderPlugin : public ImageDecoderPlugin {
public:
static bool sniff(ReadonlyBytes);
static ErrorOr<NonnullOwnPtr<ImageDecoderPlugin>> create(ReadonlyBytes);
virtual ~JPEGXLImageDecoderPlugin() override;
virtual IntSize size() override;
virtual bool is_animated() override;
virtual size_t loop_count() override;
virtual size_t frame_count() override;
virtual size_t first_animated_frame_index() override;
virtual ErrorOr<Optional<ReadonlyBytes>> icc_data() override;
virtual ErrorOr<ImageFrameDescriptor> frame(size_t index, Optional<IntSize> ideal_size = {}) override;
private:
JPEGXLImageDecoderPlugin(NonnullOwnPtr<FixedMemoryStream>);
OwnPtr<JPEGXLLoadingContext> m_context;
};
}