2022-08-11 12:50:23 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <AK/RefCounted.h>
|
2022-09-02 18:35:06 -03:00
|
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
2023-02-27 15:23:31 -03:00
|
|
|
#include <LibWeb/Geometry/DOMMatrixReadOnly.h>
|
2022-08-11 12:50:23 -03:00
|
|
|
#include <LibWeb/HTML/Canvas/CanvasPath.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/canvas.html#path2d
|
2022-09-02 18:35:06 -03:00
|
|
|
class Path2D final
|
|
|
|
|
: public Bindings::PlatformObject
|
2022-08-11 12:50:23 -03:00
|
|
|
, public CanvasPath {
|
|
|
|
|
|
2022-09-02 18:35:06 -03:00
|
|
|
WEB_PLATFORM_OBJECT(Path2D, Bindings::PlatformObject);
|
2024-11-14 12:01:23 -03:00
|
|
|
GC_DECLARE_ALLOCATOR(Path2D);
|
2022-08-11 12:50:23 -03:00
|
|
|
|
|
|
|
|
public:
|
2026-05-20 15:58:46 -03:00
|
|
|
static WebIDL::ExceptionOr<GC::Ref<Path2D>> construct_impl(JS::Realm&, Optional<Variant<GC::Ref<Path2D>, String>> const& path);
|
2022-08-11 12:50:23 -03:00
|
|
|
|
2022-09-02 18:35:06 -03:00
|
|
|
virtual ~Path2D() override;
|
2022-08-11 12:50:23 -03:00
|
|
|
|
2026-05-01 14:01:23 -03:00
|
|
|
WebIDL::ExceptionOr<void> add_path(GC::Ref<Path2D> path, Bindings::DOMMatrix2DInit& transform);
|
2023-02-27 15:23:31 -03:00
|
|
|
|
2022-08-11 12:50:23 -03:00
|
|
|
private:
|
2026-05-20 15:58:46 -03:00
|
|
|
Path2D(JS::Realm&, Optional<Variant<GC::Ref<Path2D>, String>> const&);
|
2023-01-10 08:28:20 -03:00
|
|
|
|
2023-08-07 03:41:28 -03:00
|
|
|
virtual void initialize(JS::Realm&) override;
|
2022-08-11 12:50:23 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|