Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG Paths doesn't accept single Move-to command when marker-end is specified #223

Closed
jnickg opened this issue Mar 18, 2016 · 0 comments
Closed

Comments

@jnickg
Copy link

jnickg commented Mar 18, 2016

Overview

According to the SVG 1.1 specification the grammar for SVG Path data can have only one Move-to (M or m) command and a single coordinate pair. See below for example derivation, with production steps. At any point where a nonterminal is optional, it is omitted:

svg-path
moveto-drawto-command-groups
moveto-drawto-command-group
moveto
("M" | "m") moveto-argument-sequence
("M" | "m") coordinate-pair
("M" | "m") coordinate coordinate
("M" | "m") number number
("M" | "m") integer-constant integer-constant
("M" | "m") integer-constant integer-constant
("M" | "m") digit-sequence digit-sequence
("M" | "m") digit digit
("M" | "m") ("0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9") ("0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9")

However, putting sample SVG (Attached) into the SVGViewer gives the below exception. Using a Path with one more argument (Sample) renders without an exception.

System.ArgumentException was unhandled
  HResult=-2147024809
  Message=Parameter is not valid.
  Source=System.Drawing
  StackTrace:
       at System.Drawing.Drawing2D.GraphicsPath.get_PathPoints()
       at Svg.SvgPath.RenderStroke(ISvgRenderer renderer) in d:\repos\SVG\Source\Paths\SvgPath.cs:line 159
       at Svg.SvgVisualElement.Render(ISvgRenderer renderer, Boolean renderFilter) in d:\repos\SVG\Source\Basic Shapes\SvgVisualElement.cs:line 153
       at Svg.SvgVisualElement.Render(ISvgRenderer renderer) in d:\repos\SVG\Source\Basic Shapes\SvgVisualElement.cs:line 109
       at Svg.SvgElement.RenderChildren(ISvgRenderer renderer) in d:\repos\SVG\Source\SvgElement.cs:line 726
       at Svg.SvgElement.Render(ISvgRenderer renderer) in d:\repos\SVG\Source\SvgElement.cs:line 714
       at Svg.SvgFragment.Render(ISvgRenderer renderer) in d:\repos\SVG\Source\Document Structure\SvgFragment.cs:line 169
       at Svg.SvgDocument.Draw(Bitmap bitmap) in d:\repos\SVG\Source\SvgDocument.cs:line 501
       at Svg.SvgDocument.Draw() in d:\repos\SVG\Source\SvgDocument.cs:line 466
       at SVGViewer.SVGViewer.RenderSvg(SvgDocument svgDoc) in d:\repos\SVG\Samples\SVGViewer\SvgViewer.cs:line 48
       at SVGViewer.SVGViewer.open_Click(Object sender, EventArgs e) in d:\repos\SVG\Samples\SVGViewer\SvgViewer.cs:line 29
       at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
       at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
       at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ToolStrip.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at SVGViewer.Program.Main() in d:\repos\SVG\Samples\SVGViewer\Program.cs:line 18
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

File summary:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants