diff --git a/Base/res/html/misc/svg-gradients.html b/Base/res/html/misc/svg-gradients.html index c6701061c8..25ac91736b 100644 --- a/Base/res/html/misc/svg-gradients.html +++ b/Base/res/html/misc/svg-gradients.html @@ -154,3 +154,14 @@ +
+Stroke linear gradient + transform with stroke-opacity
+ + + + + + + + + diff --git a/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp b/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp index f3b088fdf6..b97c759137 100644 --- a/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp +++ b/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp @@ -198,10 +198,10 @@ void AntiAliasingPainter::stroke_path(Path const& path, Color color, float thick fill_path(path.stroke_to_fill(thickness), color); } -void AntiAliasingPainter::stroke_path(Path const& path, Gfx::PaintStyle const& paint_style, float thickness) +void AntiAliasingPainter::stroke_path(Path const& path, Gfx::PaintStyle const& paint_style, float thickness, float opacity) { // FIXME: Cache this? Probably at a higher level such as in LibWeb? - fill_path(path.stroke_to_fill(thickness), paint_style); + fill_path(path.stroke_to_fill(thickness), paint_style, opacity); } void AntiAliasingPainter::fill_rect(FloatRect const& float_rect, Color color) diff --git a/Userland/Libraries/LibGfx/AntiAliasingPainter.h b/Userland/Libraries/LibGfx/AntiAliasingPainter.h index 6ef9889f96..3ec5248f5d 100644 --- a/Userland/Libraries/LibGfx/AntiAliasingPainter.h +++ b/Userland/Libraries/LibGfx/AntiAliasingPainter.h @@ -37,7 +37,7 @@ public: void fill_path(Path const&, PaintStyle const& paint_style, float opacity = 1.0f, Painter::WindingRule rule = Painter::WindingRule::Nonzero); void stroke_path(Path const&, Color, float thickness); - void stroke_path(Path const&, PaintStyle const& paint_style, float thickness); + void stroke_path(Path const&, PaintStyle const& paint_style, float thickness, float opacity = 1.0f); void translate(float dx, float dy) { m_transform.translate(dx, dy); } void translate(FloatPoint delta) { m_transform.translate(delta); } diff --git a/Userland/Libraries/LibWeb/Painting/SVGGeometryPaintable.cpp b/Userland/Libraries/LibWeb/Painting/SVGGeometryPaintable.cpp index 3c48bcfe90..5f915f6c16 100644 --- a/Userland/Libraries/LibWeb/Painting/SVGGeometryPaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/SVGGeometryPaintable.cpp @@ -122,7 +122,8 @@ void SVGGeometryPaintable::paint(PaintContext& context, PaintPhase phase) const painter.stroke_path( path, *paint_style, - stroke_thickness); + stroke_thickness, + stroke_opacity); } else if (auto stroke_color = geometry_element.stroke_color().value_or(svg_context.stroke_color()).with_opacity(stroke_opacity); stroke_color.alpha() > 0) { painter.stroke_path( path,