mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:28:12 +00:00
LibWeb/SVG: Support url() in the stroke attribute
This allows you to draw gradients in strokes, for example.
This commit is contained in:
parent
8993a710f8
commit
42a183720b
8 changed files with 51 additions and 12 deletions
|
@ -114,12 +114,20 @@ void SVGGeometryPaintable::paint(PaintContext& context, PaintPhase phase) const
|
|||
}
|
||||
|
||||
auto stroke_opacity = geometry_element.stroke_opacity().value_or(svg_context.stroke_opacity());
|
||||
if (auto stroke_color = geometry_element.stroke_color().value_or(svg_context.stroke_color()).with_opacity(stroke_opacity); stroke_color.alpha() > 0) {
|
||||
|
||||
// Note: This is assuming .x_scale() == .y_scale() (which it does currently).
|
||||
float stroke_thickness = geometry_element.stroke_width().value_or(svg_context.stroke_width()) * viewbox_scale;
|
||||
|
||||
if (auto paint_style = geometry_element.stroke_paint_style(paint_context); paint_style.has_value()) {
|
||||
painter.stroke_path(
|
||||
path,
|
||||
*paint_style,
|
||||
stroke_thickness);
|
||||
} 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,
|
||||
stroke_color,
|
||||
// Note: This is assuming .x_scale() == .y_scale() (which it does currently).
|
||||
geometry_element.stroke_width().value_or(svg_context.stroke_width()) * viewbox_scale);
|
||||
stroke_thickness);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue