Commit 3fd0b2ea authored by davescriven's avatar davescriven
Browse files

- Fix for #6072 - Two issues:

- SvgGradientStop offset values were not being confined to percentages (0.0-1.0 or %) so a ToPercentage() method has been added to SvgUnit which converts to a percentage unit. This method is called during the Offset property setter.
- SvgLinearGradientServer was incorrectly calculating the end point of the gradient.
parent ad06b3ad
......@@ -111,6 +111,22 @@ namespace Svg
return this._deviceValue.Value;
}
public SvgUnit ToPercentage()
{
switch (this.Type)
{
case SvgUnitType.Percentage:
return this;
case SvgUnitType.User:
return new SvgUnit(SvgUnitType.Percentage, this.Value * 100);
default:
throw new NotImplementedException();
break;
}
return this;
}
public override bool Equals(object obj)
{
if (obj == null)
......
......@@ -16,7 +16,10 @@ namespace Svg
public SvgUnit Offset
{
get { return this._offset; }
set { this._offset = value; }
set
{
this._offset = value.ToPercentage();
}
}
[SvgAttribute("stop-color")]
......
......@@ -106,7 +106,7 @@ namespace Svg
}
float x = (this.End.X.IsEmpty) ? start.X : this.End.X.ToDeviceValue(owner);
end = new PointF(x, (start.Y + this.End.Y.ToDeviceValue(owner, true)));
end = new PointF(x, this.End.Y.ToDeviceValue(owner, true));
}
else
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment