You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unable to display a very simple SVG file. I have included the bit of test code below (as well as the contents of the svg file - see the comment in the code). So if someone could tell me what I am doing wrong I would be most grateful.
I have stepped through the code with the debugger, no error codes and no exceptions. However the SvgDoc object does not
contain what I expected.
The SvgDoc.Root property is set, this is good. The Root element has a tag of "svg", this is good. The Root element First and Last child properties are set to Nothing, this is not good!! I would have expected them to be set to the circle element.
Scratching my head over this one!!
By the way how do I get the nice syntax highlighted code instead of the boring old black white?
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim D2D1factory As Vortice.Direct2D1.ID2D1Factory7 = D2D1.D2D1CreateFactory(Of ID2D1Factory7)()
'
' RenderPanel is a simple System.Windows.Forms.Panel
'
' Here is the complete circle.svg file:
'
' <?xml version="1.0" encoding="UTF-8" standalone="no"?>
' <svg xmlns = "http://www.w3.org/2000/svg" version="1.1" height="320" width="256">
' <circle style = "fill:none;stroke:#ffffff;stroke-width:10" r="64" cx="160" cy="128" />
' </svg>
'
Dim Size As New Vortice.Mathematics.SizeI(RenderPanel.ClientSize.Width, RenderPanel.ClientSize.Height)
Dim Props As New HwndRenderTargetProperties
Props.Hwnd = RenderPanel.Handle
Props.PixelSize = Size
Dim Target As ID2D1HwndRenderTarget = D2D1factory.CreateHwndRenderTarget(New RenderTargetProperties, Props)
Dim Context As ID2D1DeviceContext5 = Target.QueryInterface(Of ID2D1DeviceContext5)
Dim SvgStream As IStream = Nothing
Dim result As Integer = SHCreateStreamOnFile("circle.svg", 0, SvgStream)
SvgStream.Seek(0, IO.SeekOrigin.Begin)
Dim SvgDoc As ID2D1SvgDocument = Context.CreateSvgDocument(SvgStream, New Mathematics.Size(RenderPanel.ClientSize.Width, RenderPanel.ClientSize.Height))
Target.BeginDraw()
Target.Clear(Mathematics.Colors.Black)
Context.DrawSvgDocument(SvgDoc)
Target.EndDraw()
End Sub
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Unable to display a very simple SVG file. I have included the bit of test code below (as well as the contents of the svg file - see the comment in the code). So if someone could tell me what I am doing wrong I would be most grateful.
I have stepped through the code with the debugger, no error codes and no exceptions. However the SvgDoc object does not
contain what I expected.
The SvgDoc.Root property is set, this is good. The Root element has a tag of "svg", this is good. The Root element First and Last child properties are set to Nothing, this is not good!! I would have expected them to be set to the circle element.
Scratching my head over this one!!
By the way how do I get the nice syntax highlighted code instead of the boring old black white?
Beta Was this translation helpful? Give feedback.
All reactions