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