partial void ApplyNativeClip(Rect rect) { if (rect.IsEmpty) { if (_previousClip != rect) { _previousClip = rect; ViewCompat.SetClipBounds(this, null); } return; } _previousClip = rect; var physicalRect = rect.LogicalToPhysicalPixels(); if (FrameRoundingAdjustment is { } fra) { physicalRect.Width += fra.Width; physicalRect.Height += fra.Height; } ViewCompat.SetClipBounds(this, physicalRect); SetClipChildren(NeedsClipToSlot); }
partial void ApplyNativeClip(Rect rect) { // Non-UIElements typically expect to be clipped, and display incorrectly otherwise // This won't work when UIElements and non-UIElements are mixed in the same Panel, // but it should cover most cases in practice, and anyway should be superceded when // IFrameworkElement will be removed. SetClipChildren(FeatureConfiguration.UIElement.AlwaysClipNativeChildren ? AreChildrenNativeViewsOnly : false); if (rect.IsEmpty) { ViewCompat.SetClipBounds(this, null); return; } var physicalRect = rect.LogicalToPhysicalPixels(); if (FrameRoundingAdjustment is { } fra) { physicalRect.Width += fra.Width; physicalRect.Height += fra.Height; } ViewCompat.SetClipBounds(this, physicalRect); SetClipChildren(NeedsClipToSlot); }
private Android.Graphics.Path GetPath(Rect availableSize) { var output = new Android.Graphics.Path(); //Android's path rendering logic rounds values down to the nearest int, make sure we round up here instead using the ViewHelper scaling logic var physicalRenderingArea = availableSize.LogicalToPhysicalPixels(); if (FrameRoundingAdjustment is { } fra) { physicalRenderingArea.Height += fra.Height; physicalRenderingArea.Width += fra.Width; } var logicalRenderingArea = physicalRenderingArea.PhysicalToLogicalPixels(); logicalRenderingArea.X = availableSize.X; logicalRenderingArea.Y = availableSize.Y; output.AddOval( logicalRenderingArea.ToRectF(), Android.Graphics.Path.Direction.Cw); return(output); }