2022-03-10 14:02:25 +01:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
|
2022-03-10 14:02:25 +01:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2024-08-09 14:00:10 +02:00
|
|
|
#include <LibGfx/Path.h>
|
2023-11-04 21:31:35 +00:00
|
|
|
#include <LibWeb/Layout/SVGGraphicsBox.h>
|
2022-03-10 14:02:25 +01:00
|
|
|
#include <LibWeb/Painting/SVGGraphicsPaintable.h>
|
|
|
|
|
|
|
|
namespace Web::Painting {
|
|
|
|
|
2023-11-04 21:31:35 +00:00
|
|
|
class SVGPathPaintable final : public SVGGraphicsPaintable {
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_CELL(SVGPathPaintable, SVGGraphicsPaintable);
|
|
|
|
GC_DECLARE_ALLOCATOR(SVGPathPaintable);
|
2023-01-11 12:51:49 +01:00
|
|
|
|
2022-03-10 14:02:25 +01:00
|
|
|
public:
|
2024-11-15 04:01:23 +13:00
|
|
|
static GC::Ref<SVGPathPaintable> create(Layout::SVGGraphicsBox const&);
|
2022-03-10 14:02:25 +01:00
|
|
|
|
2024-02-13 21:34:07 +01:00
|
|
|
virtual TraversalDecision hit_test(CSSPixelPoint, HitTestType, Function<TraversalDecision(HitTestResult)> const& callback) const override;
|
2023-04-10 12:35:33 +01:00
|
|
|
|
2022-03-10 14:02:25 +01:00
|
|
|
virtual void paint(PaintContext&, PaintPhase) const override;
|
|
|
|
|
2023-11-04 21:31:35 +00:00
|
|
|
Layout::SVGGraphicsBox const& layout_box() const;
|
2022-03-10 14:02:25 +01:00
|
|
|
|
2024-08-09 14:00:10 +02:00
|
|
|
void set_computed_path(Gfx::Path path)
|
2023-10-29 17:08:35 +00:00
|
|
|
{
|
2023-10-29 19:11:46 +00:00
|
|
|
m_computed_path = move(path);
|
2023-10-29 17:08:35 +00:00
|
|
|
}
|
|
|
|
|
2024-08-09 14:00:10 +02:00
|
|
|
Optional<Gfx::Path> const& computed_path() const { return m_computed_path; }
|
2023-10-29 17:08:35 +00:00
|
|
|
|
2022-03-10 14:02:25 +01:00
|
|
|
protected:
|
2023-11-04 21:31:35 +00:00
|
|
|
SVGPathPaintable(Layout::SVGGraphicsBox const&);
|
2023-10-29 17:08:35 +00:00
|
|
|
|
2024-08-09 14:00:10 +02:00
|
|
|
Optional<Gfx::Path> m_computed_path = {};
|
2022-03-10 14:02:25 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|