LibWeb: Extract CanvasFillStrokeStyles class from CRC2D

This commit is contained in:
Sam Atkins 2022-08-12 17:52:43 +01:00 committed by Andreas Kling
parent afabd613bd
commit aa3cb8b425
3 changed files with 16 additions and 19 deletions

View file

@ -10,6 +10,7 @@
#include <AK/String.h>
#include <LibWeb/HTML/Canvas/CanvasState.h>
#include <LibWeb/HTML/CanvasGradient.h>
namespace Web::HTML {
@ -41,6 +42,21 @@ public:
return my_drawing_state().stroke_style.to_string();
}
NonnullRefPtr<CanvasGradient> create_radial_gradient(double x0, double y0, double r0, double x1, double y1, double r1)
{
return CanvasGradient::create_radial(x0, y0, r0, x1, y1, r1);
}
NonnullRefPtr<CanvasGradient> create_linear_gradient(double x0, double y0, double x1, double y1)
{
return CanvasGradient::create_linear(x0, y0, x1, y1);
}
NonnullRefPtr<CanvasGradient> create_conic_gradient(double start_angle, double x, double y)
{
return CanvasGradient::create_conic(start_angle, x, y);
}
protected:
CanvasFillStrokeStyles() = default;

View file

@ -546,21 +546,6 @@ CanvasRenderingContext2D::PreparedText CanvasRenderingContext2D::prepare_text(St
return prepared_text;
}
NonnullRefPtr<CanvasGradient> CanvasRenderingContext2D::create_radial_gradient(double x0, double y0, double r0, double x1, double y1, double r1)
{
return CanvasGradient::create_radial(x0, y0, r0, x1, y1, r1);
}
NonnullRefPtr<CanvasGradient> CanvasRenderingContext2D::create_linear_gradient(double x0, double y0, double x1, double y1)
{
return CanvasGradient::create_linear(x0, y0, x1, y1);
}
NonnullRefPtr<CanvasGradient> CanvasRenderingContext2D::create_conic_gradient(double start_angle, double x, double y)
{
return CanvasGradient::create_conic(start_angle, x, y);
}
void CanvasRenderingContext2D::clip()
{
// FIXME: Implement.

View file

@ -78,10 +78,6 @@ public:
RefPtr<TextMetrics> measure_text(String const& text);
NonnullRefPtr<CanvasGradient> create_radial_gradient(double x0, double y0, double r0, double x1, double y1, double r1);
NonnullRefPtr<CanvasGradient> create_linear_gradient(double x0, double y0, double x1, double y1);
NonnullRefPtr<CanvasGradient> create_conic_gradient(double start_angle, double x, double y);
void clip();
private: