mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 12:20:00 +01:00
We already had the API, but drawing to the canvas was not affected by any created CanvasPattern. This moves CanvasPatternPaintStyle to LibGfx so we don't have to reach into LibWeb, and implements the plumbing to let Skia use images as a fill pattern.
46 lines
1.2 KiB
C++
46 lines
1.2 KiB
C++
/*
|
|
* Copyright (c) 2023, Andreas Kling <andreas@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibGC/Cell.h>
|
|
#include <LibGfx/Size.h>
|
|
#include <LibWeb/Forward.h>
|
|
#include <LibWeb/PixelUnits.h>
|
|
|
|
namespace Web::Layout {
|
|
|
|
class ImageProvider {
|
|
public:
|
|
virtual ~ImageProvider() { }
|
|
|
|
virtual bool is_image_available() const = 0;
|
|
|
|
virtual Optional<CSSPixels> intrinsic_width() const = 0;
|
|
virtual Optional<CSSPixels> intrinsic_height() const = 0;
|
|
Optional<CSSPixelSize> intrinsic_size() const;
|
|
virtual Optional<CSSPixelFraction> intrinsic_aspect_ratio() const = 0;
|
|
|
|
virtual RefPtr<Gfx::ImmutableBitmap> current_image_bitmap() const;
|
|
virtual RefPtr<Gfx::ImmutableBitmap> current_image_bitmap_sized(Gfx::IntSize) const = 0;
|
|
|
|
virtual RefPtr<Gfx::ImmutableBitmap> default_image_bitmap() const;
|
|
virtual RefPtr<Gfx::ImmutableBitmap> default_image_bitmap_sized(Gfx::IntSize) const;
|
|
|
|
virtual void set_visible_in_viewport(bool) = 0;
|
|
|
|
virtual void image_provider_visit_edges(GC::Cell::Visitor& visitor) const
|
|
{
|
|
visitor.visit(to_html_element());
|
|
}
|
|
|
|
protected:
|
|
virtual GC::Ptr<DOM::Element const> to_html_element() const = 0;
|
|
static void did_update_alt_text(ImageBox&);
|
|
};
|
|
|
|
}
|