This library is distributed under the MIT license.
📓 Avalonia.Svg is a .net rendering engine for loading and displaying Scalable Vector Graphics (SVG) files in Avalonia applications. It provides a simple way to load and render SVG files as part of your UI.
🎓 Avalonia is a cross-platform .net UI framework.
📅 This library could be also available in WPF in future, not now.
🔔 Objects generated by this rendering engine are static and non-editable.
😢 My English is not very well. Please forgive me if there are any mistakes in my expression.
❤️ Any suggestions and comments are appreciated. If you find a bug or would like to contribute to this library, please open an issue or submit a pull request on GitHub.
-
About nuget: Not available now.
-
Using Icon control and it's IconSvg Property.
<controls:Icon Width="24"
Height="24"
IconSvg="avares://Nlnet.Avalonia.Svg.Sample/Assets/bug-fill.svg" />
- Using Icon control and it's IconSvgData Property.
<controls:Icon ClipToBounds="{Binding #ClipToBounds.IsChecked}"
IconStretch="Uniform"
IconSvg="avares://Nlnet.Avalonia.Svg.Sample/Assets/NLNet.svg"
IconSvgData="{Binding Path=EditableSvgData}"
IsHitTestVisible="False"
Opacity="{Binding #SvgGroundOpacity.Value}"
ShowDiagnosis="{Binding #ShowDiagnosis.IsChecked}" />
✅ The Avalonia.Svg library supports a variety of features for loading and rendering SVG files, including:
- Loading SVG files from a svg data, svg file or a stream.
Resolving external resources (such as images) referenced in the SVG file.- Applying transformations (such as scaling, rotation, and translation) to the SVG image.
- Setting the fill and stroke colors of the SVG image.
- Clipping the SVG image to a specific area.
😔 While the Avalonia.Svg
library supports a wide range of SVG features, there are some limitations to be aware of:
-
The library does not support all SVG elements and attributes. In particular, some advanced features (such as filters and masks) are not currently supported.
-
Animation and some other external feature of SVG are not supported, like resolving external resources (such as images) referenced in the SVG file.
-
Performance may be impacted when rendering complex SVG files with a large number of elements or gradients. We have not made any performance optimization about it till now.
📅 Pattern, masker and mark are coming soon.
Tag | Support | |
---|---|---|
svg | ✔️ | |
g | ✔️ | |
defs | ✔️ | |
symbol | ❌ | |
use | ✔️ | |
switch | ❌ | |
desc, title | 📅 | |
matadata | 📅 |
We have implemented the CSS style system for SVG. We support explicit style, implicit style with selectors and local setter to set property.
We support all geometry properties include cx, ry, r, rx, ry, x, y, width, height.
We support viewBox, transform and preserveAspectRatio properties. Note that the viewBox and preserveAspectRatio is only available in svg tag now.
Support it.
We support all basic shapes include rect, circle, ellipse, line, polyline, poligon.
Not yet.
Not yet and no plan about it.
We have supported fill, stroke. 📅 Marker is not supported yet.
We have supported gradients. 📅 Patterns not yet.
Not yet and no plan about it.
Not yet and no plan about it.
The version 1.0.0 would come after the use and pattern being done. And then we will make a nuget package for developers.
None.