mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 17:15:08 +00:00

Most image decoders that we have only support non-animated images, providing a default implementation for them allows to remove quite some code.
36 lines
950 B
C++
36 lines
950 B
C++
/*
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
|
* Copyright (c) 2022-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 {
|
|
|
|
struct JPEGLoadingContext;
|
|
|
|
// For the specification, see: https://www.w3.org/Graphics/JPEG/itu-t81.pdf
|
|
|
|
class JPEGImageDecoderPlugin : public ImageDecoderPlugin {
|
|
public:
|
|
static bool sniff(ReadonlyBytes);
|
|
static ErrorOr<NonnullOwnPtr<ImageDecoderPlugin>> create(ReadonlyBytes);
|
|
|
|
virtual ~JPEGImageDecoderPlugin() override;
|
|
virtual IntSize size() override;
|
|
|
|
virtual ErrorOr<ImageFrameDescriptor> frame(size_t index, Optional<IntSize> ideal_size = {}) override;
|
|
virtual ErrorOr<Optional<ReadonlyBytes>> icc_data() override;
|
|
|
|
private:
|
|
JPEGImageDecoderPlugin(NonnullOwnPtr<FixedMemoryStream>);
|
|
|
|
OwnPtr<JPEGLoadingContext> m_context;
|
|
};
|
|
|
|
}
|