1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:37:36 +00:00

LibWeb: Extract CanvasRect class from CRC2D

This one requires drawing to the canvas, so it doesn't make so much
sense to move the implementation over.
This commit is contained in:
Sam Atkins 2022-08-12 16:06:32 +01:00 committed by Andreas Kling
parent aa3cb8b425
commit c0494988ed
4 changed files with 38 additions and 8 deletions

View file

@ -0,0 +1,24 @@
/*
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/canvas.html#canvasrect
class CanvasRect {
public:
virtual ~CanvasRect() = default;
virtual void fill_rect(float x, float y, float width, float height) = 0;
virtual void stroke_rect(float x, float y, float width, float height) = 0;
virtual void clear_rect(float x, float y, float width, float height) = 0;
protected:
CanvasRect() = default;
};
}

View file

@ -0,0 +1,6 @@
// https://html.spec.whatwg.org/multipage/canvas.html#canvasrect
interface mixin CanvasRect {
undefined clearRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
undefined fillRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
undefined strokeRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
};