diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-08-11 16:50:23 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-08-14 11:30:40 +0200 |
commit | 2ec52bbbd57cabf56ec2f5b61e3846640c358146 (patch) | |
tree | de6dcbf6573a6df4e968178bdaea59207e507b31 /Userland/Libraries/LibWeb/HTML/Path2D.h | |
parent | a37ab7b9f86740733f2d3d56d6bc591fd779494f (diff) | |
download | serenity-2ec52bbbd57cabf56ec2f5b61e3846640c358146.zip |
LibWeb: Implement Path2D class
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/Path2D.h')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/Path2D.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/Path2D.h b/Userland/Libraries/LibWeb/HTML/Path2D.h new file mode 100644 index 0000000000..8f58a4589a --- /dev/null +++ b/Userland/Libraries/LibWeb/HTML/Path2D.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include <AK/RefCounted.h> +#include <LibGfx/Path.h> +#include <LibWeb/Bindings/Wrappable.h> +#include <LibWeb/HTML/Canvas/CanvasPath.h> + +namespace Web::HTML { + +// https://html.spec.whatwg.org/multipage/canvas.html#path2d +class Path2D + : public RefCounted<Path2D> + , public Bindings::Wrappable + , public CanvasPath { + + AK_MAKE_NONCOPYABLE(Path2D); + AK_MAKE_NONMOVABLE(Path2D); + +public: + using WrapperType = Bindings::Path2DWrapper; + + static NonnullRefPtr<Path2D> create_with_global_object(Bindings::WindowObject&, Optional<Variant<NonnullRefPtr<Path2D>, String>> const& path) { return adopt_ref(*new Path2D(path)); } + static NonnullRefPtr<Path2D> create(Optional<Variant<NonnullRefPtr<Path2D>, String>> const& path) { return adopt_ref(*new Path2D(path)); } + ~Path2D() = default; + +private: + Path2D(Optional<Variant<NonnullRefPtr<Path2D>, String>> const&); +}; + +} |