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:
parent
aa3cb8b425
commit
c0494988ed
4 changed files with 38 additions and 8 deletions
24
Userland/Libraries/LibWeb/HTML/Canvas/CanvasRect.h
Normal file
24
Userland/Libraries/LibWeb/HTML/Canvas/CanvasRect.h
Normal 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;
|
||||
};
|
||||
|
||||
}
|
6
Userland/Libraries/LibWeb/HTML/Canvas/CanvasRect.idl
Normal file
6
Userland/Libraries/LibWeb/HTML/Canvas/CanvasRect.idl
Normal 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);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue