mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 19:35:08 +00:00

As described in the first edition of the TIFF technical notes, the IFD type is identical to Long (UnsignedLong) except that it only contains offset of valid IFDs. https://www.awaresystems.be/imaging/tiff/specification/TIFFPM6.pdf
43 lines
1.1 KiB
C++
43 lines
1.1 KiB
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 {
|
|
|
|
// This is a link to the main TIFF specification from 1992
|
|
// https://www.itu.int/itudoc/itu-t/com16/tiff-fx/docs/tiff6.pdf
|
|
|
|
// First TIFF Technical notes from 1995
|
|
// https://www.awaresystems.be/imaging/tiff/specification/TIFFPM6.pdf
|
|
|
|
namespace TIFF {
|
|
class TIFFLoadingContext;
|
|
}
|
|
|
|
class TIFFImageDecoderPlugin : public ImageDecoderPlugin {
|
|
public:
|
|
static bool sniff(ReadonlyBytes);
|
|
static ErrorOr<NonnullOwnPtr<ImageDecoderPlugin>> create(ReadonlyBytes);
|
|
|
|
virtual ~TIFFImageDecoderPlugin() override = default;
|
|
|
|
virtual IntSize size() override;
|
|
|
|
virtual ErrorOr<ImageFrameDescriptor> frame(size_t index, Optional<IntSize> ideal_size = {}) override;
|
|
|
|
virtual ErrorOr<Optional<ReadonlyBytes>> icc_data() override;
|
|
|
|
private:
|
|
TIFFImageDecoderPlugin(NonnullOwnPtr<FixedMemoryStream>);
|
|
|
|
OwnPtr<TIFF::TIFFLoadingContext> m_context;
|
|
};
|
|
|
|
}
|