Class SkiaControl
public class SkiaControl : VisualElement, 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
-
SkiaControl
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
SkiaControl()
public SkiaControl()
Fields
AddMarginBottomProperty
public static readonly BindableProperty AddMarginBottomProperty
Field Value
AddMarginLeftProperty
public static readonly BindableProperty AddMarginLeftProperty
Field Value
AddMarginRightProperty
public static readonly BindableProperty AddMarginRightProperty
Field Value
AddMarginTopProperty
public static readonly BindableProperty AddMarginTopProperty
Field Value
AddTranslationXProperty
public static readonly BindableProperty AddTranslationXProperty
Field Value
AddTranslationYProperty
public static readonly BindableProperty AddTranslationYProperty
Field Value
AdjustClippingProperty
public static readonly BindableProperty AdjustClippingProperty
Field Value
AlignContentHorizontalProperty
public static readonly BindableProperty AlignContentHorizontalProperty
Field Value
AlignContentVerticalProperty
public static readonly BindableProperty AlignContentVerticalProperty
Field Value
AllowCachingProperty
public static readonly BindableProperty AllowCachingProperty
Field Value
AnimationTappedProperty
public static readonly BindableProperty AnimationTappedProperty
Field Value
AutoCacheProperty
public static readonly BindableProperty AutoCacheProperty
Field Value
BindableTriggerProperty
public static readonly BindableProperty BindableTriggerProperty
Field Value
BlackColor
public static Color BlackColor
Field Value
BlockGesturesBelowProperty
public static readonly BindableProperty BlockGesturesBelowProperty
Field Value
ChildrenProperty
public static readonly BindableProperty ChildrenProperty
Field Value
ClearColorProperty
public static readonly BindableProperty ClearColorProperty
Field Value
ClipEffectsProperty
public static readonly BindableProperty ClipEffectsProperty
Field Value
ClipWithProperty
public static readonly BindableProperty ClipWithProperty
Field Value
ClippedEffectsWithProperty
public static readonly BindableProperty ClippedEffectsWithProperty
Field Value
CommandChildTappedProperty
public static readonly BindableProperty CommandChildTappedProperty
Field Value
ControlStyleProperty
public static readonly BindableProperty ControlStyleProperty
Field Value
DebugRenderingColor
public static SKColor DebugRenderingColor
Field Value
DebugRenderingProperty
public static readonly BindableProperty DebugRenderingProperty
Field Value
DefaultBlendMode
protected static SKBlendMode DefaultBlendMode
Field Value
DelegateGetOnScreenVisibleArea
public Func<Vector2, ScaledRect> DelegateGetOnScreenVisibleArea
Field Value
DirtyChildrenTracker
public readonly ControlsTracker DirtyChildrenTracker
Field Value
DisableEffectsProperty
public static readonly BindableProperty DisableEffectsProperty
Field Value
DisposalDelay
public static TimeSpan DisposalDelay
Field Value
EffectColorFilter
protected IColorEffect EffectColorFilter
Field Value
EffectImageFilter
protected IImageEffect EffectImageFilter
Field Value
EffectPostRenderers
public List<IPostRendererEffect> EffectPostRenderers
Field Value
EffectRenderers
protected List<IRenderEffect> EffectRenderers
Field Value
EffectsGestureProcessors
protected List<ISkiaGestureProcessor> EffectsGestureProcessors
Field Value
EffectsState
protected List<IStateEffect> EffectsState
Field Value
ExpandDirtyRegionProperty
public static readonly BindableProperty ExpandDirtyRegionProperty
Field Value
FastMeasurementProperty
public static readonly BindableProperty FastMeasurementProperty
Field Value
FillBlendModeProperty
public static readonly BindableProperty FillBlendModeProperty
Field Value
FillGradientProperty
public static readonly BindableProperty FillGradientProperty
Field Value
HeightRequestRatioProperty
public static readonly BindableProperty HeightRequestRatioProperty
Field Value
Helper3d
public Sk3dView Helper3d
Field Value
HorizontalFillRatioProperty
public static readonly BindableProperty HorizontalFillRatioProperty
Field Value
HorizontalOptionsProperty
public static readonly BindableProperty HorizontalOptionsProperty
Field Value
HorizontalPositionOffsetRatioProperty
public static readonly BindableProperty HorizontalPositionOffsetRatioProperty
Field Value
IgnoreChildrenInvalidationsProperty
public static readonly BindableProperty IgnoreChildrenInvalidationsProperty
Field Value
InvalidatedParent
public bool InvalidatedParent
Field Value
IsClippedToBoundsProperty
public static readonly BindableProperty IsClippedToBoundsProperty
Field Value
IsGhostProperty
public static readonly BindableProperty IsGhostProperty
Field Value
IsHoveredProperty
public static readonly BindableProperty IsHoveredProperty
Field Value
ItemTemplateProperty
public static readonly BindableProperty ItemTemplateProperty
Field Value
ItemTemplateTypeProperty
public static readonly BindableProperty ItemTemplateTypeProperty
Field Value
LastArrangedInside
protected SKRect LastArrangedInside
Field Value
LastGradient
protected CachedGradient LastGradient
Field Value
LastShadow
protected CachedShadow LastShadow
Field Value
LockChildrenGesturesProperty
public static readonly BindableProperty LockChildrenGesturesProperty
Field Value
LockDraw
Lock between replacing and using RenderObject
protected object LockDraw
Field Value
LockFocusProperty
public static readonly BindableProperty LockFocusProperty
Field Value
LockIterateListeners
protected object LockIterateListeners
Field Value
LockMeasure
public object LockMeasure
Field Value
LockRatioProperty
public static readonly BindableProperty LockRatioProperty
Field Value
LockRenderObject
Creating new cache lock
protected object LockRenderObject
Field Value
MarginProperty
public static readonly BindableProperty MarginProperty
Field Value
NeedRemeasuring
protected bool NeedRemeasuring
Field Value
OnGestures
Delegate for use instead of calling base.OnSkiaGestureEvent
public Func<SkiaGesturesParameters, GestureEventProcessingInfo, ISkiaGestureListener> OnGestures
Field Value
PaddingProperty
public static readonly BindableProperty PaddingProperty
Field Value
PaintErase
protected SKPaint PaintErase
Field Value
ParentProperty
public static readonly BindableProperty ParentProperty
Field Value
PendingUnattachedAnimators
protected ConcurrentBag<ISkiaAnimator> PendingUnattachedAnimators
Field Value
Perspective1Property
public static readonly BindableProperty Perspective1Property
Field Value
Perspective2Property
public static readonly BindableProperty Perspective2Property
Field Value
Random
public static Random Random
Field Value
RedColor
public static Color RedColor
Field Value
RenderCount
protected long RenderCount
Field Value
RenderingInvalidated
protected long RenderingInvalidated
Field Value
RenderingScaleProperty
public static readonly BindableProperty RenderingScaleProperty
Field Value
RotationZProperty
public static readonly BindableProperty RotationZProperty
Field Value
RoundCenterAlignment
public bool RoundCenterAlignment
Field Value
SkewXProperty
public static readonly BindableProperty SkewXProperty
Field Value
SkewYProperty
public static readonly BindableProperty SkewYProperty
Field Value
SkipRenderingOutOfBoundsProperty
public static readonly BindableProperty SkipRenderingOutOfBoundsProperty
Field Value
SpacingProperty
public static readonly BindableProperty SpacingProperty
Field Value
TagProperty
public static readonly BindableProperty TagProperty
Field Value
TouchEffectColorProperty
public static readonly BindableProperty TouchEffectColorProperty
Field Value
TransformViewProperty
public static readonly BindableProperty TransformViewProperty
Field Value
TranslationZProperty
public static readonly BindableProperty TranslationZProperty
Field Value
TransparentColor
public static Color TransparentColor
Field Value
UpdateWhenReturnedFromBackgroundProperty
public static readonly BindableProperty UpdateWhenReturnedFromBackgroundProperty
Field Value
UpdatedInvalidation
protected long UpdatedInvalidation
Field Value
UpdatedRendering
protected long UpdatedRendering
Field Value
UseCacheProperty
public static readonly BindableProperty UseCacheProperty
Field Value
Value1Property
public static readonly BindableProperty Value1Property
Field Value
Value2Property
public static readonly BindableProperty Value2Property
Field Value
Value3Property
public static readonly BindableProperty Value3Property
Field Value
Value4Property
public static readonly BindableProperty Value4Property
Field Value
VerticalFillRatioProperty
public static readonly BindableProperty VerticalFillRatioProperty
Field Value
VerticalOptionsProperty
public static readonly BindableProperty VerticalOptionsProperty
Field Value
VerticalPositionOffsetRatioProperty
public static readonly BindableProperty VerticalPositionOffsetRatioProperty
Field Value
ViewportHeightLimitProperty
public static readonly BindableProperty ViewportHeightLimitProperty
Field Value
ViewportWidthLimitProperty
public static readonly BindableProperty ViewportWidthLimitProperty
Field Value
VirtualisationInflatedProperty
public static readonly BindableProperty VirtualisationInflatedProperty
Field Value
VirtualizationProperty
public static readonly BindableProperty VirtualizationProperty
Field Value
VisualEffectsProperty
public static readonly BindableProperty VisualEffectsProperty
Field Value
WhiteColor
public static Color WhiteColor
Field Value
WidthRequestRatioProperty
public static readonly BindableProperty WidthRequestRatioProperty
Field Value
_arrangedViewportHeightLimit
protected double _arrangedViewportHeightLimit
Field Value
_arrangedViewportWidthLimit
protected double _arrangedViewportWidthLimit
Field Value
_builtRenderTreeStamp
protected long _builtRenderTreeStamp
Field Value
_lastMeasuredForScale
protected float _lastMeasuredForScale
Field Value
_measuredStamp
protected long _measuredStamp
Field Value
_paintWithEffects
protected SKPaint _paintWithEffects
Field Value
_paintWithOpacity
protected SKPaint _paintWithOpacity
Field Value
lockMeasured
protected object lockMeasured
Field Value
lockPausingAnimators
protected object lockPausingAnimators
Field Value
semaphoreOffsecreenProcess
protected SemaphoreSlim semaphoreOffsecreenProcess
Field Value
Properties
AddMarginBottom
public double AddMarginBottom { get; set; }
Property Value
AddMarginLeft
public double AddMarginLeft { get; set; }
Property Value
AddMarginRight
public double AddMarginRight { get; set; }
Property Value
AddMarginTop
public double AddMarginTop { get; set; }
Property Value
AddTranslationX
public double AddTranslationX { get; set; }
Property Value
AddTranslationY
public double AddTranslationY { get; set; }
Property Value
AdjustClipping
public Thickness AdjustClipping { get; set; }
Property Value
AlignContentHorizontal
public LayoutOptions AlignContentHorizontal { get; set; }
Property Value
AlignContentVertical
public LayoutOptions AlignContentVertical { get; set; }
Property Value
AllowCaching
Might want to set this to False for certain cases.
public bool AllowCaching { get; set; }
Property Value
AnimationTapped
public SkiaTouchAnimation AnimationTapped { get; set; }
Property Value
ArrangedDestination
public SKRect ArrangedDestination { get; protected set; }
Property Value
AutoCache
Control will be responsible for controlling cache instead of using UseCache property.
public bool AutoCache { get; set; }
Property Value
BindableTrigger
public object BindableTrigger { get; set; }
Property Value
BindingContextWasSet
protected bool BindingContextWasSet { get; set; }
Property Value
BindingsContextCacheWasRendered
protected bool BindingsContextCacheWasRendered { get; set; }
Property Value
BlockGesturesBelow
If set to true will not allow gestures to go below
public bool BlockGesturesBelow { get; set; }
Property Value
CacheValidity
public SkiaControl.CacheValidityType CacheValidity { get; protected set; }
Property Value
CachedImage
Provides a cached image if any
public virtual SKImage CachedImage { get; }
Property Value
CanDraw
public virtual bool CanDraw { get; }
Property Value
Children
This is used by MAUI to set content from XAML.
public IList<SkiaControl> Children { get; set; }
Property Value
ClearColor
public Color ClearColor { get; set; }
Property Value
ClipEffects
This cuts shadows etc
public bool ClipEffects { get; set; }
Property Value
ClipWith
Can specify another control that would provide the clipping region for this one.
public SkiaControl ClipWith { get; set; }
Property Value
ClippedEffectsWith
Can specify another control that would provide the clipping region to be used by post animattors etc.
public SkiaControl ClippedEffectsWith { get; set; }
Property Value
Clipping
public Action<SKPath, SKRect> Clipping { get; set; }
Property Value
CommandChildTapped
Child was tapped. Will pass the tapped child as parameter. You might want then read child's BindingContext etc.. This works only if your control implements ISkiaGestureListener. If this is set then the Tapped gesture will be consumed by this control after passing it to child.
public ICommand CommandChildTapped { get; set; }
Property Value
ContentSize
public ScaledSize ContentSize { get; protected set; }
Property Value
ContextIndex
For internal use, will be set for recycled/templated views by the ViewFactory to the corresponding index in the data source.
public int ContextIndex { get; set; }
Property Value
ControlStyle
Will be used by control CreateDefaultContent to create appropriate look. Then controls use a virtual UsingControlStyle property to define their look.
public PrebuiltControlStyle ControlStyle { get; set; }
Property Value
Count
Gets the number of elements contained in the ICollection<T>.
public int Count { get; }
Property Value
- int
The number of elements contained in the ICollection<T>.
CustomizeLayerPaint
Can customize the SKPaint used for painting the object
public Action<SKPaint, SKRect> CustomizeLayerPaint { get; set; }
Property Value
DebugRendering
public bool DebugRendering { get; set; }
Property Value
DebugString
public virtual string DebugString { get; }
Property Value
DefaultContentCreated
protected bool DefaultContentCreated { get; set; }
Property Value
DelegateDrawCache
public Action<DrawingContext, CachedObject> DelegateDrawCache { get; set; }
Property Value
DirtyChildrenInternal
protected HashSet<SkiaControl> DirtyChildrenInternal { get; set; }
Property Value
DirtyRegion
public SKRect DirtyRegion { get; set; }
Property Value
DisableEffects
public bool DisableEffects { get; set; }
Property Value
DrawingRect
This is the destination in PIXELS with margins applied, using this to paint background. Since we enabled subpixel drawing (for smooth scroll etc) expect this to have non-rounded values, use CompareRects and similar for comparison.
public SKRect DrawingRect { get; set; }
Property Value
ExecuteAfterCreated
This will be executed ones along and just before the CreateDefaultContent. This lets you execute initialization code after the control is already in the view tree and all variables you might want to use are already filled.
public Dictionary<string, Action<SkiaControl>> ExecuteAfterCreated { get; }
Property Value
ExecuteOnPaint
public Dictionary<string, Action<SkiaControl, DrawingContext>> ExecuteOnPaint { get; }
Property Value
ExecuteUponDisposal
This will be executed when the control is being disposed, use to avoid memory leaks. Example of usage, an extension that would subscribe to something and add unsubscribtion here.
public Dictionary<string, Action> ExecuteUponDisposal { get; }
Property Value
ExpandDirtyRegion
Thickness In points. You might want to expand this when your control drops shadows or does something else depassing normal bounds. This will be used for ImageComposite dirty regions management and when caching rectangles Normally cache is recorded inside DrawingRect, but you might want to expand this to include shadows around, for example. Specify number of points by which you want to expand the recording area. Also you might maybe want to include a bigger area if your control is not inside the DrawingRect due to transforms/translations. Override GetCacheRecordingArea method for a similar action.
public Thickness ExpandDirtyRegion { get; set; }
Property Value
FastMeasurement
When true, uses single-pass fast measurement. When false, uses 3-pass measurement with Fill handling.
public bool FastMeasurement { get; set; }
Property Value
FillBlendMode
public SKBlendMode FillBlendMode { get; set; }
Property Value
FillGradient
public SkiaGradient FillGradient { get; set; }
Property Value
GestureListenerRegistrationTime
public DateTime? GestureListenerRegistrationTime { get; set; }
Property Value
GestureListeners
Children we should check for touch hits
public SortedGestureListeners GestureListeners { get; }
Property Value
GesturesEffect
public AddGestures.GestureListener GesturesEffect { get; set; }
Property Value
HasFillGradient
public bool HasFillGradient { get; }
Property Value
HasItemTemplate
public bool HasItemTemplate { get; }
Property Value
Height
public double Height { get; set; }
Property Value
HeightRequestRatio
HeightRequest Multiplier, default is 1.0
public double HeightRequestRatio { get; set; }
Property Value
Hero
Optional scene hero control identifier
public string Hero { get; set; }
Property Value
HitBoxAuto
This can be absolutely false if we are inside a cached rendering object parent that already moved somewhere. So coords will be of the moment we were first drawn, while if cached parent moved, our coords might differ. todo detect if parent is cached somewhere and offset hotbox by cached parent movement offset... todo think about it baby =) meanwhile just do not set gestures below cached level
public virtual SKRect HitBoxAuto { get; }
Property Value
HorizontalFillRatio
This would be applied to the reported available dimension for the control to fill. The parent layout is responsible for aliignement.
public double HorizontalFillRatio { get; set; }
Property Value
HorizontalOptions
public LayoutOptions HorizontalOptions { get; set; }
Property Value
HorizontalPositionOffsetRatio
public double HorizontalPositionOffsetRatio { get; set; }
Property Value
IgnoreChildrenInvalidations
public bool IgnoreChildrenInvalidations { get; set; }
Property Value
Invalidated
public bool Invalidated { get; set; }
Property Value
InverseRenderTransformMatrix
Gets the inverse of the rendering transformation matrix for hit testing
public SKMatrix InverseRenderTransformMatrix { get; }
Property Value
IsAlive
public ObjectAliveType IsAlive { get; set; }
Property Value
IsCacheImage
public bool IsCacheImage { get; }
Property Value
IsCacheOperations
public bool IsCacheOperations { get; }
Property Value
IsClippedToBounds
This cuts shadows etc. You might want to enable it for some cases as it speeds up the rendering, it is False by default
public bool IsClippedToBounds { get; set; }
Property Value
IsDisposed
public bool IsDisposed { get; protected set; }
Property Value
IsDisposing
public bool IsDisposing { get; protected set; }
Property Value
IsGhost
Takes place in layout, acts like is visible, but just not rendering
public bool IsGhost { get; set; }
Property Value
IsHovered
public bool IsHovered { get; set; }
Property Value
IsLayoutDirty
Set this by parent if needed, normally child can detect this itsself. If true will call Arrange when drawing.
public bool IsLayoutDirty { get; set; }
Property Value
IsLayoutReady
Will be set by OnLayoutReady
public bool IsLayoutReady { get; protected set; }
Property Value
IsMeasuring
Flag for internal use, maynly used to avoid conflicts between measuring on ui-thread and in background. If true, measure will return last measured value.
public bool IsMeasuring { get; protected set; }
Property Value
IsOverlay
do not ever erase background
public bool IsOverlay { get; set; }
Property Value
IsParentIndependent
public bool IsParentIndependent { get; set; }
Property Value
IsReadOnly
Gets a value indicating whether the ICollection<T> is read-only.
public bool IsReadOnly { get; }
Property Value
- bool
true if the ICollection<T> is read-only; otherwise, false.
IsRendering
protected bool IsRendering { get; set; }
Property Value
this[int]
Gets or sets the element at the specified index.
public IView this[int index] { get; set; }
Parameters
indexintThe zero-based index of the element to get or set.
Property Value
- IView
The element at the specified index.
Exceptions
- ArgumentOutOfRangeException
indexis not a valid index in the IList<T>.- NotSupportedException
The property is set and the IList<T> is read-only.
ItemTemplate
Kind of BindableLayout.DrawnTemplate
public DataTemplate ItemTemplate { get; set; }
Property Value
ItemTemplateType
ItemTemplate alternative for faster creation
public Type ItemTemplateType { get; set; }
Property Value
LastDrawnAt
Location on the canvas after last drawing completed
public SKRect LastDrawnAt { get; protected set; }
Property Value
LayoutReady
public bool LayoutReady { get; protected set; }
Property Value
Left
Offset cache (RenderObject) in points. This works similar to TranslationX but uses no matrix transform, works faster. For code-behind fast reposition of cached controls, background thread friendly, no bindings involved. Cached controls only, not a bindable property, doesn't trigger repaint, would need to do this manually if needed.
public double Left { get; set; }
Property Value
LifecycleState
public ControlLifecycleState LifecycleState { get; protected set; }
Property Value
LinkTransforms
public SkiaControl LinkTransforms { get; set; }
Property Value
LockChildrenGestures
What gestures are allowed to be passed to children below. If set to Enabled wit, otherwise can be more specific.
public LockTouch LockChildrenGestures { get; set; }
Property Value
LockFocus
public bool LockFocus { get; set; }
Property Value
LockRatio
Locks the final size to the min (-1.0 -> 0.0) or max (0.0 -> 1.0) of the provided size.
public double LockRatio { get; set; }
Property Value
Margin
public Thickness Margin { get; set; }
Property Value
Margins
Total calculated margins in points
public Thickness Margins { get; protected set; }
Property Value
MeasuredSize
public ScaledSize MeasuredSize { get; set; }
Property Value
NativeParent
public Element NativeParent { get; }
Property Value
NeedAutoHeight
public virtual bool NeedAutoHeight { get; }
Property Value
NeedAutoSize
public virtual bool NeedAutoSize { get; }
Property Value
NeedAutoWidth
public virtual bool NeedAutoWidth { get; }
Property Value
NeedDispose
Developer can use this to mark control as to be disposed by parent custom controls
public bool NeedDispose { get; set; }
Property Value
NeedFillHorizontally
public bool NeedFillHorizontally { get; }
Property Value
NeedFillVertically
public bool NeedFillVertically { get; }
Property Value
NeedFillX
public virtual bool NeedFillX { get; }
Property Value
NeedFillY
public virtual bool NeedFillY { get; }
Property Value
NeedMeasure
public virtual bool NeedMeasure { get; set; }
Property Value
NeedUpdate
For internal use, set by Update method
public virtual bool NeedUpdate { get; set; }
Property Value
NeedUpdateFrontCache
Used by ImageDoubleBuffering cache
protected bool NeedUpdateFrontCache { get; set; }
Property Value
NodeAttached
protected bool NodeAttached { get; set; }
Property Value
OutputDebug
Enable this to get console logs specifically from this instance
public bool OutputDebug { get; set; }
Property Value
Padding
public Thickness Padding { get; set; }
Property Value
PaintSystem
protected SKPaint PaintSystem { get; set; }
Property Value
Parent
Do not set this directly if you don't know what you are doing, use SetParent()
public IDrawnBase Parent { get; set; }
Property Value
Perspective1
public float Perspective1 { get; set; }
Property Value
Perspective2
public float Perspective2 { get; set; }
Property Value
PlatformShadow
protected SkiaShadow PlatformShadow { get; set; }
Property Value
PostAnimators
Executed after the rendering
public List<IOverlayEffect> PostAnimators { get; }
Property Value
RenderObject
The cached representation of the control. Will be used on redraws without calling Paint etc, until the control is requested to be updated. This WILL NOT raise PropertyChanged !!! (avoiding MAUI concurrent access conflict) Use OnCacheCreated (CacheCreated event) and OnCacheDestroyed (CacheDestroyed event).
public CachedObject RenderObject { get; set; }
Property Value
RenderTransformMatrix
Stores the transformation matrix used during rendering for hit testing
public SKMatrix RenderTransformMatrix { get; protected set; }
Property Value
RenderTree
Last rendered controls tree. Used by gestures etc..Please use SetRenderingTree method for setting it correctly.
public List<SkiaControlWithRect> RenderTree { get; protected set; }
Property Value
RenderedAtDestination
public SKRect RenderedAtDestination { get; set; }
Property Value
RenderingScale
public float RenderingScale { get; set; }
Property Value
RotationZ
Gets or sets the rotation (in degrees) about the Z-axis (perspective rotation) when the element is rendered. This is a bindable property.
public double RotationZ { get; set; }
Property Value
Remarks
Scale
Please use ScaleX, ScaleY instead of this maui property
public double Scale { get; set; }
Property Value
ShouldClipAntialiased
This is not a static bindable property. Can be set manually or by control, for example SkiaShape sets this to true for non-rectangular shapes, or rounded corners..
public bool ShouldClipAntialiased { get; set; }
Property Value
ShouldInvalidateByChildren
public virtual bool ShouldInvalidateByChildren { get; }
Property Value
SizeRequest
Is set by UpdateSizeRequest();
public SKSize SizeRequest { get; protected set; }
Property Value
SkewX
public float SkewX { get; set; }
Property Value
SkewY
public float SkewY { get; set; }
Property Value
SkipRendering
Can be set but custom controls while optimizing rendering etc. Will affect CanDraw.
public bool SkipRendering { get; set; }
Property Value
SkipRenderingOutOfBounds
If set to true will not draw after VisualLayer is set and detected to be out of rendering bound. Useful for drawer contained elements and similar.
public bool SkipRenderingOutOfBounds { get; set; }
Property Value
Spacing
public double Spacing { get; set; }
Property Value
Superview
Our canvas
public DrawnView Superview { get; protected set; }
Property Value
Tag
public string Tag { get; set; }
Property Value
Top
Offset cache (RenderObject) in points. This works similar to TranslationY but uses no matrix transform, works faster. For code-behind fast reposition of cached controls, background thread friendly, no bindings involved. Cached controls only, not a bindable property, doesn't trigger repaint, would need to do this manually if needed.
public double Top { get; set; }
Property Value
TouchEffectColor
public Color TouchEffectColor { get; set; }
Property Value
TransformView
public object TransformView { get; set; }
Property Value
TranslationZ
Gets or sets Z-perspective translation. This is a bindable property.
public double TranslationZ { get; set; }
Property Value
Remarks
Uid
public Guid Uid { get; set; }
Property Value
UpdateLocks
public int UpdateLocks { get; }
Property Value
UpdateWhenReturnedFromBackground
public bool UpdateWhenReturnedFromBackground { get; set; }
Property Value
UseCache
Never reuse the rendering result. Actually true for ScrollLooped SkiaLayout viewport container to redraw its content several times for creating a looped aspect.
public SkiaCacheType UseCache { get; set; }
Property Value
UsePadding
public Thickness UsePadding { get; protected set; }
Property Value
UseTranslationX
public double UseTranslationX { get; }
Property Value
UseTranslationY
public double UseTranslationY { get; }
Property Value
UsingCacheType
public virtual SkiaCacheType UsingCacheType { get; }
Property Value
UsingControlStyle
public virtual PrebuiltControlStyle UsingControlStyle { get; }
Property Value
Value1
For Arc: start angle
public double Value1 { get; set; }
Property Value
Value2
For Arc: sweep angle
public double Value2 { get; set; }
Property Value
Value3
public double Value3 { get; set; }
Property Value
Value4
public double Value4 { get; set; }
Property Value
VerticalFillRatio
This would be applied to the reported available dimension for the control to fill. The parent layout is responsible for aliignement.
public double VerticalFillRatio { get; set; }
Property Value
VerticalOptions
public LayoutOptions VerticalOptions { get; set; }
Property Value
VerticalPositionOffsetRatio
public double VerticalPositionOffsetRatio { get; set; }
Property Value
ViewportHeightLimit
Will be used inside GetDrawingRectWithMargins to limit the height of the DrawingRect
public double ViewportHeightLimit { get; set; }
Property Value
ViewportWidthLimit
Will be used inside GetDrawingRectWithMargins to limit the width of the DrawingRect
public double ViewportWidthLimit { get; set; }
Property Value
Views
For internal use
public List<SkiaControl> Views { get; }
Property Value
Virtualisation
Default is Enabled, children get the visible viewport area for rendering and can virtualize.
public VirtualisationType Virtualisation { get; set; }
Property Value
VirtualisationInflated
How much of the hidden content out of visible bounds should be considered visible for rendering, default is 0 pts. Basically how much should be expand in every direction of the visible area prior to checking if content falls into its bounds for rendering controlled with Virtualisation.
public double VirtualisationInflated { get; set; }
Property Value
VisualEffects
public IList<SkiaEffect> VisualEffects { get; set; }
Property Value
VisualLayer
public VisualLayer? VisualLayer { get; set; }
Property Value
WasMeasured
public bool WasMeasured { get; protected set; }
Property Value
Width
public double Width { get; set; }
Property Value
WidthRequestRatio
WidthRequest Multiplier, default is 1.0
public double WidthRequestRatio { get; set; }
Property Value
WidthRequestWithMargins
Points
public double WidthRequestWithMargins { get; }
Property Value
WillInvalidateMeasure
protected bool WillInvalidateMeasure { get; set; }
Property Value
WillNotUpdateParent
Will not call Update on Parent if True
public bool WillNotUpdateParent { get; set; }
Property Value
X
Absolute position obtained after this control was drawn on the Canvas, this is not relative to parent control.
public double X { get; protected set; }
Property Value
Y
Absolute position obtained after this control was drawn on the Canvas, this is not relative to parent control.
public double Y { get; protected set; }
Property Value
_lastMeasuredForHeight
public float _lastMeasuredForHeight { get; protected set; }
Property Value
_lastMeasuredForWidth
public float _lastMeasuredForWidth { get; protected set; }
Property Value
Methods
ActionWithClipping(SKRect, SKCanvas, Action)
protected void ActionWithClipping(SKRect viewport, SKCanvas canvas, Action draw)
Parameters
AdaptCachedLayout(SKRect, float)
protected virtual void AdaptCachedLayout(SKRect destination, float scale)
Parameters
AdaptConstraintToContentRequest(float, double, double, bool, double, double, float, bool)
public static float AdaptConstraintToContentRequest(float constraintPixels, double measuredDimension, double sideConstraintsPixels, bool autoSize, double minRequest, double maxRequest, float scale, bool canExpand)
Parameters
constraintPixelsfloatmeasuredDimensiondoublesideConstraintsPixelsdoubleautoSizeboolminRequestdoublemaxRequestdoublescalefloatcanExpandbool
Returns
AdaptHeightConstraintToContentRequest(MeasuringConstraints, float, bool)
public float AdaptHeightConstraintToContentRequest(MeasuringConstraints constraints, float contentHeightPixels, bool canExpand)
Parameters
constraintsMeasuringConstraintscontentHeightPixelsfloatcanExpandbool
Returns
AdaptHeightConstraintToContentRequest(float, ScaledSize, double)
public float AdaptHeightConstraintToContentRequest(float heightConstraintPixels, ScaledSize measuredContent, double sideConstraintsPixels)
Parameters
heightConstraintPixelsfloatmeasuredContentScaledSizesideConstraintsPixelsdouble
Returns
AdaptHeightContraintToRequest(float, Thickness, double)
Apply margins to SizeRequest
public float AdaptHeightContraintToRequest(float sizeConstraint, Thickness constraints, double scale)
Parameters
Returns
AdaptSizeRequestToContent(double, double)
In UNITS
protected Size AdaptSizeRequestToContent(double widthRequestPts, double heightRequestPts)
Parameters
Returns
AdaptToContraints(SKRect, double, double, double, double)
public SKRect AdaptToContraints(SKRect measuredPixels, double constraintLeft, double constraintRight, double constraintTop, double constraintBottom)
Parameters
measuredPixelsSKRectconstraintLeftdoubleconstraintRightdoubleconstraintTopdoubleconstraintBottomdouble
Returns
AdaptWidthConstraintToContentRequest(MeasuringConstraints, float, bool)
public float AdaptWidthConstraintToContentRequest(MeasuringConstraints constraints, float contentWidthPixels, bool canExpand)
Parameters
constraintsMeasuringConstraintscontentWidthPixelsfloatcanExpandbool
Returns
AdaptWidthConstraintToContentRequest(float, ScaledSize, double)
public float AdaptWidthConstraintToContentRequest(float widthConstraintPixels, ScaledSize measuredContent, double sideConstraintsPixels)
Parameters
widthConstraintPixelsfloatmeasuredContentScaledSizesideConstraintsPixelsdouble
Returns
AdaptWidthConstraintToRequest(float, Thickness, double)
Apply margins to SizeRequest
public float AdaptWidthConstraintToRequest(float sizeConstraint, Thickness constraints, double scale)
Parameters
Returns
Add(IView)
Adds an item to the ICollection<T>.
public void Add(IView item)
Parameters
itemIViewThe object to add to the ICollection<T>.
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
AddOrRemoveView(SkiaControl, bool)
protected void AddOrRemoveView(SkiaControl subView, bool add)
Parameters
subViewSkiaControladdbool
AddPaintArguments(DrawingContext)
public virtual DrawingContext AddPaintArguments(DrawingContext ctx)
Parameters
ctxDrawingContext
Returns
AddSubView(SkiaControl)
Directly adds a view to the control, without any layouting. Use this instead of Views.Add() to avoid memory leaks etc
public virtual void AddSubView(SkiaControl control)
Parameters
controlSkiaControl
AnimateAsync(Action<double>, Action, float, Easing, CancellationTokenSource)
Creates a new animator, animates from 0 to 1 over a given time, and calls your callback with the current eased value
public Task AnimateAsync(Action<double> callback, Action callbaclOnCancel = null, float ms = 250, Easing easing = null, CancellationTokenSource cancel = null)
Parameters
callbackAction<double>callbaclOnCancelActionmsfloateasingEasingcancelCancellationTokenSource
Returns
AnimateRangeAsync(Action<double>, double, double, double, Easing, int, CancellationToken)
When the animator is cancelled if applyEndValueOnStop is true then the end value will be sent to your callback
public Task AnimateRangeAsync(Action<double> callback, double start, double end, double length = 250, Easing easing = null, int delayMs = 0, CancellationToken cancel = default)
Parameters
callbackAction<double>startdoubleenddoublelengthdoubleeasingEasingdelayMsintcancelCancellationToken
Returns
ApplyBindingContext()
public virtual void ApplyBindingContext()
ApplyMeasureResult()
Normally get a a Measure by parent then parent calls Draw and we can apply the measure result. But in a case we have measured us ourselves inside PreArrange etc we must call ApplyMeasureResult because this would happen after the Draw and not before.
public virtual void ApplyMeasureResult()
ApplyTransformationMatrix(SkiaDrawingContext)
protected virtual void ApplyTransformationMatrix(SkiaDrawingContext ctx)
Parameters
ApplyTransforms(SkiaDrawingContext, SKRect)
protected virtual void ApplyTransforms(SkiaDrawingContext ctx, SKRect destination)
Parameters
ctxSkiaDrawingContextdestinationSKRect
ApplyTransforms(SKRect)
Will apply additional offsets: Left and Top. This is for GESTURES ONLY! work in progress
public SKRect ApplyTransforms(SKRect rect)
Parameters
rectSKRect
Returns
AreClose(double, double)
Ported from Avalonia: AreClose - Returns whether or not two doubles are "close". That is, whether or not they are within epsilon of each other.
public static bool AreClose(double value1, double value2)
Parameters
Returns
AreClose(float, float)
Ported from Avalonia: AreClose - Returns whether or not two floats are "close". That is, whether or not they are within epsilon of each other.
public static bool AreClose(float value1, float value2)
Parameters
Returns
AreEqual(double, double, double)
public static bool AreEqual(double v1, double v2, double precision)
Parameters
Returns
AreEqual(float, float, float)
public static bool AreEqual(float v1, float v2, float precision)
Parameters
Returns
AreVectorsEqual(Vector2, Vector2, float)
public static bool AreVectorsEqual(Vector2 v1, Vector2 v2, float precision)
Parameters
Returns
Arrange(SKRect, float, float, float)
destination in PIXELS, requests in UNITS. resulting Destination prop will be filed in PIXELS. DrawUsingRenderObject wil call this among others..
public virtual void Arrange(SKRect destination, float widthRequest, float heightRequest, float scale)
Parameters
ArrangeCache(SKRect, float, float, float)
Arranges the control and updates its cache's LastDestination property. Used by ImageComposite composition mode when skipping drawing of non-dirty children but still needing to update their position for gesture coordinate translation.
public virtual void ArrangeCache(SKRect destination, float widthRequest, float heightRequest, float scale)
Parameters
AttachEffects()
protected void AttachEffects()
AvoidRemeasuring(MeasureRequest)
public virtual bool AvoidRemeasuring(MeasureRequest request)
Parameters
requestMeasureRequest
Returns
BuildDrawingOffsetRecursive(SKPoint, SkiaControl, bool, bool)
public SKPoint BuildDrawingOffsetRecursive(SKPoint offset, SkiaControl control, bool ignoreCache, bool useTranslation = true)
Parameters
offsetSKPointcontrolSkiaControlignoreCachebooluseTranslationbool
Returns
BuildDrawnOffsetRecursive(SKPoint, SkiaControl, bool, bool)
public SKPoint BuildDrawnOffsetRecursive(SKPoint offset, SkiaControl control, bool ignoreCache, bool useTranslation = true)
Parameters
offsetSKPointcontrolSkiaControlignoreCachebooluseTranslationbool
Returns
BuildSelfDrawingPosition(SKPoint, SkiaControl, bool)
public SKPoint BuildSelfDrawingPosition(SKPoint offset, SkiaControl control, bool isChild)
Parameters
offsetSKPointcontrolSkiaControlisChildbool
Returns
CalculateFuturePositionOffset(bool, bool, bool)
public virtual SKPoint CalculateFuturePositionOffset(bool cacheOnly = false, bool ignoreCache = false, bool useTranlsation = true)
Parameters
Returns
CalculateLayout(SKRect, float, float, float)
destination in PIXELS, requests in UNITS. resulting Destination prop will be filed in PIXELS. Not using Margins nor UsePadding Children are responsible to apply UsePadding to their content and to apply Margin to destination when measuring and drawing
public virtual SKRect CalculateLayout(SKRect destination, float widthRequest, float heightRequest, float scale)
Parameters
Returns
CalculateMargins()
Summing up Margins and AddMargin.. properties
public virtual void CalculateMargins()
CalculatePositionOffset(bool, bool, bool)
public virtual SKPoint CalculatePositionOffset(bool cacheOnly = false, bool ignoreCache = false, bool useTranlsation = true)
Parameters
Returns
CalculateSizeRequest()
protected virtual void CalculateSizeRequest()
CheckCachedObjectValid(CachedObject, SKRect, SkiaDrawingContext)
protected virtual bool CheckCachedObjectValid(CachedObject cache, SKRect recordingArea, SkiaDrawingContext context)
Parameters
cacheCachedObjectrecordingAreaSKRectcontextSkiaDrawingContext
Returns
CheckChildGestureHit(SkiaControl, SkiaGesturesParameters, GestureEventProcessingInfo)
Ckecks if direct child is hit by gesture
public virtual bool CheckChildGestureHit(SkiaControl child, SkiaGesturesParameters args, GestureEventProcessingInfo apply)
Parameters
childSkiaControlargsSkiaGesturesParametersapplyGestureEventProcessingInfo
Returns
CheckChildrenGesturesLocked(TouchActionResult)
protected bool CheckChildrenGesturesLocked(TouchActionResult action)
Parameters
actionTouchActionResult
Returns
CheckGestureIsForChild(SkiaControl, TouchActionEventArgs, float, float)
protected virtual bool CheckGestureIsForChild(SkiaControl child, TouchActionEventArgs args, float offsetX = 0, float offsetY = 0)
Parameters
childSkiaControlargsTouchActionEventArgsoffsetXfloatoffsetYfloat
Returns
CheckGestureIsInsideChild(SkiaControl, TouchActionEventArgs, float, float)
protected virtual bool CheckGestureIsInsideChild(SkiaControl child, TouchActionEventArgs args, float offsetX = 0, float offsetY = 0)
Parameters
childSkiaControlargsTouchActionEventArgsoffsetXfloatoffsetYfloat
Returns
CheckHovered(SkiaGesturesParameters)
Will check if hovered by pointer and set IsHovered accordingly
public virtual void CheckHovered(SkiaGesturesParameters args)
Parameters
CheckIsGhost()
public bool CheckIsGhost()
Returns
Clear()
Removes all items from the ICollection<T>.
public void Clear()
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
ClearChildren()
public virtual void ClearChildren()
ClearDirtyChildren()
public virtual void ClearDirtyChildren()
ClearParent()
This is called by SetParent when parent should be assigned to null. Internally this sets BindingContext to null after that. You might want to override this to keep BindngContext even if unattached from Parent, for example in case of recycled cells.
public virtual void ClearParent()
ClipSmart(SKCanvas, SKPath, SKClipOperation)
Use antialiasing from ShouldClipAntialiased
public virtual void ClipSmart(SKCanvas canvas, SKPath path, SKClipOperation operation = SKClipOperation.Intersect)
Parameters
canvasSKCanvaspathSKPathoperationSKClipOperation
CombineClipping(SKPath, SKPath)
protected SKPath CombineClipping(SKPath add, SKPath path)
Parameters
Returns
CommitInvalidations()
Apply all postponed invalidation other logic that was postponed until the first draw for optimization. Use this for special code-behind cases, like tests etc, if you cannot wait until the first Draw(). In this version this affects ItemsSource only.
public void CommitInvalidations()
CompareDoubles(double, double, double)
public static bool CompareDoubles(double a, double b, double precision = 5E-324)
Parameters
Returns
CompareFloats(float, float, float)
public static bool CompareFloats(float a, float b, float precision = 1E-45)
Parameters
Returns
CompareRects(SKRect, SKRect, float)
public static bool CompareRects(SKRect a, SKRect b, float precision)
Parameters
Returns
CompareRectsSize(SKRect, SKRect, float)
public static bool CompareRectsSize(SKRect a, SKRect b, float precision)
Parameters
Returns
CompareSize(SKSize, SKSize, float)
public static bool CompareSize(SKSize a, SKSize b, float precision)
Parameters
Returns
CompareVectors(Vector2, Vector2, float)
public static bool CompareVectors(Vector2 a, Vector2 b, float precision)
Parameters
Returns
Contains(IView)
Determines whether the ICollection<T> contains a specific value.
public bool Contains(IView item)
Parameters
itemIViewThe object to locate in the ICollection<T>.
Returns
- bool
true if
itemis found in the ICollection<T>; otherwise, false.
ContractPixelsRect(SKRect, float)
public static SKRect ContractPixelsRect(SKRect rect, float pixels)
Parameters
Returns
ContractPixelsRect(SKRect, float, Thickness)
public static SKRect ContractPixelsRect(SKRect rect, float scale, Thickness amount)
Parameters
Returns
CopyTo(IView[], int)
Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.
public void CopyTo(IView[] array, int arrayIndex)
Parameters
arrayIView[]The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.
arrayIndexintThe zero-based index in
arrayat which copying begins.
Exceptions
- ArgumentNullException
arrayis null.- ArgumentOutOfRangeException
arrayIndexis less than 0.- ArgumentException
The number of elements in the source ICollection<T> is greater than the available space from
arrayIndexto the end of the destinationarray.
CreateClip(object, bool, SKPath)
Create this control clip for painting content. Pass arguments if you want to use some time-frozen data for painting at any time from any thread..
public virtual SKPath CreateClip(object arguments, bool usePosition, SKPath path = null)
Parameters
Returns
CreateContentFromTemplate()
public virtual object CreateContentFromTemplate()
Returns
CreateDefaultContent()
protected virtual void CreateDefaultContent()
CreateGradient(SKRect, SkiaGradient)
public SKShader CreateGradient(SKRect destination, SkiaGradient gradient)
Parameters
destinationSKRectgradientSkiaGradient
Returns
CreateHitRect()
This will be used for gesture detection, return s DrawingRect in bas, you could choose to override to expand etc..
public virtual SKRect CreateHitRect()
Returns
CreateMeasureRequest(float, float, float)
todo use this for layout, actually this is used for measurement only . RenderingScale is set insde.
protected virtual MeasureRequest CreateMeasureRequest(float widthConstraint, float heightConstraint, float scale)
Parameters
Returns
CreateRenderedNode(SKRect, float)
public virtual VisualLayer CreateRenderedNode(SKRect destination, float scale)
Parameters
Returns
CreateRenderedObject(DrawingContext, SKRect, bool)
Technical optional method for some custom logic. Will create as SKImage or SKPicture (asOperations=true). WIll not affect current RenderObject property.
public CachedObject CreateRenderedObject(DrawingContext ctx, SKRect area, bool asOperations)
Parameters
ctxDrawingContextareaSKRectasOperationsbool
Returns
CreateRenderingObject(DrawingContext, SKRect, CachedObject, SkiaCacheType, Action<DrawingContext>)
public virtual CachedObject CreateRenderingObject(DrawingContext context, SKRect recordingArea, CachedObject reuseSurfaceFrom, SkiaCacheType usingCacheType, Action<DrawingContext> action)
Parameters
contextDrawingContextrecordingAreaSKRectreuseSurfaceFromCachedObjectusingCacheTypeSkiaCacheTypeactionAction<DrawingContext>
Returns
CreateRenderingObjectAndPaint(DrawingContext, SKRect, Action<DrawingContext>)
This is NOT calling FinalizeDraw()! parameter 'area' Usually is equal to DrawingRect
protected void CreateRenderingObjectAndPaint(DrawingContext context, SKRect recordingArea, Action<DrawingContext> action)
Parameters
contextDrawingContextrecordingAreaSKRectactionAction<DrawingContext>
CreateShadow(SkiaShadow, float)
public static SKImageFilter CreateShadow(SkiaShadow shadow, float scale)
Parameters
shadowSkiaShadowscalefloat
Returns
CreateSurface(int, int, bool)
public SKSurface CreateSurface(int width, int height, bool isGpu)
Parameters
Returns
CreateTransformationMatrix(SkiaDrawingContext, SKRect)
protected virtual void CreateTransformationMatrix(SkiaDrawingContext ctx, SKRect destination)
Parameters
ctxSkiaDrawingContextdestinationSKRect
DefineAvailableSize(SKRect, float, float, float, bool)
Destination in PIXELS, requests in UNITS. This is affected by HorizontalFillRatio and VerticalFillRatio.
public virtual ScaledSize DefineAvailableSize(SKRect destination, float widthRequest, float heightRequest, float scale, bool useModifiers = true)
Parameters
Returns
DegreesToRadians(double)
public static double DegreesToRadians(double value)
Parameters
valuedouble
Returns
DegreesToRadians(float)
public static float DegreesToRadians(float value)
Parameters
valuefloat
Returns
DestroyRenderingObject()
public void DestroyRenderingObject()
DeviceUnitsToPixels(double)
public static int DeviceUnitsToPixels(double units)
Parameters
unitsdouble
Returns
Dispose()
Avoid setting parent to null before calling this, or set SuperView prop manually for proper cleanup of animations and gestures if any used
public void Dispose()
Dispose(bool)
Releases the unmanaged resources used by the ResourceManager and optionally releases the managed resources.
protected virtual void Dispose(bool disposing)
Parameters
disposingbooltrue to release both managed and unmanaged resources; false to release only unmanaged resources.
DisposeChildren()
public virtual void DisposeChildren()
DisposeObject()
public void DisposeObject()
DisposeObject(IDisposable, string)
Dispose after some number of frames/with needed delay to avoid crashing if still used by GPU thread
public virtual void DisposeObject(IDisposable disposable, string caller = null)
Parameters
disposableIDisposablecallerstring
Draw(DrawingContext)
protected virtual void Draw(DrawingContext context)
Parameters
contextDrawingContext
DrawDirectInternal(DrawingContext, SKRect)
Not using cache
public virtual void DrawDirectInternal(DrawingContext context, SKRect drawingRect)
Parameters
contextDrawingContextcontext.Destination can be bigger than drawingRect
drawingRectSKRectnormally equal to DrawingRect
DrawPlaceholder(DrawingContext)
Called by ImageDoubleBuffered cache rendering when no cache is ready yet. Other controls might use this too to draw placeholders when result is not ready yet.
public virtual void DrawPlaceholder(DrawingContext context)
Parameters
contextDrawingContext
DrawRenderObject(DrawingContext, CachedObject)
Drawing cache, applying clip and transforms as well
public virtual void DrawRenderObject(DrawingContext context, CachedObject cache)
Parameters
contextDrawingContextcacheCachedObject
DrawRenderObject(DrawingContext, float, float, CachedObject)
Technical optional method for some custom logic. Actually used by SkiaMap only.
public void DrawRenderObject(DrawingContext ctx, float x, float y, CachedObject cache = null)
Parameters
ctxDrawingContextxfloatyfloatcacheCachedObject
DrawRenderObjectInternal(DrawingContext, CachedObject)
public virtual void DrawRenderObjectInternal(DrawingContext ctx, CachedObject cache)
Parameters
ctxDrawingContextcacheCachedObject
DrawUsingRenderObject(DrawingContext, float, float)
Returns true if had drawn.
public virtual bool DrawUsingRenderObject(DrawingContext context, float widthRequest, float heightRequest)
Parameters
contextDrawingContextwidthRequestfloatheightRequestfloat
Returns
DrawViews(DrawingContext)
Base method will call RenderViewsList. Return number of drawn views.
protected virtual int DrawViews(DrawingContext context)
Parameters
contextDrawingContext
Returns
DrawWithClipAndTransforms(DrawingContext, SKRect, bool, bool, Action<DrawingContext>)
public void DrawWithClipAndTransforms(DrawingContext ctx, SKRect transformsArea, bool useOpacity, bool useClipping, Action<DrawingContext> draw)
Parameters
ctxDrawingContexttransformsAreaSKRectuseOpacitybooluseClippingbooldrawAction<DrawingContext>
ExecutePostAnimators(DrawingContext)
public void ExecutePostAnimators(DrawingContext context)
Parameters
contextDrawingContext
ExpandPixelsRect(SKRect, float, Thickness)
public static SKRect ExpandPixelsRect(SKRect rect, float scale, Thickness amount)
Parameters
Returns
FadeToAsync(double, float, Easing, CancellationTokenSource)
Fades the drawn view from the current Opacity to end, animator is reused if already running
public Task FadeToAsync(double end, float ms = 250, Easing easing = null, CancellationTokenSource cancel = null)
Parameters
enddoublemsfloateasingEasingcancelCancellationTokenSource
Returns
~SkiaControl()
Releases unmanaged resources before the object is reclaimed by garbage collection.
protected ~SkiaControl()
FinalizeDrawingWithRenderObject(DrawingContext)
Execute post drawing operations, like post-animators etc
protected void FinalizeDrawingWithRenderObject(DrawingContext context)
Parameters
contextDrawingContext
FindRenderedNode(SkiaControl)
public VisualLayer? FindRenderedNode(SkiaControl control)
Parameters
controlSkiaControl
Returns
FindViewByTag(string)
public SkiaControl FindViewByTag(string tag)
Parameters
tagstring
Returns
FindView<TChild>()
public TChild FindView<TChild>() where TChild : SkiaControl
Returns
- TChild
Type Parameters
TChild
FindView<TChild>(string)
public TChild FindView<TChild>(string tag) where TChild : SkiaControl
Parameters
tagstring
Returns
- TChild
Type Parameters
TChild
GenerateParentChain()
This actually used by SkiaMauiElement but could be used by other controls. Also might be useful for debugging purposes.
public VisualTreeChain GenerateParentChain()
Returns
GestureIsInside(TouchActionEventArgs, float, float)
To detect if current location is inside Destination
public bool GestureIsInside(TouchActionEventArgs args, float offsetX = 0, float offsetY = 0)
Parameters
Returns
GestureStartedInside(TouchActionEventArgs, float, float)
To detect if a gesture Start point was inside Destination
public bool GestureStartedInside(TouchActionEventArgs args, float offsetX = 0, float offsetY = 0)
Parameters
Returns
GetAllMarginsInPixels(float)
public virtual Thickness GetAllMarginsInPixels(float scale)
Parameters
scalefloat
Returns
GetAnimatorsManager()
public IAnimatorsManager GetAnimatorsManager()
Returns
GetCacheArea(SKRect)
Normally cache is recorded inside DrawingRect, but you might want to expand this to include shadows around, for example.
protected virtual SKRect GetCacheArea(SKRect value)
Parameters
valueSKRect
Returns
GetCacheRecordingArea(SKRect)
Used for the Operations cache type to record inside the changed area, if your control is not inside the DrawingRect due to transforms/translations. This is NOT changing the rendering object
protected virtual SKRect GetCacheRecordingArea(SKRect drawingRect)
Parameters
drawingRectSKRect
Returns
GetContentSizeForAutosizeInPixels()
Override this if you need to adjust the measured ContentSize for the parent to adapt to it. For example SkiaShape overrides this to expand by adding the needed size for stroke.
protected virtual SKSize GetContentSizeForAutosizeInPixels()
Returns
GetDensity()
public static float GetDensity()
Returns
GetDirectionType(Vector2, DirectionType, float)
public static DirectionType GetDirectionType(Vector2 velocity, DirectionType defaultDirection, float ratio)
Parameters
velocityVector2defaultDirectionDirectionTyperatiofloat
Returns
GetDirectionType(Vector2, Vector2, float)
public static DirectionType GetDirectionType(Vector2 start, Vector2 end, float ratio)
Parameters
Returns
GetDrawingRectForChildren(SKRect, double)
public SKRect GetDrawingRectForChildren(SKRect destination, double scale)
Parameters
Returns
GetDrawingRectWithMargins(SKRect, double)
public virtual SKRect GetDrawingRectWithMargins(SKRect destination, double scale)
Parameters
Returns
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<IView> GetEnumerator()
Returns
- IEnumerator<IView>
An enumerator that can be used to iterate through the collection.
GetFuturePositionOffsetInPixels(bool, bool, bool)
public SKPoint GetFuturePositionOffsetInPixels(bool cacheOnly = false, bool ignoreCache = false, bool useTranslation = true)
Parameters
Returns
GetFuturePositionOnCanvas()
Absolute position in pixels before drawn.
public virtual SKPoint GetFuturePositionOnCanvas()
Returns
GetFuturePositionOnCanvasInPoints(bool)
Absolute position in points
public virtual SKPoint GetFuturePositionOnCanvasInPoints(bool useTranslation = true)
Parameters
useTranslationbool
Returns
GetGesturePositionInsideChild(SkiaControl, SkiaGesturesParameters, GestureEventProcessingInfo)
Returns the point in the local coordinate system of the direct child (relative to its Top/Left). Takes into account the current state of gesture processing (scroll offsets, etc), renders transforms and layout. Returns points (DIPs).
public virtual SKPoint GetGesturePositionInsideChild(SkiaControl child, SkiaGesturesParameters args, GestureEventProcessingInfo apply)
Parameters
childSkiaControlargsSkiaGesturesParametersapplyGestureEventProcessingInfo
Returns
GetHeightRequestPixelsWIthMargins(float)
public float GetHeightRequestPixelsWIthMargins(float scale)
Parameters
scalefloat
Returns
GetHitBoxOnCanvas()
public virtual SKRect GetHitBoxOnCanvas()
Returns
GetMarginsInPixels(float)
public virtual Thickness GetMarginsInPixels(float scale)
Parameters
scalefloat
Returns
GetMeasuringConstraints(MeasureRequest)
public virtual MeasuringConstraints GetMeasuringConstraints(MeasureRequest request)
Parameters
requestMeasureRequest
Returns
GetMeasuringRectForChildren(float, float, double)
public virtual SKRect GetMeasuringRectForChildren(float widthConstraint, float heightConstraint, double scale)
Parameters
Returns
GetNanoseconds()
public static long GetNanoseconds()
Returns
GetOffscreenRenderingAction()
public Action GetOffscreenRenderingAction()
Returns
GetOffsetInsideControlInPixels(PointF, SKPoint)
public SKPoint GetOffsetInsideControlInPixels(PointF location, SKPoint childOffset)
Parameters
Returns
GetOffsetInsideControlInPoints(PointF, SKPoint)
public SKPoint GetOffsetInsideControlInPoints(PointF location, SKPoint childOffset)
Parameters
Returns
GetOnScreenVisibleArea(DrawingContext, Vector2)
For virtualization. For this method to be conditional we introduced the pixelsDestination
parameter so that the Parent could return different visible areas upon context.
Normally pass your current destination you are drawing into as this parameter.
public virtual ScaledRect GetOnScreenVisibleArea(DrawingContext context, Vector2 inflateByPixels = default)
Parameters
contextDrawingContextinflateByPixelsVector2
Returns
GetOrderedSubviews(bool)
public virtual List<SkiaControl> GetOrderedSubviews(bool recalculate = false)
Parameters
recalculatebool
Returns
GetParentElement(IDrawnBase)
public static IDrawnBase GetParentElement(IDrawnBase control)
Parameters
controlIDrawnBase
Returns
GetPositionOffsetInPixels(bool, bool, bool)
public SKPoint GetPositionOffsetInPixels(bool cacheOnly = false, bool ignoreCache = false, bool useTranslation = true)
Parameters
Returns
GetPositionOffsetInPoints()
public SKPoint GetPositionOffsetInPoints()
Returns
GetPositionOnCanvas()
Absolute position in pixels after drawn.
public virtual SKPoint GetPositionOnCanvas()
Returns
GetPositionOnCanvasInPoints()
Absolute position in points
public virtual SKPoint GetPositionOnCanvasInPoints()
Returns
GetRandomColor()
public static Color GetRandomColor()
Returns
GetRenderingScaleFor(float)
public float GetRenderingScaleFor(float measure)
Parameters
measurefloat
Returns
GetRenderingScaleFor(float, float)
Returns rendering scale adapted for another output size, useful for offline rendering
public float GetRenderingScaleFor(float width, float height)
Parameters
Returns
GetSelfDrawingPosition()
Find drawing position for control accounting for all caches up the rendering tree.
public virtual SKPoint GetSelfDrawingPosition()
Returns
GetSizeInPoints(SKSize, float)
public static SKSize GetSizeInPoints(SKSize size, float scale)
Parameters
Returns
GetSizeRequest(float, float, bool)
public virtual SKSize GetSizeRequest(float widthConstraint, float heightConstraint, bool insideLayout)
Parameters
Returns
GetTopParentView()
Use Superview from public area
public virtual DrawnView GetTopParentView()
Returns
GetUnorderedSubviews(bool)
public virtual IReadOnlyList<SkiaControl> GetUnorderedSubviews(bool recalculate = false)
Parameters
recalculatebool
Returns
GetVisualChildren()
Gets a readonly list of the element's visual children.
public virtual IReadOnlyList<IVisualTreeElement> GetVisualChildren()
Returns
- IReadOnlyList<IVisualTreeElement>
A readonly list containing the element's visual children.
Remarks
Unless explicitly defined, an element's visual children will also be its logical children.
GetVisualParent()
Gets the element's visual parent.
public virtual IVisualTreeElement GetVisualParent()
Returns
- IVisualTreeElement
The element's parent.
GetWidthRequestPixelsWIthMargins(float)
public float GetWidthRequestPixelsWIthMargins(float scale)
Parameters
scalefloat
Returns
HasPlatformClip()
protected bool HasPlatformClip()
Returns
HitIsInside(float, float)
ISkiaGestureListener impl
public virtual bool HitIsInside(float x, float y)
Parameters
Returns
IndexOf(IView)
Determines the index of a specific item in the IList<T>.
public int IndexOf(IView item)
Parameters
Returns
- int
The index of
itemif found in the list; otherwise, -1.
InitializeDefaultContent(bool)
Always run this before applying any changes while measuring.
public virtual void InitializeDefaultContent(bool force = false)
Parameters
forcebool
Insert(int, IView)
Inserts an item to the IList<T> at the specified index.
public void Insert(int index, IView item)
Parameters
indexintThe zero-based index at which
itemshould be inserted.itemIViewThe object to insert into the IList<T>.
Exceptions
- ArgumentOutOfRangeException
indexis not a valid index in the IList<T>.- NotSupportedException
The IList<T> is read-only.
Invalidate()
Base calls InvalidateInternal and InvalidateParent
public virtual void Invalidate()
InvalidateByChild(SkiaControl)
To be able to fast track dirty children
public virtual void InvalidateByChild(SkiaControl child)
Parameters
childSkiaControl
InvalidateCache()
public virtual void InvalidateCache()
InvalidateCacheWithPrevious()
public virtual void InvalidateCacheWithPrevious()
InvalidateChildren(SkiaControl)
Will invoke InvalidateInternal on controls and subviews
protected virtual void InvalidateChildren(SkiaControl control)
Parameters
controlSkiaControl
InvalidateChildrenTree()
public virtual void InvalidateChildrenTree()
InvalidateChildrenTree(SkiaControl)
Will invoke InvalidateInternal on controls and subviews
public virtual void InvalidateChildrenTree(SkiaControl control)
Parameters
controlSkiaControl
InvalidateInternal()
Soft invalidation, without requiring update. So next time we try to draw this one it will recalc everything.
public virtual void InvalidateInternal()
InvalidateMeasure()
Marks the current measure of an element as invalidated.
protected override void InvalidateMeasure()
InvalidateMeasureInternal()
public virtual void InvalidateMeasureInternal()
InvalidateParent()
public virtual void InvalidateParent()
InvalidateParents()
If need the re-measure all parents because child-auto-size has changed
public void InvalidateParents()
InvalidateShadowPaint()
protected void InvalidateShadowPaint()
InvalidateViewport()
Indicated that wants to be re-measured without invalidating cache
public virtual void InvalidateViewport()
InvalidateViewsList()
public virtual void InvalidateViewsList()
InvalidateWithChildren()
public virtual void InvalidateWithChildren()
IsGestureForChild(ISkiaGestureListener, SKPoint)
public virtual bool IsGestureForChild(ISkiaGestureListener listener, SKPoint point)
Parameters
listenerISkiaGestureListenerpointSKPoint
Returns
IsGestureForChild(ISkiaGestureListener, float, float)
public virtual bool IsGestureForChild(ISkiaGestureListener listener, float x, float y)
Parameters
listenerISkiaGestureListenerxfloatyfloat
Returns
IsGestureForChild(SkiaControl, SkiaGesturesParameters)
public virtual bool IsGestureForChild(SkiaControl child, SkiaGesturesParameters args)
Parameters
childSkiaControlargsSkiaGesturesParameters
Returns
IsGestureForChild(SkiaControlWithRect, SKPoint)
public virtual bool IsGestureForChild(SkiaControlWithRect child, SKPoint point)
Parameters
childSkiaControlWithRectpointSKPoint
Returns
IsGestureInside(GestureEventProcessingInfo)
public bool IsGestureInside(GestureEventProcessingInfo apply)
Parameters
Returns
IsOne(double)
Avalonia: IsOne - Returns whether or not the double is "close" to 1. Same as AreClose(double, 1), but this is faster.
public static bool IsOne(double value)
Parameters
valuedoubleThe double to compare to 1.
Returns
IsPixelInside(SKRect, float, float)
public bool IsPixelInside(SKRect rect, float x, float y)
Parameters
Returns
IsPixelInside(float, float)
Whether the pixel is inside Destination
public bool IsPixelInside(float x, float y)
Parameters
Returns
IsPointInside(SKRect, float, float, float)
public bool IsPointInside(SKRect rect, float x, float y, float scale)
Parameters
Returns
IsPointInside(float, float, float)
Whether the point is inside Destination
public bool IsPointInside(float x, float y, float scale)
Parameters
Returns
IsRenderObjectValid(SKSize, CachedObject)
public bool IsRenderObjectValid(SKSize size, CachedObject cache = null)
Parameters
sizeSKSizecacheCachedObject
Returns
IsRootView()
public bool IsRootView()
Returns
IsSimpleRectangle(SKPath)
public static bool IsSimpleRectangle(SKPath path)
Parameters
pathSKPath
Returns
IsVisibleInViewTree()
public virtual bool IsVisibleInViewTree()
Returns
ItemTemplateChanged(BindableObject, object, object)
protected static void ItemTemplateChanged(BindableObject bindable, object oldvalue, object newvalue)
Parameters
bindableBindableObjectoldvalueobjectnewvalueobject
Layout(DrawingContext, SKRect)
Helper on top of Measure +Arrange for an easy-use
Input in PIXELS.
public void Layout(DrawingContext context, SKRect destinationPixels)
Parameters
contextDrawingContextdestinationPixelsSKRect
Layout(DrawingContext, int, int, int, int)
Helper on top of Measure +Arrange for an easy-use
Input in PIXELS.
public void Layout(DrawingContext context, int left, int top, int right, int bottom)
Parameters
contextDrawingContextleftinttopintrightintbottomint
Layout(DrawingContext, float, float, float, float)
Helper on top of Measure +Arrange for an easy-use
Input in PIXELS.
public void Layout(DrawingContext context, float left, float top, float right, float bottom)
Parameters
contextDrawingContextleftfloattopfloatrightfloatbottomfloat
LinearGradientAngleToPoints(double)
public static (double X1, double Y1, double X2, double Y2) LinearGradientAngleToPoints(double direction)
Parameters
directiondouble
Returns
LockUpdate(bool)
public virtual void LockUpdate(bool value)
Parameters
valuebool
Measure(float, float, float)
Main method for measuring, override OnMeasuring to plug-in.
public ScaledSize Measure(float widthConstraint, float heightConstraint, float scale)
Parameters
Returns
MeasureAbsolute(SKRect, float)
Measure children inside absolute layout
public virtual ScaledSize MeasureAbsolute(SKRect rectForChildrenPixels, float scale)
Parameters
Returns
MeasureAbsoluteBase(SKRect, float)
Measure children inside absolute layout Base method, not aware of any views provider, not virtual, silly measuring Children.
protected virtual ScaledSize MeasureAbsoluteBase(SKRect rectForChildrenPixels, float scale)
Parameters
Returns
MeasureChild(SkiaControl, double, double, float)
PIXELS
public ScaledSize MeasureChild(SkiaControl child, double availableWidth, double availableHeight, float scale)
Parameters
childSkiaControlavailableWidthdoubleavailableHeightdoublescalefloat
Returns
MeasureContent(IEnumerable<SkiaControl>, SKRect, float)
Measuring as absolute layout for passed children
protected virtual ScaledSize MeasureContent(IEnumerable<SkiaControl> children, SKRect rectForChildrenPixels, float scale)
Parameters
childrenIEnumerable<SkiaControl>rectForChildrenPixelsSKRectscalefloat
Returns
MeasureContentCore(IEnumerable<SkiaControl>, SKRect, float)
Core 3-pass measurement logic for absolute layouts with full FILL support
protected virtual ScaledSize MeasureContentCore(IEnumerable<SkiaControl> children, SKRect rectForChildrenPixels, float scale)
Parameters
childrenIEnumerable<SkiaControl>rectForChildrenPixelsSKRectscalefloat
Returns
MeasureInternal(MeasureRequest)
protected virtual ScaledSize MeasureInternal(MeasureRequest request)
Parameters
requestMeasureRequest
Returns
MeasureSelf(SKRect, float, float, float)
Self measuring, for top controls and those invalidated-redrawn when parents didn't re-measure them
protected virtual void MeasureSelf(SKRect destination, float widthRequest, float heightRequest, float scale)
Parameters
NeedDraw(BindableObject, object, object)
Need to erase cache and draw from scratch
protected static void NeedDraw(BindableObject bindable, object oldvalue, object newvalue)
Parameters
bindableBindableObjectoldvalueobjectnewvalueobject
NeedInvalidateMeasure(BindableObject, object, object)
Need to re-measure and then redraw from scratch
protected static void NeedInvalidateMeasure(BindableObject bindable, object oldvalue, object newvalue)
Parameters
bindableBindableObjectoldvalueobjectnewvalueobject
NeedInvalidateViewport(BindableObject, object, object)
protected static void NeedInvalidateViewport(BindableObject bindable, object oldvalue, object newvalue)
Parameters
bindableBindableObjectoldvalueobjectnewvalueobject
NeedRepaint(BindableObject, object, object)
Just make us repaint to apply new transforms etc keeping existing cache if any
protected static void NeedRepaint(BindableObject bindable, object oldvalue, object newvalue)
Parameters
bindableBindableObjectoldvalueobjectnewvalueobject
NeedToMeasureSelf()
protected virtual bool NeedToMeasureSelf()
Returns
NotValidPoint()
public SKPoint NotValidPoint()
Returns
OnAfterDrawing(DrawingContext)
protected virtual void OnAfterDrawing(DrawingContext context)
Parameters
contextDrawingContext
OnBeforeDrawing(DrawingContext)
protected virtual void OnBeforeDrawing(DrawingContext context)
Parameters
contextDrawingContext
OnBeforeMeasure()
public virtual void OnBeforeMeasure()
OnBindingContextChanged()
First Maui will apply bindings to your controls, then it would call OnBindingContextChanged, so beware on not to break bindings.
protected override void OnBindingContextChanged()
OnCacheCreated()
protected virtual void OnCacheCreated()
OnCacheDestroyed()
protected virtual void OnCacheDestroyed()
OnChildAdded(SkiaControl)
public virtual void OnChildAdded(SkiaControl child)
Parameters
childSkiaControl
OnChildAdded(Element)
Avoid slowing us down with MAUI internals
protected override void OnChildAdded(Element child)
Parameters
childElement
OnChildRemoved(SkiaControl)
public virtual void OnChildRemoved(SkiaControl child)
Parameters
childSkiaControl
OnChildRemoved(Element, int)
Avoid slowing us down with MAUI internals
protected override void OnChildRemoved(Element child, int oldLogicalIndex)
Parameters
OnChildTapped(SkiaControl, SkiaGesturesParameters, GestureEventProcessingInfo)
Layout detected that child was tapped, base used to call callback ChildTapped
public virtual void OnChildTapped(SkiaControl child, SkiaGesturesParameters args, GestureEventProcessingInfo apply)
Parameters
childSkiaControlargsSkiaGesturesParametersapplyGestureEventProcessingInfo
OnChildrenChanged()
Happens when child was added or removed, will call Invalidate() in base
public virtual void OnChildrenChanged()
OnDisposing()
Base performs some cleanup actions with Superview
public virtual void OnDisposing()
OnDrawingSizeChanged()
protected virtual void OnDrawingSizeChanged()
OnFirstDrawn()
protected virtual void OnFirstDrawn()
OnFocusChanged(bool)
This will be called only for views registered at Superview.FocusedChild. The view must return true of false to indicate if it accepts focus.
public virtual bool OnFocusChanged(bool focus)
Parameters
focusbool
Returns
OnHover(bool)
Will be called by the Canvas.
public virtual bool OnHover(bool state)
Parameters
statebool
Returns
OnItemTemplateChanged()
public virtual void OnItemTemplateChanged()
OnLayoutChanged()
DrawingRect size changed
protected virtual void OnLayoutChanged()
OnLayoutPositionChanged()
DrawingRect location changed. This will not be called if OnLayoutChanged was invoked for this frame!
protected virtual void OnLayoutPositionChanged()
OnLayoutReady()
Layout was changed with dimensions above zero. Rather a helper method, can you more generic OnLayoutChanged().
protected virtual void OnLayoutReady()
OnLifecycleStateChanged(ControlLifecycleState)
protected virtual void OnLifecycleStateChanged(ControlLifecycleState state)
Parameters
stateControlLifecycleState
OnMeasured()
protected virtual void OnMeasured()
OnMeasuring(float, float, float)
Input in POINTS
public virtual ScaledSize OnMeasuring(float widthConstraint, float heightConstraint, float scale)
Parameters
Returns
OnPaddingSet(Thickness)
Can override this for custom controls to apply padding differently from the default way
public virtual Thickness OnPaddingSet(Thickness padding)
Parameters
paddingThickness
Returns
OnParentChanged(IDrawnBase, IDrawnBase)
public virtual void OnParentChanged(IDrawnBase newvalue, IDrawnBase oldvalue)
Parameters
newvalueIDrawnBaseoldvalueIDrawnBase
OnParentVisibilityChanged(bool)
todo override for templated skialayout to use ViewsProvider
public virtual void OnParentVisibilityChanged(bool newvalue)
Parameters
newvaluebool
OnPrintDebug()
public virtual void OnPrintDebug()
OnPropertyChanged(string)
Method that is called when a bound property is changed.
protected override void OnPropertyChanged(string propertyName = null)
Parameters
propertyNamestringThe name of the bound property that changed.
OnScaleChanged()
public virtual void OnScaleChanged()
OnSizeChanged()
protected virtual void OnSizeChanged()
OnSkiaGestureEvent(SkiaGesturesParameters, GestureEventProcessingInfo)
Will be called by Canvas. Please override ProcessGestures for handling gestures, this method is for internal use.
public ISkiaGestureListener OnSkiaGestureEvent(SkiaGesturesParameters args, GestureEventProcessingInfo apply)
Parameters
argsSkiaGesturesParametersapplyGestureEventProcessingInfo
Returns
OnSuperviewShouldRenderChanged(bool)
public virtual void OnSuperviewShouldRenderChanged(bool state)
Parameters
statebool
OnTriggerChanged()
public virtual void OnTriggerChanged()
OnViewAttached()
public virtual void OnViewAttached()
OnViewDetached()
public virtual void OnViewDetached()
OnVisibilityChanged(bool)
todo override for templated skialayout to use ViewsProvider
public virtual void OnVisibilityChanged(bool newvalue)
Parameters
newvaluebool
OnVisualEffectsChanged()
protected virtual void OnVisualEffectsChanged()
OnWillDisposeWithChildren()
The OnDisposing might come with a delay to avoid disposing resources at use. This method will be called without delay when Dispose() is invoked. Disposed will set to True and for Views their OnWillDisposeWithChildren will be called.
public virtual void OnWillDisposeWithChildren()
OptionalOnBeforeDrawing()
public virtual void OptionalOnBeforeDrawing()
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 virtual void Paint(DrawingContext ctx)
Parameters
ctxDrawingContext
PaintTintBackground(SKCanvas, SKRect)
destination in pixels, if you see no Scale parameter
public virtual void PaintTintBackground(SKCanvas canvas, SKRect destination)
Parameters
PaintWithEffects(DrawingContext)
public virtual void PaintWithEffects(DrawingContext ctx)
Parameters
ctxDrawingContext
PaintWithShadows(DrawingContext, Action)
protected virtual void PaintWithShadows(DrawingContext ctx, Action render)
Parameters
ctxDrawingContextrenderAction
PauseAllAnimators()
public virtual void PauseAllAnimators()
PixelsToDeviceUnits(double)
public static double PixelsToDeviceUnits(double units)
Parameters
unitsdouble
Returns
PlayRippleAnimation(Color, double, double, bool)
Expecting input coordinates in POINTs and relative to control coordinates. Use GetOffsetInsideControlInPoints to help.
public void PlayRippleAnimation(Color color, double x, double y, bool removePrevious = true)
Parameters
PlayShimmerAnimation(Color, float, float, int, bool)
public void PlayShimmerAnimation(Color color, float shimmerWidth = 50, float shimmerAngle = 45, int speedMs = 1000, bool removePrevious = true)
Parameters
PointIsValid(SKPoint)
public bool PointIsValid(SKPoint point)
Parameters
pointSKPoint
Returns
PostArrange(SKRect, float, float, float)
protected virtual void PostArrange(SKRect destination, float widthRequest, float heightRequest, float scale)
Parameters
PostDrawAction(Action)
Will be executed after canvas has finished drawing current frame. Useful when you need to account for all calculations and drawings to be finished.
public void PostDrawAction(Action action)
Parameters
actionAction
PostponeInvalidation(string, Action)
Used for optimization process, for example, to avoid changing ItemSource several times before the first draw.
public void PostponeInvalidation(string key, Action action)
Parameters
PreArrange(SKRect, float, float, float)
Returns false if should not render
public virtual bool PreArrange(SKRect destination, float widthRequest, float heightRequest, float scale)
Parameters
Returns
PrepareNode(DrawingContext, float, float)
public virtual VisualLayer? PrepareNode(DrawingContext context, float widthRequest, float heightRequest)
Parameters
contextDrawingContextwidthRequestfloatheightRequestfloat
Returns
PrintDebug(string)
public void PrintDebug(string indent = " ")
Parameters
indentstring
ProcessGestures(SkiaGesturesParameters, GestureEventProcessingInfo)
public virtual ISkiaGestureListener ProcessGestures(SkiaGesturesParameters args, GestureEventProcessingInfo apply)
Parameters
argsSkiaGesturesParametersapplyGestureEventProcessingInfo
Returns
ProcessOffscreenCacheRenderingAsync()
public Task ProcessOffscreenCacheRenderingAsync()
Returns
PropagateVisibilityChanged(bool)
protected virtual void PropagateVisibilityChanged(bool newvalue)
Parameters
newvaluebool
PushToOffscreenRendering(Action, CancellationToken)
public void PushToOffscreenRendering(Action action, CancellationToken cancel = default)
Parameters
actionActioncancelCancellationToken
RadiansToDegrees(double)
public static double RadiansToDegrees(double value)
Parameters
valuedouble
Returns
RadiansToDegrees(float)
public static float RadiansToDegrees(float value)
Parameters
valuefloat
Returns
RasterizeToCache(DrawingContext)
public void RasterizeToCache(DrawingContext ctx)
Parameters
ctxDrawingContext
RegisterAnimator(ISkiaAnimator)
public bool RegisterAnimator(ISkiaAnimator animator)
Parameters
animatorISkiaAnimator
Returns
RegisterAnimator(ISkiaAnimator, IAnimatorsManager)
public void RegisterAnimator(ISkiaAnimator animator, IAnimatorsManager top)
Parameters
animatorISkiaAnimatortopIAnimatorsManager
RegisterGestureListener(ISkiaGestureListener)
public void RegisterGestureListener(ISkiaGestureListener gestureListener)
Parameters
gestureListenerISkiaGestureListener
RegisterGestureListenersTree(SkiaControl)
public virtual void RegisterGestureListenersTree(SkiaControl control)
Parameters
controlSkiaControl
Remove(IView)
Removes the first occurrence of a specific object from the ICollection<T>.
public bool Remove(IView item)
Parameters
itemIViewThe object to remove from the ICollection<T>.
Returns
- bool
true if
itemwas successfully removed from the ICollection<T>; otherwise, false. This method also returns false ifitemis not found in the original ICollection<T>.
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
RemoveAt(int)
Removes the IList<T> item at the specified index.
public void RemoveAt(int index)
Parameters
indexintThe zero-based index of the item to remove.
Exceptions
- ArgumentOutOfRangeException
indexis not a valid index in the IList<T>.- NotSupportedException
The IList<T> is read-only.
RemoveSubView(SkiaControl)
Directly removes a view from the control, without any layouting. Use this instead of Views.Remove() to avoid memory leaks etc
public virtual void RemoveSubView(SkiaControl control)
Parameters
controlSkiaControl
Render(DrawingContext)
public virtual void Render(DrawingContext context)
Parameters
contextDrawingContext
RenderViewsList(DrawingContext, IEnumerable<SkiaControl>)
Use to render Absolute layout. Base method is not supporting templates, override it to implement your logic. Returns number of drawn children.
protected virtual int RenderViewsList(DrawingContext context, IEnumerable<SkiaControl> skiaControls)
Parameters
contextDrawingContextskiaControlsIEnumerable<SkiaControl>
Returns
Repaint()
Just make us repaint to apply new transforms etc
public virtual void Repaint()
ReportHotreloadChildAdded(SkiaControl)
public virtual void ReportHotreloadChildAdded(SkiaControl child)
Parameters
childSkiaControl
ReportHotreloadChildRemoved(SkiaControl)
public virtual void ReportHotreloadChildRemoved(SkiaControl control)
Parameters
controlSkiaControl
RescaleAspect(float, float, SKRect, TransformAspect)
public static (float X, float Y) RescaleAspect(float width, float height, SKRect dest, TransformAspect stretch)
Parameters
widthfloatheightfloatdestSKRectstretchTransformAspect
Returns
ResumePausedAnimators()
public virtual void ResumePausedAnimators()
ReturnSurface(SKSurface)
public void ReturnSurface(SKSurface surface)
Parameters
surfaceSKSurface
RotateToAsync(double, uint, Easing, CancellationTokenSource)
Rotates the drawn view from the current rotation to end, animator is reused if already running
public Task RotateToAsync(double end, uint length = 250, Easing easing = null, CancellationTokenSource cancel = null)
Parameters
enddoublelengthuinteasingEasingcancelCancellationTokenSource
Returns
RoundToPixels(SKRect)
Rounds SKRect coordinates to nearest pixel values
public static SKRect RoundToPixels(SKRect rect)
Parameters
rectSKRect
Returns
RoundToPixels(float, float, float, float)
Rounds SKRect coordinates to nearest pixel values
public static SKRect RoundToPixels(float left, float top, float right, float bottom)
Parameters
Returns
SafeAction(Action, long)
If attached to a SuperView and rendering is in progress will run before drawing it. Run now otherwise. if key is not null will replace existing if any to void running different action with same key in same frame.
public void SafeAction(Action action, long key = -1)
Parameters
ScaleToAsync(double, double, float, Easing, CancellationTokenSource)
Scales the drawn view from the current Scale to x,y, animator is reused if already running
public Task ScaleToAsync(double x, double y, float length = 250, Easing easing = null, CancellationTokenSource cancel = null)
Parameters
xdoubleydoublelengthfloateasingEasingcancelCancellationTokenSource
Returns
SendOnMeasured()
public virtual void SendOnMeasured()
SendTapped(object, SkiaGesturesParameters, GestureEventProcessingInfo, bool)
If Tapped handler was defined, activates it and return true of false it was defined.
protected bool SendTapped(object listener, SkiaGesturesParameters args, GestureEventProcessingInfo apply, bool useMainThread)
Parameters
listenerobjectargsSkiaGesturesParametersapplyGestureEventProcessingInfouseMainThreadbool
Returns
SendVisibilityChanged()
public void SendVisibilityChanged()
SetChildren(IEnumerable<SkiaControl>)
public virtual void SetChildren(IEnumerable<SkiaControl> views)
Parameters
viewsIEnumerable<SkiaControl>
SetChildrenAsParameters(params SkiaControl[])
Just a helper to pass children one by one comma separated instead of using a list
public void SetChildrenAsParameters(params SkiaControl[] children)
Parameters
childrenSkiaControl[]
SetDefaultContentSize(double, double)
protected virtual void SetDefaultContentSize(double width, double height)
Parameters
SetDefaultMinimumContentSize(double, double)
protected virtual void SetDefaultMinimumContentSize(double width, double height)
Parameters
SetHover(bool)
For internat custom logic, use IsHovered for usual use.
protected virtual void SetHover(bool state)
Parameters
statebool
SetInheritedBindingContext(object)
This is to be called by layouts to propagate their binding context to children. By overriding this method any child could deny a new context or use any other custom logic. To force new context for child parent would set child's BindingContext directly skipping the use of this method.
public virtual void SetInheritedBindingContext(object context)
Parameters
contextobject
SetMeasured(float, float, bool, bool, float)
Parameters in PIXELS. sets IsLayoutDirty = true;
protected virtual ScaledSize SetMeasured(float width, float height, bool widthCut, bool heightCut, float scale)
Parameters
Returns
SetMeasuredAdaptToContentSize(MeasuringConstraints, float)
public virtual ScaledSize SetMeasuredAdaptToContentSize(MeasuringConstraints constraints, float scale)
Parameters
constraintsMeasuringConstraintsscalefloat
Returns
SetMeasuredAsEmpty(float)
protected virtual ScaledSize SetMeasuredAsEmpty(float scale)
Parameters
scalefloat
Returns
SetParent(IDrawnBase)
public virtual void SetParent(IDrawnBase parent)
Parameters
parentIDrawnBase
SetPropertyValue(BindableProperty, object)
public virtual void SetPropertyValue(BindableProperty property, object value)
Parameters
propertyBindablePropertyvalueobject
SetRenderingTree(List<SkiaControlWithRect>)
public virtual void SetRenderingTree(List<SkiaControlWithRect> tree)
Parameters
treeList<SkiaControlWithRect>
SetSuperview(DrawnView)
Manually sets Superview to this control and its children
public void SetSuperview(DrawnView view)
Parameters
viewDrawnView
SetVisualTransform(VisualTransform)
Comes after all drawn, actually used by SkiaMauiElement only
public virtual void SetVisualTransform(VisualTransform transform)
Parameters
transformVisualTransform
SetupBackgroundPaint(SKPaint, SKRect)
Applies Background and BackgroundColor properties to paint inside destination. Returns false if there is nothing to paint painted.
protected virtual bool SetupBackgroundPaint(SKPaint paint, SKRect destination)
Parameters
Returns
SetupGradient(SKPaint, SkiaGradient, SKRect)
Creates Shader for gradient and sets it to passed SKPaint along with BlendMode
public bool SetupGradient(SKPaint paint, SkiaGradient gradient, SKRect destination)
Parameters
paintSKPaintgradientSkiaGradientdestinationSKRect
Returns
SetupGradient(SKPaint, SkiaGradient, SKRect, ref SKShader, ref int, ref SKRect)
Caching overload: rebuilds the shader only when the gradient version or destination rect has changed since the last call. The caller owns the cached shader and must dispose it in their OnDisposing(). Passing gradient=null disposes and clears the cache.
public bool SetupGradient(SKPaint paint, SkiaGradient gradient, SKRect destination, ref SKShader cachedShader, ref int cachedVersion, ref SKRect cachedRect)
Parameters
paintSKPaintgradientSkiaGradientdestinationSKRectcachedShaderSKShadercachedVersionintcachedRectSKRect
Returns
SetupShadow(SKPaint, SkiaShadow, float)
Creates and sets an ImageFilter for SKPaint
public bool SetupShadow(SKPaint paint, SkiaShadow shadow, float scale)
Parameters
paintSKPaintshadowSkiaShadowscalefloat
Returns
SmartMax(float, float)
protected static float SmartMax(float a, float b)
Parameters
Returns
SmartMin(float, float)
protected static float SmartMin(float a, float b)
Parameters
Returns
SnapPointToPixel(SKPoint, double)
public static SKPoint SnapPointToPixel(SKPoint point, double scale)
Parameters
Returns
SnapRectCenter(SKRect, float)
public static SKPoint SnapRectCenter(SKRect rect, float scale)
Parameters
Returns
SnapRectToPixels(SKRect, float)
public static SKRect SnapRectToPixels(SKRect rect, float scale)
Parameters
Returns
SnapSizeToPixel(SKSize, double)
public static SKPoint SnapSizeToPixel(SKSize point, double scale)
Parameters
Returns
SnapToPixel(double, double)
public static float SnapToPixel(double point, double scale)
Parameters
Returns
StopAnimations()
public virtual void StopAnimations()
StreamFromString(string)
public static MemoryStream StreamFromString(string value)
Parameters
valuestring
Returns
SuperViewChanged()
public virtual void SuperViewChanged()
ThrowIfDisposed()
Throws an ObjectDisposedException if this object has been disposed.
protected void ThrowIfDisposed()
TrackChildAsDirty(SkiaControl)
public virtual void TrackChildAsDirty(SkiaControl child)
Parameters
childSkiaControl
TransformPointToLocalSpace(SKPoint)
public SKPoint TransformPointToLocalSpace(SKPoint pointInParentSpace)
Parameters
pointInParentSpaceSKPoint
Returns
TranslateInputCoords(SKPoint, bool)
Use this to consume gestures in your control only, do not use result for passing gestures below
public virtual SKPoint TranslateInputCoords(SKPoint childOffset, bool accountForCache = true)
Parameters
Returns
TranslateInputDirectOffsetToPoints(PointF, SKPoint)
public virtual SKPoint TranslateInputDirectOffsetToPoints(PointF location, SKPoint childOffsetDirect)
Parameters
Returns
TranslateInputOffsetToPixels(PointF, SKPoint)
public virtual SKPoint TranslateInputOffsetToPixels(PointF location, SKPoint childOffset)
Parameters
Returns
TranslateToAsync(double, double, float, Easing, CancellationTokenSource)
Translates the drawn view from the current position to x,y, animator is reused if already running
public Task TranslateToAsync(double x, double y, float length = 250, Easing easing = null, CancellationTokenSource cancel = null)
Parameters
xdoubleydoublelengthfloateasingEasingcancelCancellationTokenSource
Returns
UnlockUpdate()
public void UnlockUpdate()
UnregisterAllAnimatorsByType(Type)
public IEnumerable<ISkiaAnimator> UnregisterAllAnimatorsByType(Type type)
Parameters
typeType
Returns
UnregisterAnimator(Guid)
public void UnregisterAnimator(Guid uid)
Parameters
uidGuid
UnregisterGestureListener(ISkiaGestureListener)
public void UnregisterGestureListener(ISkiaGestureListener gestureListener)
Parameters
gestureListenerISkiaGestureListener
UnregisterGestureListenersTree(SkiaControl)
public virtual void UnregisterGestureListenersTree(SkiaControl control)
Parameters
controlSkiaControl
Update()
Main method to invalidate cache and invoke rendering
public virtual void Update()
UpdateByChild(SkiaControl)
To track dirty area when Updating parent
public virtual void UpdateByChild(SkiaControl child)
Parameters
childSkiaControl
UpdateInternal()
protected virtual void UpdateInternal()
UpdatePlatformShadow()
protected void UpdatePlatformShadow()
UpdateSizeRequest()
Calculates SizeRequest, Margins etc
public virtual void UpdateSizeRequest()
UseRenderingObject(DrawingContext, SKRect)
protected virtual bool UseRenderingObject(DrawingContext context, SKRect recordArea)
Parameters
contextDrawingContextrecordAreaSKRect
Returns
Events
ApplyingBindingContext
public event EventHandler ApplyingBindingContext
Event Type
ChildTapped
WIll be called if a child implements ISkiaGestureListener and was Tapped. If this is set then the Tapped gesture will be consumed by this control after passing it to child.
public event EventHandler<ControlTappedEventArgs> ChildTapped
Event Type
ConsumeGestures
Gestures event handler for fast access. To mark a gesture as consumed set e.Consumed to true inside a synchronous (!) event handler.
Can also use code-behind ProcessGestures override for more control.
public event EventHandler<SkiaGesturesInfo> ConsumeGestures
Event Type
CreatedCache
public event EventHandler<CachedObject> CreatedCache
Event Type
Destroyed
Lifecycle event
public event EventHandler Destroyed
Event Type
Disposing
public event EventHandler Disposing
Event Type
Initialized
Lifecycle event
public event EventHandler Initialized
Event Type
LayoutIsReady
public event EventHandler LayoutIsReady
Event Type
Measured
UNITS
public event EventHandler<ScaledSize> Measured
Event Type
ParentChanged
public event EventHandler<IDrawnBase> ParentChanged
Event Type
ParentVisibilityChanged
public event EventHandler<bool> ParentVisibilityChanged
Event Type
Rendered
public event EventHandler Rendered
Event Type
Tapped
Fast usage event handler to handle taps. For more control over gestures use AddGestures or code-behind ProcessGestures override. If this is set then the Tapped gesture will be consumed by this control without alternatives.
public event EventHandler<ControlTappedEventArgs> Tapped
Event Type
Updated
Triggered by Update method
public event EventHandler Updated
Event Type
VisibilityChanged
public event EventHandler<bool> VisibilityChanged
Event Type
WasFirstTimeDrawn
public event EventHandler WasFirstTimeDrawn