/* * Copyright (c) 2020, Matthew Olsson * Copyright (c) 2022-2025, Sam Atkins * Copyright (c) 2024, Tim Ledbetter * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include namespace Web::SVG { enum class PathInstructionType : u8 { Move, ClosePath, Line, HorizontalLine, VerticalLine, Curve, SmoothCurve, QuadraticBezierCurve, SmoothQuadraticBezierCurve, EllipticalArc, Invalid, }; struct PathInstruction { PathInstructionType type; bool absolute; Vector data; bool operator==(PathInstruction const&) const = default; void serialize(StringBuilder&) const; void dump() const; }; class Path { public: Path() = default; explicit Path(Vector instructions) : m_instructions(move(instructions)) { } ReadonlySpan instructions() const { return m_instructions; } [[nodiscard]] Gfx::Path to_gfx_path() const; String serialize() const; bool operator==(Path const&) const = default; private: Vector m_instructions; }; }