public void SetBorderBrush(RadialGradientPaint radialGradientPaint) { _strokeColor = null; _stroke = radialGradientPaint; SetNeedsDisplay(); }
public void SetBackground(Paint?paint) { if (paint is SolidPaint solidPaint) { SetBackground(solidPaint); } else if (paint is LinearGradientPaint linearGradientPaint) { SetBackground(linearGradientPaint); } else if (paint is RadialGradientPaint radialGradientPaint) { SetBackground(radialGradientPaint); } else if (paint is ImagePaint imagePaint) { SetBackground(imagePaint); } else if (paint is PatternPaint patternPaint) { SetBackground(patternPaint); } else { SetDefaultBackgroundColor(); } }
public DrawTextBlobCanvasCommand(TextBlob textBlob, float x, float y, Paint paint) { TextBlob = textBlob; X = x; Y = y; Paint = paint; }
public void SetBorderBrush(LinearGradientPaint linearGradientPaint) { _strokeColor = null; _stroke = linearGradientPaint; SetNeedsDisplay(); }
public void SetBackground(RadialGradientPaint radialGradientPaint) { _backgroundColor = null; _background = radialGradientPaint; SetNeedsDisplay(); }
public void SetBorderBrush(Paint?paint) { if (paint is SolidPaint solidPaint) { SetBorderBrush(solidPaint); } if (paint is LinearGradientPaint linearGradientPaint) { SetBorderBrush(linearGradientPaint); } if (paint is RadialGradientPaint radialGradientPaint) { SetBorderBrush(radialGradientPaint); } if (paint is ImagePaint imagePaint) { SetBorderBrush(imagePaint); } if (paint is PatternPaint patternPaint) { SetBorderBrush(patternPaint); } }
public void SetBackground(LinearGradientPaint linearGradientPaint) { _backgroundColor = null; _background = linearGradientPaint; SetNeedsDisplay(); }
public DrawTextCanvasCommand(string text, float x, float y, Paint paint) { Text = text; X = x; Y = y; Paint = paint; }
public DrawImageCanvasCommand(Image image, Rect source, Rect dest, Paint?paint = null) { Image = image; Source = source; Dest = dest; Paint = paint; }
public DrawTextOnPathCanvasCommand(string text, Path path, float hOffset, float vOffset, Paint paint) { Text = text; Path = path; HOffset = hOffset; VOffset = vOffset; Paint = paint; }
void UpdateDrawableCanvas(Paint?paint) { if (_drawableCanvas.IsValueCreated || paint is not null) { ((MauiDrawable)_drawableCanvas.Value.Drawable).Background = paint; _drawableCanvas.Value.Invalidate(); } }
public static void UpdateStroke(this Path borderPath, Paint?borderBrush) { if (borderPath == null) { return; } borderPath.Stroke = borderBrush?.ToPlatform(); }
public void UpdateBackground(Paint?background) { if (_borderPath == null) { return; } _borderPath.UpdateBackground(background); }
public static void UpdateBackground(this Path borderPath, Paint?background) { if (borderPath == null) { return; } borderPath.Fill = background?.ToPlatform(); }
public void UpdateBackground(Paint?background) { if (_borderPath == null) { return; } _borderPath.Fill = background?.ToPlatform(); }
public void SetBorderBrush(SolidPaint solidPaint) { _strokeColor = solidPaint.Color == null ? UIColor.Clear : solidPaint.Color.ToNative(); _stroke = null; SetNeedsDisplay(); }
public void SetBackground(SolidPaint solidPaint) { if (solidPaint.Color == null) SetDefaultBackgroundColor(); else _backgroundColor = solidPaint.Color.ToPlatform(); _background = null; SetNeedsDisplay(); }
public void SetBackground(SolidPaint solidPaint) { if (solidPaint.Color == null) { SetDefaultBackgroundColor(); } else { _backgroundColor = solidPaint.Color.ToNative(); } _background = null; SetNeedsDisplay(); }
public static void UpdateBackground(this UIView platformView, Paint?paint, IButtonStroke?stroke = null) { // Remove previous background gradient layer if any platformView.RemoveBackgroundLayer(); if (paint.IsNullOrEmpty()) { if (platformView is LayoutView) { platformView.BackgroundColor = null; } else { return; } } if (paint is SolidPaint solidPaint) { Color backgroundColor = solidPaint.Color; if (backgroundColor == null) { platformView.BackgroundColor = ColorExtensions.BackgroundColor; } else { platformView.BackgroundColor = backgroundColor.ToPlatform(); } return; } else if (paint is GradientPaint gradientPaint) { var backgroundLayer = gradientPaint?.ToCALayer(platformView.Bounds); if (backgroundLayer != null) { backgroundLayer.Name = BackgroundLayerName; platformView.BackgroundColor = UIColor.Clear; backgroundLayer.UpdateLayerBorder(stroke); platformView.InsertBackgroundLayer(backgroundLayer, 0); } } }
public static Color?ToColor(this Paint?paint) { if (paint is SolidPaint solidPaint) { return(solidPaint.Color); } if (paint is GradientPaint gradientPaint) { return(gradientPaint.GradientStops?[0]?.Color); } if (paint is ImagePaint) { return(null); } if (paint is PatternPaint) { return(null); } return(null); }
public static bool IsNullOrEmpty(this Paint?paint) { if (paint is SolidPaint solidPaint) { return(solidPaint == null || solidPaint.Color == null); } if (paint is GradientPaint gradientPaint) { return(gradientPaint == null || gradientPaint.GradientStops.Length == 0); } if (paint is ImagePaint imagePaint) { return(imagePaint == null || imagePaint.Image == null); } if (paint is PatternPaint patternPaint) { return(patternPaint == null || patternPaint.Pattern == null); } return(paint == null); }
public static void UpdateBackground(this Panel nativeControl, Paint?paint, UI.Xaml.Media.Brush?defaultBrush = null) => nativeControl.UpdateProperty(Panel.BackgroundProperty, paint.IsNullOrEmpty() ? defaultBrush : paint?.ToNative());
public void DrawImage(Image image, Rect source, Rect dest, Paint?paint = null) { Commands?.Add(new DrawImageCanvasCommand(image, source, dest, paint)); }
public static void UpdateBackground(this Border platformControl, Paint?paint, UI.Xaml.Media.Brush?defaultBrush = null) => platformControl.UpdateProperty(Border.BackgroundProperty, paint.IsNullOrEmpty() ? defaultBrush : paint?.ToPlatform());
public static void UpdateTopNavigationViewItemBackgroundSelectedColor(this MauiNavigationView navigationView, Paint?paint) { var brush = paint?.ToPlatform(); if (navigationView.TopNavArea != null) { if (brush is null) { navigationView.TopNavArea.Resources.Remove("TopNavigationViewItemBackgroundSelected"); navigationView.TopNavArea.Resources.Remove("TopNavigationViewItemBackgroundSelectedPointerOver"); navigationView.TopNavArea.Resources.Remove("TopNavigationViewItemBackgroundSelectedPressed"); } else { navigationView.TopNavArea.Resources["TopNavigationViewItemBackgroundSelected"] = brush; navigationView.TopNavArea.Resources["TopNavigationViewItemBackgroundSelectedPointerOver"] = brush; navigationView.TopNavArea.Resources["TopNavigationViewItemBackgroundSelectedPressed"] = brush; } } if (navigationView.MenuItemsSource is IList <NavigationViewItemViewModel> items) { foreach (var item in items) { item.SelectedBackground = brush; } } }
public static void UpdateTopNavAreaBackground(this MauiNavigationView navigationView, Paint?paint) { // Background property is set via {ThemeResource NavigationViewTopPaneBackground} in the Control Template // AFAICT you can't modify properties set by ThemeResource at runtime so we have to just update this value directly if (paint != null) { navigationView.TopNavArea?.UpdateBackground(paint, null); } else if (Application.Current.Resources.TryGetValue("NavigationViewTopPaneBackground", out object value) && value is WBrush brush) { navigationView.TopNavArea?.UpdateBackground(null, brush); } }
public static void UpdatePaneBackground(this MauiNavigationView navigationView, Paint?paint) { var rootSplitView = navigationView.RootSplitView; var brush = paint?.ToPlatform(); if (brush == null) { object?color = null; if (navigationView.IsPaneOpen) { color = navigationView.Resources["NavigationViewExpandedPaneBackground"]; } else { color = navigationView.Resources["NavigationViewDefaultPaneBackground"]; } if (rootSplitView != null) { if (color is WBrush colorBrush) { rootSplitView.PaneBackground = colorBrush; } else if (color is global::Windows.UI.Color uiColor) { rootSplitView.PaneBackground = new WSolidColorBrush(uiColor); } } } else { if (rootSplitView != null) { rootSplitView.PaneBackground = brush; } } }
// TODO: NET7 should this be public? internal static void UpdateBackground(this ShapeableImageView platformButton, IImageButton imageButton) { Paint?paint = imageButton.Background; platformButton.Background = paint?.ToDrawable(platformButton.Context); }
public SaveLayerCanvasCommand(int count, Paint paint) { Count = count; Paint = paint; }
public DrawPathCanvasCommand(Path path, Paint paint) { Path = path; Paint = paint; }