Skip to content
Permalink
Browse files

Fixes to use property "clip-rule" in clip-path.

  • Loading branch information...
mntone committed Mar 18, 2018
1 parent 56a1aa2 commit 12dcf6f10ccd7e72039eb1222f58893252fa378d
@@ -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;
@@ -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)
@@ -21,6 +21,7 @@ internal sealed class SvgStylableHelper
"stop-color",
"stop-opacity",
"clip-path",
"clip-rule",
"opacity",
};

@@ -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];

@@ -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);

0 comments on commit 12dcf6f

Please sign in to comment.
You can’t perform that action at this time.