mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:18:12 +00:00
LibWeb: Implement Path2D class
This commit is contained in:
parent
a37ab7b9f8
commit
2ec52bbbd5
9 changed files with 92 additions and 0 deletions
36
Userland/Libraries/LibWeb/HTML/Path2D.h
Normal file
36
Userland/Libraries/LibWeb/HTML/Path2D.h
Normal file
|
@ -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&);
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue