/src/serenity/Userland/Libraries/LibWeb/Painting/SVGPathPaintable.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2022, Andreas Kling <kling@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <LibWeb/Layout/SVGGraphicsBox.h> |
10 | | #include <LibWeb/Painting/SVGGraphicsPaintable.h> |
11 | | |
12 | | namespace Web::Painting { |
13 | | |
14 | | class SVGPathPaintable final : public SVGGraphicsPaintable { |
15 | | JS_CELL(SVGPathPaintable, SVGGraphicsPaintable); |
16 | | JS_DECLARE_ALLOCATOR(SVGPathPaintable); |
17 | | |
18 | | public: |
19 | | static JS::NonnullGCPtr<SVGPathPaintable> create(Layout::SVGGraphicsBox const&); |
20 | | |
21 | | virtual TraversalDecision hit_test(CSSPixelPoint, HitTestType, Function<TraversalDecision(HitTestResult)> const& callback) const override; |
22 | | |
23 | | virtual void paint(PaintContext&, PaintPhase) const override; |
24 | | |
25 | | Layout::SVGGraphicsBox const& layout_box() const; |
26 | | |
27 | | void set_computed_path(Gfx::Path path) |
28 | 0 | { |
29 | 0 | m_computed_path = move(path); |
30 | 0 | } |
31 | | |
32 | 0 | Optional<Gfx::Path> const& computed_path() const { return m_computed_path; } |
33 | | |
34 | | protected: |
35 | | SVGPathPaintable(Layout::SVGGraphicsBox const&); |
36 | | |
37 | | Optional<Gfx::Path> m_computed_path = {}; |
38 | | }; |
39 | | |
40 | | } |