/// <summary> /// Performs a rendering pass on the specified <see cref="SkiaFrameworkElement"/> and its descendants. /// </summary> /// <param name="element">The element.</param> /// <param name="mode">The mode.</param> protected void RenderSingle(SkiaFrameworkElement element, BindingPropertyMode mode) { SkiaFrameworkElement toRender = element.Parent != null ? element.Parent : element; var bounds = toRender.Bounds; if (mode == BindingPropertyMode.AffectsLayout) { toRender.InvalidateBounds(); if (toRender.Bounds.Contains(bounds)) { bounds = toRender.Bounds; } else { bounds.Width += 1; bounds.Height += 1; } } if (bounds.Left < Source.Width && bounds.Top < Source.Height) { Source.Lock(); T context = CreateDrawingContext(); context.BeginDrawing(); context.ClipRect(bounds, new CornerRadius()); context.Clear(Colors.Transparent); SkiaTree.Root.Invalidate(context, bounds, 1); context.EndDrawing(); if (bounds.Right > Source.Width) { bounds.Width = Source.Width - bounds.Left; } if (bounds.Bottom > Source.Height) { bounds.Height = Source.Height - bounds.Top; } OnRenderCompleted(Source.BackBuffer, (int)Source.Width, (int)Source.Height, (int)Source.Width * 4); Source.AddDirtyRect(new Int32Rect((int)Math.Max(bounds.Left, 0), (int)Math.Max(bounds.Top, 0), (int)bounds.Width, (int)bounds.Height)); Source.Unlock(); } }
/// <summary> /// Initializes a new instance of the <see cref="BindingProperty"/> class. /// </summary> /// <param name="dp">The dependency property.</param> /// <param name="mode">The mode.</param> public BindingProperty(DependencyProperty dp, BindingPropertyMode mode) : this() { DependencyProperty = dp; Mode = mode; }