1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 18:05:07 +00:00
serenity/Userland/Libraries/LibWeb/HTML/CanvasGradient.h
Andreas Kling dc3bf32307 LibWeb: Add barebones CanvasGradient object
Also add the CanvasRenderingContext2D APIs to go along with it.
Note that it can't be used for anything yet.
2022-02-03 22:35:13 +01:00

40 lines
936 B
C++

/*
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/RefCounted.h>
#include <LibWeb/Bindings/Wrappable.h>
namespace Web::HTML {
class CanvasGradient final
: public RefCounted<CanvasGradient>
, public Bindings::Wrappable {
public:
using WrapperType = Bindings::CanvasGradientWrapper;
enum class Type {
Linear,
Radial,
Conic,
};
static NonnullRefPtr<CanvasGradient> create_radial(double x0, double y0, double r0, double x1, double y1, double r1);
static NonnullRefPtr<CanvasGradient> create_linear(double x0, double y0, double x1, double y1);
static NonnullRefPtr<CanvasGradient> create_conic(double start_angle, double x, double y);
void add_color_stop(double offset, String const& color);
~CanvasGradient();
private:
explicit CanvasGradient(Type);
Type m_type {};
};
}