Skip to content

Commit

Permalink
Fixes to use property "clip-rule" in clip-path.
Browse files Browse the repository at this point in the history
  • Loading branch information
mntone committed Mar 18, 2018
1 parent 56a1aa2 commit 12dcf6f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Expand Up @@ -8,7 +8,7 @@ namespace Mntone.SvgForXaml
{
public sealed class CssStyleDeclaration
{
private static readonly string[] NON_INHERIT_PROPERTIES = { "clip-path", "stop-color", "stop-opacity", "opacity" };
private static readonly string[] NON_INHERIT_PROPERTIES = { "clip-path", "clip-rule", "stop-color", "stop-opacity", "opacity" };

private readonly ISvgStylable _parent;
private readonly List<string> _items;
Expand Down Expand Up @@ -101,6 +101,7 @@ internal void SetProperty(string propertyName, string value, string priority, bo
public SvgStopColor StopColor => this.GetPropertyCssValue("stop-color") as SvgStopColor;
public SvgNumber? StopOpacity => this.GetPropertyCssValue("stop-opacity") as SvgNumber?;
public SvgIri ClipPath => this.GetPropertyCssValue("clip-path") as SvgIri;
public SvgFillRule? ClipRule => this.GetPropertyCssValue("clip-rule") as SvgFillRule?;
public SvgNumber? Opacity => this.GetPropertyCssValue("opacity") as SvgNumber?;

private void ParseText(string css)
Expand Down
Expand Up @@ -21,6 +21,7 @@ internal sealed class SvgStylableHelper
"stop-color",
"stop-opacity",
"clip-path",
"clip-rule",
"opacity",
};

Expand Down
4 changes: 2 additions & 2 deletions Mntone.SvgForXaml/Mntone.SvgForXaml.Shared/Win2dRenderer.cs
Expand Up @@ -233,7 +233,7 @@ protected override void RenderPolygon(CanvasDrawingSession session, SvgPolygonEl
}
}

private CanvasGeometry CreatePath(CanvasDrawingSession session, SvgPathElement element)
private CanvasGeometry CreatePath(CanvasDrawingSession session, SvgPathElement element, bool isClip = false)
{
if (this.PathCache.ContainsKey(element)) return this.PathCache[element];

Expand All @@ -246,7 +246,7 @@ private CanvasGeometry CreatePath(CanvasDrawingSession session, SvgPathElement e
CanvasGeometry geometry;
using (var builder = new CanvasPathBuilder(this.ResourceCreator))
{
var fillRule = element.Style.FillRule;
var fillRule = isClip ? element.Style.ClipRule : element.Style.FillRule;
if (fillRule.HasValue && fillRule.Value.Value != SvgFillRuleType.EvenOdd)
{
builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
Expand Down

0 comments on commit 12dcf6f

Please sign in to comment.