04-23-2014, 03:57 PM
I understand now. The following code:
<GeometryDrawing>
- <GeometryDrawing.Pen>
<Pen Brush="#00FFFFFF" Thickness="0" />
</GeometryDrawing.Pen>
- <GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,0,32,32" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
does ensure that the read geometry have the correct size. The size is specified in the svg root element: width="32px" height="32px"
With geometry objects it is not possible to specify size as with shapes (Canvas Width="32" Height="32"), therefore ReaderSvg adds a transparent rectangle with the specified size.
As I have guessed, the reason for many DrawingGroups is that your second svg file have many group ("g") elements.
You also mentioned that you had some hidden images (when posting the second svg content, you deleted that comment). There is a known issue in the current version of ReaderSvg where hidden elements influence the size measured when AutoSize is true. I am preparing a new version of ReaderSvg - this issue was be resolved with this version.
<GeometryDrawing>
- <GeometryDrawing.Pen>
<Pen Brush="#00FFFFFF" Thickness="0" />
</GeometryDrawing.Pen>
- <GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,0,32,32" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
does ensure that the read geometry have the correct size. The size is specified in the svg root element: width="32px" height="32px"
With geometry objects it is not possible to specify size as with shapes (Canvas Width="32" Height="32"), therefore ReaderSvg adds a transparent rectangle with the specified size.
As I have guessed, the reason for many DrawingGroups is that your second svg file have many group ("g") elements.
You also mentioned that you had some hidden images (when posting the second svg content, you deleted that comment). There is a known issue in the current version of ReaderSvg where hidden elements influence the size measured when AutoSize is true. I am preparing a new version of ReaderSvg - this issue was be resolved with this version.
Andrej Benedik