SVGPathPaintable.h 1014 B

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