TGALoader.h 787 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (c) 2022, Tom Needham <06needhamt@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibGfx/ImageFormats/ImageDecoder.h>
  8. namespace Gfx {
  9. struct TGALoadingContext;
  10. class TGAImageDecoderPlugin final : public ImageDecoderPlugin {
  11. public:
  12. static ErrorOr<bool> validate_before_create(ReadonlyBytes);
  13. static ErrorOr<NonnullOwnPtr<ImageDecoderPlugin>> create(ReadonlyBytes);
  14. virtual ~TGAImageDecoderPlugin() override;
  15. virtual IntSize size() override;
  16. virtual ErrorOr<ImageFrameDescriptor> frame(size_t index, Optional<IntSize> ideal_size = {}) override;
  17. private:
  18. TGAImageDecoderPlugin(NonnullOwnPtr<TGALoadingContext>);
  19. ErrorOr<void> decode_tga_header();
  20. NonnullOwnPtr<TGALoadingContext> m_context;
  21. };
  22. }