Skip to content

CompositionSpriteShape.StrokeDashArray is scaled by StrokeThickness (WinUI uses absolute units) #25199

Closed

Description

@MartinZikmund

Current behavior 🐛

CompositionSpriteShape.StrokeDashArray / StrokeDashOffset are multiplied by StrokeThickness when the stroke is built (the XAML Shape.StrokeDashArray convention). A ring of radius 52 with StrokeThickness = 6 and StrokeDashArray = { 4, 14 } draws 3 long dashes (dash ≈ 24, period ≈ 108) instead of 18 short ones.

This affects every LottieGen-generated animation with dashed strokes and a thickness other than 1, plus any app code that uses Composition dashes.

Expected behavior 🎯

Composition dash values are absolute (geometry units), as on WinUI / Windows App SDK: the same generated code on WinAppSDK 2.4 draws 18 dashes, dash 4, gap 14, which matches the Lottie reference. Only XAML Shape.StrokeDashArray / StrokeDashOffset are relative to StrokeThickness.

How to reproduce it (as minimally and precisely as possible) 🔬

var line = compositor.CreateLineGeometry();
line.Start = new Vector2(10, 20);
line.End = new Vector2(210, 20);
var shape = compositor.CreateSpriteShape(line);
shape.StrokeThickness = 6f;
shape.StrokeBrush = compositor.CreateColorBrush(Colors.Red);
shape.StrokeDashCap = CompositionStrokeCap.Flat;
shape.StrokeDashArray.Add(10f);
shape.StrokeDashArray.Add(10f);
// host it in a ShapeVisual via ElementCompositionPreview.SetElementChildVisual

WinUI: dashes alternate every 10px. Uno: they alternate every 60px.

Workaround 🛠️

Divide Composition dash values by StrokeThickness on Uno only (not WinUI-correct). For Lottie content, avoid dashes or use stroke width 1.

Affected platforms 📱💻🖥️

All platforms 🌍 (Skia and managed/WebGPU drawing backends)

Uno.Sdk version (and other relevant versions) 📦

Uno.Sdk 7.0 dev builds (current master); LottieGen 8.2.250604.

IDE version 🧑‍💻

N/A

Anything else we need to know? 💬

The scaling lives in the backend strokers (SkiaGeometrySource2D.Stroke.cs, ManagedGeometry.Stroke.cs), so XAML Shape relies on it implicitly and ManagedSvg divides by the stroke width to compensate.

Activity

  1. added
    kind/bug
    triage/untriaged
    on Oct 10, 2026
  2. added
    7.1
    on Oct 14, 2026
  3. added 4 commits that reference this issue on Oct 14, 2026
    db883cc
    336b936
    4b4d562
    125b954
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

7.1kind/bugtriage/untriaged

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions