Serenity Operating System
at master 37 lines 1.0 kB view raw
1/* 2 * Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#pragma once 8 9#include <AK/RefCounted.h> 10#include <LibGfx/Path.h> 11#include <LibWeb/Bindings/PlatformObject.h> 12#include <LibWeb/Geometry/DOMMatrixReadOnly.h> 13#include <LibWeb/HTML/Canvas/CanvasPath.h> 14 15namespace Web::HTML { 16 17// https://html.spec.whatwg.org/multipage/canvas.html#path2d 18class Path2D final 19 : public Bindings::PlatformObject 20 , public CanvasPath { 21 22 WEB_PLATFORM_OBJECT(Path2D, Bindings::PlatformObject); 23 24public: 25 static WebIDL::ExceptionOr<JS::NonnullGCPtr<Path2D>> construct_impl(JS::Realm&, Optional<Variant<JS::Handle<Path2D>, DeprecatedString>> const& path); 26 27 virtual ~Path2D() override; 28 29 WebIDL::ExceptionOr<void> add_path(JS::NonnullGCPtr<Path2D> path, Geometry::DOMMatrix2DInit& transform); 30 31private: 32 Path2D(JS::Realm&, Optional<Variant<JS::Handle<Path2D>, DeprecatedString>> const&); 33 34 virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; 35}; 36 37}