void DrawBackground(ACanvas canvas, int width, int height, float cornerRadius, bool pressed) { using (var paint = new Paint { AntiAlias = true }) using (var path = new APath()) using (APath.Direction direction = APath.Direction.Cw) using (Paint.Style style = Paint.Style.Fill) using (var rect = new RectF(0, 0, width, height)) { float rx = _convertToPixels(cornerRadius); float ry = _convertToPixels(cornerRadius); path.AddRoundRect(rect, rx, ry, direction); paint.SetStyle(style); if (!Brush.IsNullOrEmpty(_frame.Background)) { Brush background = _frame.Background; paint.UpdateBackground(background, height, width); } else { global::Android.Graphics.Color color = _frame.BackgroundColor.ToAndroid(); paint.Color = color; } canvas.DrawPath(path, paint); } }
void DrawOutline(ACanvas canvas, int width, int height, float cornerRadius) { using (var paint = new Paint { AntiAlias = true }) using (var path = new APath()) using (APath.Direction direction = APath.Direction.Cw) using (Paint.Style style = Paint.Style.Stroke) using (var rect = new RectF(0, 0, width, height)) { float rx = _convertToPixels(cornerRadius); float ry = _convertToPixels(cornerRadius); path.AddRoundRect(rect, rx, ry, direction); paint.StrokeWidth = 1; paint.SetStyle(style); paint.Color = _frame.BorderColor.ToAndroid(); canvas.DrawPath(path, paint); } }