by abenedik
1. August 2011 10:19
I am happy to announce that the new version of Ab2d.ReaderSvg library is available.
The version adds improved support for svg use and embedded svg elements. Those two svg elements are now correctly placed and have the correct size.
The new version also provides two new properties that can be used to fix problems that are caused by the differences between WPF and svg.
The first new property is SwitchElementProcessingType. It specifies which children of the svg switch element will be imported and shown. The switch element in svg file defines children that are shown based on the conditions defined in switch element. Because it is not possible to process svg conditions in WPF, it is possible to choose how the children will be imported and which children will be shown. The possible values for SwitchElementProcessingType are:
- Disabled - svg switch element will not be imported.
- ShowFirstDiscardOthers - only the first switch child will be imported. Other children will not be imported.
- ShowFirstHideOthers - all switch children will be imported. Only the first element will be shown. Other children will have their Visibility set to Hidden.
- ShowFirstCollapseOthers (default) - all switch children will be imported. Only the first element will be shown. Other children will have their Visibility set to Collapsed.
- ShowAll - all switch children will be imported and shown.
The second new property is OverrideMiterLimit. The property has been added because WPF renders miter limit line cab differently as they are defined in svg specifications. The miter lime cabs show sharp line edges. But when the two lines meet at low angle, the sharp edge could extend very far away from the line junction. Therefore the miter limit can limit the sharp edges. In WPF the miter limit is used to specify how far away the sharp edge is allowed to go. In svg, the miter limit defined at which angle the miter limit is converted into beveled edge. This difference can lead to some anomalies when importing svg files. In this case the OverrideMiterLimit can be used to override the miter limit specified in the svg file and use value 1 or 2 instead.
For more information about the differences please see forum thread about this.
For backwards compatibility by default the miter limit defined in svg file is used (OverrideMiterLimit = 0).
Both new properties can be also set in the new ViewerSvg (here the default OverrideMiterLimit is set to 2 - miter limit of 2 is used by default).