1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-21 15:45:07 +00:00
serenity/Userland/Libraries/LibWeb/SVG/SVGPathElement.h
Sam Atkins 82308fb71a LibWeb: Move SVG::PathDataParser into its own file and rename it
I've chosen the name `AttributeParser` since it parses data from
attributes. Rather than duplicate the parsing of numbers and other
basic types, let's make use of this existing parsing code for parsing
the data for `<line>`, `<polyline>`, etc.
2022-02-11 21:38:27 +01:00

33 lines
798 B
C++

/*
* Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGfx/Bitmap.h>
#include <LibWeb/HTML/HTMLElement.h>
#include <LibWeb/SVG/AttributeParser.h>
#include <LibWeb/SVG/SVGGeometryElement.h>
namespace Web::SVG {
class SVGPathElement final : public SVGGeometryElement {
public:
using WrapperType = Bindings::SVGPathElementWrapper;
SVGPathElement(DOM::Document&, QualifiedName);
virtual ~SVGPathElement() override = default;
virtual void parse_attribute(const FlyString& name, const String& value) override;
virtual Gfx::Path& get_path() override;
private:
Vector<PathInstruction> m_instructions;
Gfx::FloatPoint m_previous_control_point = {};
Optional<Gfx::Path> m_path;
};
}