LibWeb/Canvas: Support globalCompositionOperation

Canvas now supports compositing and various blending modes via the
`globalCompositeOperation` attribute.
This commit is contained in:
Glenn Skrzypczak
2025-01-28 18:19:30 +01:00
committed by Sam Atkins
parent 19ab213b16
commit 8575bddfe6
Notes: github-actions[bot] 2025-02-05 11:28:07 +00:00
16 changed files with 283 additions and 32 deletions

View File

@@ -481,7 +481,7 @@ void TinyVGDecodedImageData::draw(Painter& painter) const
command.fill->visit(
[&](Color color) { painter.fill_path(fill_path, color, WindingRule::EvenOdd); },
[&](NonnullRefPtr<SVGGradientPaintStyle> const& style) {
painter.fill_path(fill_path, style, {}, 1.0f, WindingRule::EvenOdd);
painter.fill_path(fill_path, style, {}, 1.0f, CompositingAndBlendingOperator::SourceOver, WindingRule::EvenOdd);
});
}
@@ -489,7 +489,7 @@ void TinyVGDecodedImageData::draw(Painter& painter) const
command.stroke->visit(
[&](Color color) { painter.stroke_path(draw_path, color, command.stroke_width); },
[&](NonnullRefPtr<SVGGradientPaintStyle> const& style) {
painter.stroke_path(draw_path, style, {}, command.stroke_width, 1.0f);
painter.stroke_path(draw_path, style, {}, command.stroke_width, 1.0f, CompositingAndBlendingOperator::SourceOver);
});
}
}