TIFFLoader.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2023, Lucas Chollet <lucas.chollet@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/MemoryStream.h>
  8. #include <LibGfx/ImageFormats/ImageDecoder.h>
  9. namespace Gfx {
  10. // This is a link to the main TIFF specification from 1992
  11. // https://www.itu.int/itudoc/itu-t/com16/tiff-fx/docs/tiff6.pdf
  12. // First TIFF Technical notes from 1995
  13. // https://www.awaresystems.be/imaging/tiff/specification/TIFFPM6.pdf
  14. namespace TIFF {
  15. class TIFFLoadingContext;
  16. }
  17. class TIFFImageDecoderPlugin : public ImageDecoderPlugin {
  18. public:
  19. static bool sniff(ReadonlyBytes);
  20. static ErrorOr<NonnullOwnPtr<ImageDecoderPlugin>> create(ReadonlyBytes);
  21. virtual ~TIFFImageDecoderPlugin() override = default;
  22. virtual IntSize size() override;
  23. virtual ErrorOr<ImageFrameDescriptor> frame(size_t index, Optional<IntSize> ideal_size = {}) override;
  24. virtual ErrorOr<Optional<ReadonlyBytes>> icc_data() override;
  25. private:
  26. TIFFImageDecoderPlugin(NonnullOwnPtr<FixedMemoryStream>);
  27. OwnPtr<TIFF::TIFFLoadingContext> m_context;
  28. };
  29. }