Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
florian03-1 committed Feb 10, 2023
2 parents 2afaae5 + dc23c16 commit 3945474
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
# BlazorSvgEditor
# Blazor Svg Editor

Ein Blazor SVG Editor
![Nuget](https://img.shields.io/nuget/v/BlazorSvgEditor)

Blazor Svg Editor is a simple SVG editor for **Blazor** that allows annotations (in the form of SVG elements) to be placed on images. You are able to scale and translate the image (of course with the annotations) and manipulate it with css filters.
Actually it supports circles, rectangles and polygons - but because of the abstract interface they can be easily extended. The shapes are movable and resizable. It is also checked that the shapes are not placed outside the image.

### Demo
A demo application is hosted by GitHub-Pages. You can visit it [here](https://florian03-1.github.io/BlazorSvgEditor/).

## Documentation

### Avaiable Properties
- **CssClass/CssStyle:** Own classes and Styles for the component
- **MinScale/MaxScale**
- **ImageManipulations**: A class with properties for *brightness*, *contrast*, *saturation* and *hue* - they get applied on the loaded image
- **ImageSize**: Set image height and width
- **ImageSource:** There are two ways:
- **Directly**: (via Propertie ImageSource)
- **ImageSourceLoadingFunc:** A async func which loads the image source string (e.g. when you get a base64 string from an api)
- **OnShapeChanged:** Event when Shapes get changed (with information about the ChangeType and the affected shape
- **bind-SelectedShapeId:** The id from the selected shape (can also be set from outside)

### Sample Code for Implementation
Here is a sample code for the implementation.

<SvgEditor @ref="svgEditor" CssClass="class" MinScale="0.8" ImageSize="(1000,750)" ImageManipulations="ImageManipulations" OnShapeChanged="EditorShapeChanged" ImageSourceLoadingFunc="GetImageSource" @bind-SelectedShapeId="SelectedShapeId">

The used ImageLoadFunc look as follows:

private async Task<string> GetImageSource()
{
await Task.Delay(1000); //An async api call is also possible...
return "https://url-to-image.de";
}

For the other methods please take a look at the example project in the Repository.

## Questions, Ideas, Feedback?

Please report bugs or request new features by opening an issue. You can also make an Pull-Request when you implement a new feature.

0 comments on commit 3945474

Please sign in to comment.