TIFFLoader.h 828 B

1234567891011121314151617181920212223242526272829303132333435
  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. // https://www.itu.int/itudoc/itu-t/com16/tiff-fx/docs/tiff6.pdf
  11. class TIFFLoadingContext;
  12. class TIFFImageDecoderPlugin : public ImageDecoderPlugin {
  13. public:
  14. static bool sniff(ReadonlyBytes);
  15. static ErrorOr<NonnullOwnPtr<ImageDecoderPlugin>> create(ReadonlyBytes);
  16. virtual ~TIFFImageDecoderPlugin() override = default;
  17. virtual IntSize size() override;
  18. virtual ErrorOr<ImageFrameDescriptor> frame(size_t index, Optional<IntSize> ideal_size = {}) override;
  19. private:
  20. TIFFImageDecoderPlugin(NonnullOwnPtr<FixedMemoryStream>);
  21. OwnPtr<TIFFLoadingContext> m_context;
  22. };
  23. }