Serenity Operating System
1/*
2 * Copyright (c) 2020-2022, Andreas Kling <kling@serenityos.org>
3 * Copyright (c) 2022, Dex♪ <dexes.ttp@gmail.com>
4 *
5 * SPDX-License-Identifier: BSD-2-Clause
6 */
7
8#pragma once
9
10#include <AK/RefPtr.h>
11#include <AK/Vector.h>
12#include <LibGfx/Forward.h>
13
14namespace Web::Platform {
15
16struct Frame {
17 RefPtr<Gfx::Bitmap> bitmap;
18 size_t duration { 0 };
19};
20
21struct DecodedImage {
22 bool is_animated { false };
23 u32 loop_count { 0 };
24 Vector<Frame> frames;
25};
26
27class ImageCodecPlugin {
28public:
29 static ImageCodecPlugin& the();
30 static void install(ImageCodecPlugin&);
31
32 virtual ~ImageCodecPlugin();
33
34 virtual Optional<DecodedImage> decode_image(ReadonlyBytes) = 0;
35};
36
37}