Commit 3034b3d3 authored by Tebjan Halm's avatar Tebjan Halm
Browse files

* added get path to svggroup

* added method to collect paths of children elements
* fixed possible bug getinheritedattribute
parent 6998823a
......@@ -71,6 +71,22 @@ namespace Svg
renderer.ScaleTransform(this.Width.ToDeviceValue() / this.ViewBox.Width, this.Height.ToDeviceValue() / this.ViewBox.Height, MatrixOrder.Append);
}
}
/// <summary>
/// Gets the <see cref="GraphicsPath"/> for this element.
/// </summary>
/// <value></value>
public GraphicsPath Path
{
get
{
var path = new GraphicsPath();
AddPaths(this, path);
return path;
}
}
/// <summary>
/// Initializes a new instance of the <see cref="SvgFragment"/> class.
......@@ -78,7 +94,7 @@ namespace Svg
public SvgFragment()
{
this._height = new SvgUnit(SvgUnitType.Percentage, 100.0f);
this._width = 1000.0f;
this._width = new SvgUnit(SvgUnitType.Percentage, 100.0f);
this.ViewBox = SvgViewBox.Empty;
}
}
......
......@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Xml;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace Svg
{
......@@ -33,7 +34,14 @@ namespace Svg
/// <value></value>
public override System.Drawing.Drawing2D.GraphicsPath Path
{
get { return null; }
get
{
var path = new GraphicsPath();
AddPaths(this, path);
return path;
}
}
/// <summary>
......
......@@ -41,27 +41,31 @@
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DebugType>Full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\..\..\Dev\vvvv\vvvv\public\common\src\thirdparty\</OutputPath>
<OutputPath>..\..\vvvv\public\common\src\thirdparty\</OutputPath>
<DefineConstants>TRACE;DEBUG;REFLECTION</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DebugType>PdbOnly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\..\..\..\Dev\vvvv\vvvv\public\common\src\thirdparty\</OutputPath>
<OutputPath>..\..\vvvv\public\common\src\thirdparty\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRules>
</CodeAnalysisRules>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.JScript" />
......@@ -208,4 +212,17 @@
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
</PropertyGroup>
</Project>
\ No newline at end of file
......@@ -63,7 +63,7 @@ namespace Svg
/// <returns>The attribute value if available; otherwise the ancestors value for the same attribute; otherwise the default value of <typeparamref name="TAttributeType"/>.</returns>
public TAttributeType GetInheritedAttribute<TAttributeType>(string attributeName)
{
if (this.ContainsKey(attributeName) && base[attributeName] != null)
if (this.ContainsKey(attributeName) /*&& base[attributeName] != null*/)
{
return (TAttributeType)base[attributeName];
}
......
......@@ -405,6 +405,26 @@ namespace Svg
{
this.Render(renderer);
}
/// <summary>
/// Recursive method to add up the paths of all children
/// </summary>
/// <param name="elem"></param>
/// <param name="path"></param>
protected void AddPaths(SvgElement elem, GraphicsPath path)
{
foreach(var c in elem.Children)
{
if (c is SvgVisualElement)
{
var cp = ((SvgVisualElement)c).Path;
if (cp != null) path.AddPath(cp, false);
}
AddPaths(c, path);
}
}
/// <summary>
/// Creates a new object that is a copy of the current instance.
......
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