ladybird/Userland/Libraries/LibWeb/HTML/Canvas/CanvasDrawPath.h
MacDue 20e9213cc4 LibWeb: Add initial implementation of CRC2D.clip()
This allows clipping your drawing by any path you like! To do this
all painting has been wrapped around a new draw_clipped() helper
method, which handles the clipping before/after painting.

Note: This clipping is currently missing support for intersecting
clip paths.
2023-04-09 18:42:45 +02:00

34 lines
801 B
C++

/*
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/DeprecatedString.h>
#include <LibWeb/HTML/Path2D.h>
namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/canvas.html#canvasdrawpath
class CanvasDrawPath {
public:
virtual ~CanvasDrawPath() = default;
virtual void begin_path() = 0;
virtual void fill(DeprecatedString const& fill_rule) = 0;
virtual void fill(Path2D& path, DeprecatedString const& fill_rule) = 0;
virtual void stroke() = 0;
virtual void stroke(Path2D const& path) = 0;
virtual void clip(DeprecatedString const& fill_rule) = 0;
virtual void clip(Path2D& path, DeprecatedString const& fill_rule) = 0;
protected:
CanvasDrawPath() = default;
};
}