public SKPaint CreateTextPaint(SeriesValue seriesValue, SKColor color) { var textPaint = new SKPaint { Color = color, TextSize = chart.TextSize }; if (!seriesValue.Focused && chart.HasShapeFocused) { SKBlurStyle blurStyle = SKBlurStyle.Normal; textPaint.MaskFilter = SKMaskFilter.CreateBlur(blurStyle, chart.Sigma); } return(textPaint); }
public SKPaint CreateSlicePaint(SeriesValue seriesValue) { var paint = new SKPaint { StrokeWidth = 30, Style = SKPaintStyle.Fill, Color = seriesValue.HasColour() ? seriesValue.Colour : palette.GetAvaibleColour(), }; if (!seriesValue.Focused && chart.HasShapeFocused) { SKBlurStyle blurStyle = SKBlurStyle.Normal; paint.MaskFilter = SKMaskFilter.CreateBlur(blurStyle, chart.Sigma); } return(paint); }
public SKPaint CreateDotPaint(SeriesValue value) { var paint = new SKPaint { Color = !value.Colour.Equals(SKColor.Empty) ? value.Colour : palette.GetAvaibleColour(), StrokeWidth = 20, TextSize = chart.TextSize, TextAlign = SKTextAlign.Center }; if (!value.Focused && chart.HasShapeFocused) { SKBlurStyle blurStyle = SKBlurStyle.Normal; paint.MaskFilter = SKMaskFilter.CreateBlur(blurStyle, chart.Sigma); } return(paint); }
void OnCanvasViewPaintSurface(object sender, SKPaintSurfaceEventArgs args) { SKImageInfo info = args.Info; SKSurface surface = args.Surface; SKCanvas canvas = surface.Canvas; canvas.Clear(SKColors.Pink); // Get values from XAML controls SKBlurStyle blurStyle = (SKBlurStyle)(blurStylePicker.SelectedIndex == -1 ? 0 : blurStylePicker.SelectedItem); float sigma = (float)sigmaSlider.Value; using (SKPaint paint = new SKPaint()) { // Set SKPaint properties paint.TextSize = (info.Width - 100) / (TEXT.Length / 2); paint.MaskFilter = SKMaskFilter.CreateBlur(blurStyle, sigma); // Get text bounds and calculate display rectangle SKRect textBounds = new SKRect(); paint.MeasureText(TEXT, ref textBounds); SKRect textRect = new SKRect(0, 0, info.Width, textBounds.Height + 50); // Center the text in the display rectangle float xText = textRect.Width / 2 - textBounds.MidX; float yText = textRect.Height / 2 - textBounds.MidY; canvas.DrawText(TEXT, xText, yText, paint); // Calculate rectangle for bitmap SKRect bitmapRect = new SKRect(0, textRect.Bottom, info.Width, info.Height); bitmapRect.Inflate(-50, -50); canvas.DrawBitmap(bitmap, bitmapRect, BitmapStretch.Uniform, paint: paint); } }
public static void DrawBlurText(string TEXT, SKBitmap info, SKCanvas canvas, SKBlurStyle blurStyle, float sigma) { canvas.Clear(SKColors.Pink); using (SKPaint paint = new SKPaint()) { // Set SKPaint properties paint.TextSize = (info.Width - 100) / (TEXT.Length / 2); paint.MaskFilter = SKMaskFilter.CreateBlur(blurStyle, sigma); // Get text bounds and calculate display rectangle SKRect textBounds = new SKRect(); paint.MeasureText(TEXT, ref textBounds); SKRect textRect = new SKRect(0, 0, info.Width, textBounds.Height + 50); // Center the text in the display rectangle float xText = textRect.Width / 2 - textBounds.MidX; float yText = textRect.Height / 2 - textBounds.MidY; canvas.DrawText(TEXT, xText, yText, paint); } }
public static SKMaskFilter CreateBlur(SKBlurStyle blurStyle, float sigma, SKRect occluder, bool respectCTM) { return(GetObject <SKMaskFilter> (SkiaApi.sk_maskfilter_new_blur_with_flags(blurStyle, sigma, ref occluder, respectCTM))); }
public static SKMaskFilter CreateBlur(SKBlurStyle blurStyle, float sigma, SKRect occluder, SKBlurMaskFilterFlags flags) { return(CreateBlur(blurStyle, sigma, occluder, true)); }
public static SKMaskFilter CreateBlur(SKBlurStyle blurStyle, float sigma) { return(GetObject <SKMaskFilter> (SkiaApi.sk_maskfilter_new_blur(blurStyle, sigma))); }
public extern static sk_maskfilter_t sk_maskfilter_new_blur(SKBlurStyle style, float sigma);
public static SKMaskFilter CreateBlur(SKBlurStyle blurStyle, float sigma, SKBlurMaskFilterFlags flags) { return(CreateBlur(blurStyle, sigma, SKRect.Empty, flags)); }
public static SKMaskFilter CreateBlur (SKBlurStyle blurStyle, float sigma) { return GetObject<SKMaskFilter> (SkiaApi.sk_maskfilter_new_blur (blurStyle, sigma)); }
public static SKMaskFilter CreateBlur(SKBlurStyle blurStyle, float sigma, SKRect occluder, bool respectCTM) { return(CreateBlur(blurStyle, sigma, respectCTM)); }