Table of Contents

Class SkiaSvg

Namespace
DrawnUi.Draw
Assembly
DrawnUi.Maui.dll
[ContentProperty("SvgString")]
public class SkiaSvg : SkiaControl, INotifyPropertyChanged, IEffectControlProvider, IToolTipElement, IContextFlyoutElement, IAnimatable, IVisualElementController, IElementController, IView, ITransform, IElement, IVisualTreeElement, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISkiaGestureListener, IHasAfterEffects, ISkiaControl, IDrawnBase, ICanBeUpdatedWithContext, ICanBeUpdated, ISkiaDisposable, IDisposable
Inheritance
SkiaSvg
Implements
Inherited Members
Extension Methods

Constructors

SkiaSvg()

public SkiaSvg()

Fields

AspectProperty

public static readonly BindableProperty AspectProperty

Field Value

BindableProperty

FontAwesomePrimaryColorProperty

public static readonly BindableProperty FontAwesomePrimaryColorProperty

Field Value

BindableProperty

FontAwesomeSecondaryColorProperty

public static readonly BindableProperty FontAwesomeSecondaryColorProperty

Field Value

BindableProperty

GradientBlendModeProperty

public static readonly BindableProperty GradientBlendModeProperty

Field Value

BindableProperty

HasContentProperty

public static readonly BindableProperty HasContentProperty

Field Value

BindableProperty

HorizontalAlignmentProperty

public static readonly BindableProperty HorizontalAlignmentProperty

Field Value

BindableProperty

HorizontalOffsetProperty

public static readonly BindableProperty HorizontalOffsetProperty

Field Value

BindableProperty

IconFilePathProperty

public static readonly BindableProperty IconFilePathProperty

Field Value

BindableProperty

InflateAmountProperty

public static readonly BindableProperty InflateAmountProperty

Field Value

BindableProperty

ShadowBlurProperty

public static readonly BindableProperty ShadowBlurProperty

Field Value

BindableProperty

ShadowColorProperty

public static readonly BindableProperty ShadowColorProperty

Field Value

BindableProperty

ShadowXProperty

public static readonly BindableProperty ShadowXProperty

Field Value

BindableProperty

ShadowYProperty

public static readonly BindableProperty ShadowYProperty

Field Value

BindableProperty

SourceProperty

public static readonly BindableProperty SourceProperty

Field Value

BindableProperty

SvgHorizontalOptionsProperty

public static readonly BindableProperty SvgHorizontalOptionsProperty

Field Value

BindableProperty

SvgStringProperty

public static readonly BindableProperty SvgStringProperty

Field Value

BindableProperty

SvgVerticalOptionsProperty

public static readonly BindableProperty SvgVerticalOptionsProperty

Field Value

BindableProperty

TintColorProperty

public static readonly BindableProperty TintColorProperty

Field Value

BindableProperty

VerticalAlignmentProperty

public static readonly BindableProperty VerticalAlignmentProperty

Field Value

BindableProperty

VerticalOffsetProperty

public static readonly BindableProperty VerticalOffsetProperty

Field Value

BindableProperty

ZoomProperty

public static readonly BindableProperty ZoomProperty

Field Value

BindableProperty

ZoomXProperty

public static readonly BindableProperty ZoomXProperty

Field Value

BindableProperty

ZoomYProperty

public static readonly BindableProperty ZoomYProperty

Field Value

BindableProperty

Properties

Aspect

public TransformAspect Aspect { get; set; }

Property Value

TransformAspect

FontAwesomePrimaryColor

public Color FontAwesomePrimaryColor { get; set; }

Property Value

Color

FontAwesomeSecondaryColor

public Color FontAwesomeSecondaryColor { get; set; }

Property Value

Color

GradientBlendMode

When FIllGradient is set this will override its blend mode for drawing SVG with gradient

public SKBlendMode GradientBlendMode { get; set; }

Property Value

SKBlendMode

HasContent

public bool HasContent { get; set; }

Property Value

bool

HorizontalAlignment

public DrawImageAlignment HorizontalAlignment { get; set; }

Property Value

DrawImageAlignment

HorizontalOffset

public double HorizontalOffset { get; set; }

Property Value

double

IconFilePath

public string IconFilePath { get; set; }

Property Value

string

InflateAmount

public double InflateAmount { get; set; }

