liwuqingxin / Avalonia.Svg

Svg render for Avalonia.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool



License

This library is distributed under the MIT license.

About

πŸ““ 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.

Using

  • 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}" />

SVG Viewer using it.

image-20230324012006442

image-20230324012210119

image-20230324012210119

image-20230324012210119

image-20230324012210119

Features

βœ… 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.

Document Structure

Tag Support
svg βœ”οΈ
g βœ”οΈ
defs βœ”οΈ
symbol ❌
use βœ”οΈ
switch ❌
desc, title πŸ“…
matadata πŸ“…

βœ”οΈ Styling

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

βœ”οΈ Geometry Properties

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

βœ”οΈ 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.

βœ”οΈ Paths

Support it.

βœ”οΈ Basic Shapes

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

πŸ“… Text

Not yet.

❌ Embedded Content

Not yet and no plan about it.

βœ”οΈ Painting: Filling, Stroking and Marker Symbols

We have supported fill, stroke. πŸ“… Marker is not supported yet.

βœ”οΈ Paint Servers: Gradients and Patterns

We have supported gradients. πŸ“… Patterns not yet.

❌ Scripting and Interactivity

Not yet and no plan about it.

❌ 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.

About

Svg render for Avalonia.

License:MIT License


Languages

Language:C# 100.0%