Skip to content

Commit

Permalink
bugfix - default fill should be black
Browse files Browse the repository at this point in the history
  • Loading branch information
jogibear9988 committed Feb 18, 2019
1 parent 9949243 commit 0723c6d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
13 changes: 12 additions & 1 deletion SVGImage/SVGImage/SVG/SVGRender.cs
Expand Up @@ -98,7 +98,18 @@ private GeometryDrawing NewDrawingItem(Shape shape, Geometry geometry)
break;
}
}
if (shape.Fill != null)

if (shape.Fill == null)
{
item.Brush = Brushes.Black;
if (OverrideColor != null)
item.Brush = new SolidColorBrush(Color.FromArgb((byte)(255 * shape.Opacity), OverrideColor.Value.R, OverrideColor.Value.G, OverrideColor.Value.B));
GeometryGroup g = new GeometryGroup();
g.FillRule = FillRule.Nonzero;
g.Children.Add(geometry);
geometry = g;
}
else if (shape.Fill != null)
{
item.Brush = shape.Fill.FillBrush(this.SVG, this, shape, shape.Opacity, geometry.Bounds);
if (OverrideColor != null)
Expand Down
6 changes: 3 additions & 3 deletions SVGImage/SVGImage/SVG/Shapes/Text.cs
Expand Up @@ -86,7 +86,7 @@ public override System.Windows.Media.Transform Transform
public int StartIndex {get; set;}
public string Text {get; set;}
public Element End {get; set;}
public Element(Shape parent, string text) : base(null, (XmlNode)null, parent)
public Element(SVG svg, Shape parent, string text) : base(svg, (XmlNode)null, parent)
{
this.ElementType = eElementType.Text;
this.Text = text;
Expand Down Expand Up @@ -150,15 +150,15 @@ static Element Parse(SVG svg, string text, ref int curPos, Element parent, Eleme
{
// remaining pure text
string s = text.Substring(curPos, text.Length - curPos);
tag.Children.Add(new Element(tag, s));
tag.Children.Add(new Element(svg, tag, s));
return tag;
}
if (next != null && next.StartIndex-prevPos > 0)
{
// pure text between tspan elements
int diff = next.StartIndex-prevPos;
string s = text.Substring(prevPos, diff);
tag.Children.Add(new Element(tag, s));
tag.Children.Add(new Element(svg, tag, s));
}
if (next.Text.StartsWith("<tspan"))
{
Expand Down

0 comments on commit 0723c6d

Please sign in to comment.