2022-08-17 19:58:42 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2022, Tom Needham <06needhamt@gmail.com>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2023-03-21 14:58:06 -04:00
|
|
|
#include <LibGfx/ImageFormats/ImageDecoder.h>
|
2022-08-17 19:58:42 +01:00
|
|
|
|
|
|
|
|
namespace Gfx {
|
|
|
|
|
|
|
|
|
|
struct TGALoadingContext;
|
|
|
|
|
|
|
|
|
|
class TGAImageDecoderPlugin final : public ImageDecoderPlugin {
|
|
|
|
|
public:
|
2023-01-20 10:13:14 +02:00
|
|
|
static ErrorOr<bool> validate_before_create(ReadonlyBytes);
|
|
|
|
|
static ErrorOr<NonnullOwnPtr<ImageDecoderPlugin>> create(ReadonlyBytes);
|
|
|
|
|
|
2022-08-17 19:58:42 +01:00
|
|
|
virtual ~TGAImageDecoderPlugin() override;
|
|
|
|
|
|
|
|
|
|
virtual IntSize size() override;
|
2023-07-07 18:37:46 -04:00
|
|
|
|
2023-07-02 22:20:06 +01:00
|
|
|
virtual ErrorOr<ImageFrameDescriptor> frame(size_t index, Optional<IntSize> ideal_size = {}) override;
|
2022-08-17 19:58:42 +01:00
|
|
|
|
|
|
|
|
private:
|
2023-07-22 00:55:50 +03:00
|
|
|
TGAImageDecoderPlugin(NonnullOwnPtr<TGALoadingContext>);
|
|
|
|
|
|
2023-07-09 00:57:20 -04:00
|
|
|
ErrorOr<void> decode_tga_header();
|
2023-07-22 00:55:50 +03:00
|
|
|
NonnullOwnPtr<TGALoadingContext> m_context;
|
2022-08-17 19:58:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|