2023-05-10 19:36:43 +02:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2023, Andreas Kling <andreas@ladybird.org>
|
2023-05-10 19:36:43 +02:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/RefCounted.h>
|
2023-05-20 16:40:44 +02:00
|
|
|
#include <LibGfx/Size.h>
|
2023-05-10 19:36:43 +02:00
|
|
|
#include <LibJS/Heap/Cell.h>
|
2023-05-20 16:27:31 +02:00
|
|
|
#include <LibWeb/PixelUnits.h>
|
2023-05-10 19:36:43 +02:00
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/images.html#img-req-data
|
2023-12-12 20:07:19 +01:00
|
|
|
class DecodedImageData : public JS::Cell {
|
2024-04-08 18:17:32 +00:00
|
|
|
JS_CELL(DecodedImageData, JS::Cell);
|
|
|
|
|
2023-05-10 19:36:43 +02:00
|
|
|
public:
|
2023-05-20 16:11:36 +02:00
|
|
|
virtual ~DecodedImageData();
|
2023-05-10 19:36:43 +02:00
|
|
|
|
2023-11-24 14:45:45 +01:00
|
|
|
virtual RefPtr<Gfx::ImmutableBitmap> bitmap(size_t frame_index, Gfx::IntSize = {}) const = 0;
|
2023-05-20 16:11:36 +02:00
|
|
|
virtual int frame_duration(size_t frame_index) const = 0;
|
2023-05-10 19:36:43 +02:00
|
|
|
|
2023-05-20 16:11:36 +02:00
|
|
|
virtual size_t frame_count() const = 0;
|
|
|
|
virtual size_t loop_count() const = 0;
|
|
|
|
virtual bool is_animated() const = 0;
|
2023-05-10 19:36:43 +02:00
|
|
|
|
2023-05-20 16:27:31 +02:00
|
|
|
virtual Optional<CSSPixels> intrinsic_width() const = 0;
|
|
|
|
virtual Optional<CSSPixels> intrinsic_height() const = 0;
|
2023-09-03 17:33:58 -05:00
|
|
|
virtual Optional<CSSPixelFraction> intrinsic_aspect_ratio() const = 0;
|
2023-05-10 19:36:43 +02:00
|
|
|
|
2023-05-20 16:11:36 +02:00
|
|
|
protected:
|
|
|
|
DecodedImageData();
|
2023-05-10 19:36:43 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|