liwuqingxin / Avalonia.Svg

Svg render for Avalonia.
MIT License
17 stars 1 forks source link
avalonia rendering rendering-2d-graphics svg vector



License

This library is distributed under the MIT license.

About

:notebook: 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.

:mortar_board: Avalonia is a cross-platform .net UI framework.

:date: This library could be also available in WPF in future, not now.

:bell: Objects generated by this rendering engine are static and non-editable.

:cry: My English is not very well. Please forgive me if there are any mistakes in my expression.

:heart: 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.

Using

<controls:Icon Width="24"
               Height="24"
               IconSvg="avares://Nlnet.Avalonia.Svg.Sample/Assets/bug-fill.svg" />
<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}" />

SVG Viewer using it.

image-20230324012006442

image-20230324012210119

image-20230324012210119

image-20230324012210119

image-20230324012210119

Features

:white_check_mark: The Avalonia.Svg library supports a variety of features for loading and rendering SVG files, including:

:pensive: While the Avalonia.Svg library supports a wide range of SVG features, there are some limitations to be aware of:

:date: Pattern, masker and mark are coming soon.

Document Structure

Tag Support
svg :heavy_check_mark:
g :heavy_check_mark:
defs :heavy_check_mark:
symbol :x:
use :heavy_check_mark:
switch :x:
desc, title :date:
matadata :date:

:heavy_check_mark: Styling

We have implemented the CSS style system for SVG. We support explicit style, implicit style with selectors and local setter to set property.

:heavy_check_mark: Geometry Properties

We support all geometry properties include cx, ry, r, rx, ry, x, y, width, height.

:heavy_check_mark: Coordinate Systems, Transformations and Units

We support viewBox, transform and preserveAspectRatio properties. Note that the viewBox and preserveAspectRatio is only available in svg tag now.

:heavy_check_mark: Paths

Support it.

:heavy_check_mark: Basic Shapes

We support all basic shapes include rect, circle, ellipse, line, polyline, poligon.

:date: Text

Not yet.

:x: Embedded Content

Not yet and no plan about it.

:heavy_check_mark: Painting: Filling, Stroking and Marker Symbols

We have supported fill, stroke. :date: Marker is not supported yet.

:heavy_check_mark: Paint Servers: Gradients and Patterns

We have supported gradients. :date: Patterns not yet.

:x: Scripting and Interactivity

Not yet and no plan about it.

:x: Linking

Not yet and no plan about it.

Release Plan

The version 1.0.0 would come after the use and pattern being done. And then we will make a nuget package for developers.

Q&A

None.