Property Value

double

LoadedString

protected string LoadedString { get; set; }

Property Value

string

RenderingPaint

protected SKPaint RenderingPaint { get; set; }

Property Value

SKPaint

ShadowBlur

public double ShadowBlur { get; set; }

Property Value

double

ShadowColor

public Color ShadowColor { get; set; }

Property Value

Color

ShadowX

public double ShadowX { get; set; }

Property Value

double

ShadowY

public double ShadowY { get; set; }

Property Value

double

Source

public string Source { get; set; }

Property Value

string

Svg

Protected SKSvg container

public SKSvg Svg { get; protected set; }

Property Value

SKSvg

SvgHorizontalOptions

public LayoutAlignment SvgHorizontalOptions { get; set; }

Property Value

LayoutAlignment

SvgString

public string SvgString { get; set; }

Property Value

string

SvgVerticalOptions

public LayoutAlignment SvgVerticalOptions { get; set; }

Property Value

LayoutAlignment

TintColor

public Color TintColor { get; set; }

Property Value

Color

VerticalAlignment

public DrawImageAlignment VerticalAlignment { get; set; }

Property Value

DrawImageAlignment

VerticalOffset

public double VerticalOffset { get; set; }

Property Value

double

Zoom

public double Zoom { get; set; }

Property Value

double

ZoomX

public double ZoomX { get; set; }

Property Value

double

ZoomY

public double ZoomY { get; set; }

Property Value

double

Methods

CalculateDisplayRect(SKRect, float, float, DrawImageAlignment, DrawImageAlignment)

public static SKRect CalculateDisplayRect(SKRect dest, float bmpWidth, float bmpHeight, DrawImageAlignment horizontal, DrawImageAlignment vertical)

Parameters

dest SKRect
bmpWidth float
bmpHeight float
horizontal DrawImageAlignment
vertical DrawImageAlignment

Returns

SKRect

Clear()

public void Clear()

CreateSvg(string)

Loads svg into container from string. For public access use SvgString property instead.

protected virtual bool CreateSvg(string loadedString)

Parameters

loadedString string

Returns

bool

DrawPicture(SKCanvas, SKPicture, SKRect, TransformAspect, DrawImageAlignment, DrawImageAlignment, SKPaint)

protected void DrawPicture(SKCanvas canvas, SKPicture picture, SKRect dest, TransformAspect stretch, DrawImageAlignment horizontal = DrawImageAlignment.Center, DrawImageAlignment vertical = DrawImageAlignment.Center, SKPaint paint = null)

Parameters

canvas SKCanvas
picture SKPicture
dest SKRect
stretch TransformAspect
horizontal DrawImageAlignment
vertical DrawImageAlignment
paint SKPaint

LoadSource(string)

This is not replacing current animation, use SetAnimation for that.

public virtual Task LoadSource(string fileName)

Parameters

fileName string

Returns

Task

LoadSvgFromBytes(byte[])

Directly loads svg from bytes array into container

public virtual bool LoadSvgFromBytes(byte[] byteArray)

Parameters

byteArray byte[]

Returns

bool

NeedUpdateIcon(BindableObject, object, object)

protected static void NeedUpdateIcon(BindableObject bindable, object oldvalue, object newvalue)

Parameters

bindable BindableObject
oldvalue object
newvalue object

OnDisposing()

Base performs some cleanup actions with Superview

public override void OnDisposing()

OnPropertyChanged(string)

Method that is called when a bound property is changed.

protected override void OnPropertyChanged(string propertyName = "")

Parameters

propertyName string

The name of the bound property that changed.

Paint(DrawingContext)

This is the main drawing routine you should override to draw something. Base one paints background color inside DrawingRect that was defined by Arrange inside base.Draw. Pass arguments if you want to use some time-frozen data for painting at any time from any thread..

protected override void Paint(DrawingContext ctx)

Parameters

ctx DrawingContext

UpdateIcon()

public void UpdateIcon()

UpdateImageFromString(string)

protected void UpdateImageFromString(string source)

Parameters

source string

Events

Error

Happens when loaded with error from Source. Will pass exception.

public event EventHandler<Exception> Error

Event Type

EventHandler<Exception>

Success

Happens when loaded fine from Source. Will pass source as string.

public event EventHandler<string> Success

Event Type

EventHandler<string>