/* * Copyright (c) 2020-2022, Andreas Kling * Copyright (c) 2021-2022, Linus Groh * Copyright (c) 2022, Sam Atkins * Copyright (c) 2023, MacDue * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include namespace Web::HTML { // https://html.spec.whatwg.org/multipage/canvas.html#canvasfillstrokestyles template class CanvasFillStrokeStyles { public: ~CanvasFillStrokeStyles() = default; using FillOrStrokeStyleVariant = Variant, GC::Root>; void set_fill_style(FillOrStrokeStyleVariant style); FillOrStrokeStyleVariant fill_style() const; void set_stroke_style(FillOrStrokeStyleVariant style); FillOrStrokeStyleVariant stroke_style() const; WebIDL::ExceptionOr> create_radial_gradient(double x0, double y0, double r0, double x1, double y1, double r1); GC::Ref create_linear_gradient(double x0, double y0, double x1, double y1); GC::Ref create_conic_gradient(double start_angle, double x, double y); WebIDL::ExceptionOr> create_pattern(CanvasImageSource const& image, StringView repetition); protected: CanvasFillStrokeStyles() = default; private: Variant my_canvas_element(); CanvasState::DrawingState& my_drawing_state(); CanvasState::DrawingState const& my_drawing_state() const; }; }