mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +00:00
LibWeb: Implement CanvasRenderingContext2D.createPattern()
This is a first pass at implementing CRC2D.createPattern() and the associated CanvasPattern object. This implementation only works for a few of the required image sources [like CRC2D.drawImage()], and does not yet support transforms. Other than that it supports everything else (which is mainly the various repeat modes).
This commit is contained in:
parent
0c313c586b
commit
f74e2da875
8 changed files with 229 additions and 8 deletions
|
@ -13,6 +13,7 @@
|
|||
#include <LibGfx/Color.h>
|
||||
#include <LibGfx/PaintStyle.h>
|
||||
#include <LibWeb/HTML/CanvasGradient.h>
|
||||
#include <LibWeb/HTML/CanvasPattern.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
@ -26,7 +27,7 @@ public:
|
|||
void reset();
|
||||
bool is_context_lost();
|
||||
|
||||
using FillOrStrokeVariant = Variant<Gfx::Color, JS::Handle<CanvasGradient>>;
|
||||
using FillOrStrokeVariant = Variant<Gfx::Color, JS::Handle<CanvasGradient>, JS::Handle<CanvasPattern>>;
|
||||
|
||||
struct FillOrStrokeStyle {
|
||||
FillOrStrokeStyle(Gfx::Color color)
|
||||
|
@ -49,7 +50,7 @@ public:
|
|||
Optional<Gfx::Color> as_color() const;
|
||||
Gfx::Color to_color_but_fixme_should_accept_any_paint_style() const;
|
||||
|
||||
using JsFillOrStrokeStyle = Variant<DeprecatedString, JS::Handle<CanvasGradient>>;
|
||||
using JsFillOrStrokeStyle = Variant<DeprecatedString, JS::Handle<CanvasGradient>, JS::Handle<CanvasPattern>>;
|
||||
|
||||
JsFillOrStrokeStyle to_js_fill_or_stroke_style() const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue