/// <inheritdoc/> public override void Fill(object dc, double x, double y, double width, double height, ArgbColor color) { var _dc = dc as DrawingContext; var brush = CreateBrush(color); var rect = new Rect(x, y, width, height); DrawRectangleInternal(_dc, 0.5, brush, null, false, true, ref rect); }
private static Color ToColor(ArgbColor color) => Color.FromArgb(color.A, color.R, color.G, color.B);
/// <inheritdoc/> public override void Fill(object dc, double x, double y, double width, double height, ArgbColor color) { var canvas = dc as SKCanvas; var rect = SKRect.Create((float)x, (float)y, (float)width, (float)height); using (var paint = ToSKPaintBrush(color)) { canvas.DrawRect(rect, paint); } }
private SKColor ToSKColor(ArgbColor color) => new SKColor(color.R, color.G, color.B, color.A);
private SKPaint ToSKPaintBrush(ArgbColor color) { var paint = new SKPaint(); paint.IsAntialias = _isAntialias; paint.IsStroke = false; paint.LcdRenderText = true; paint.SubpixelText = true; paint.Color = ToSKColor(color); return paint; }
private void DrawBackgroundInternal(SKCanvas canvas, ArgbColor color, Rect2 rect) { using (SKPaint brush = ToSKPaintBrush(color)) { SKRect srect = SKRect.Create( _scaleToPage(rect.X), _scaleToPage(rect.Y), _scaleToPage(rect.Width), _scaleToPage(rect.Height)); canvas.DrawRect(srect, brush); } }
/// <inheritdoc/> public override void Fill(object dc, double x, double y, double width, double height, ArgbColor color) { // TODO: Implement Fill. }
private SolidBrush ToSolidBrush(ArgbColor color) => new SolidBrush(ToColor(color));
private AM.IBrush ToBrush(ArgbColor color) { return new AM.SolidColorBrush(ToColor(color)); }
/// <inheritdoc/> public override void Fill(object dc, double x, double y, double width, double height, ArgbColor color) { var _dc = dc as AM.DrawingContext; var brush = ToBrush(color); var rect = new A.Rect(x, y, width, height); _dc.FillRectangle(brush, rect); }
/// <summary> /// Converts a color to string. /// </summary> /// <param name="c">The color instance.</param> /// <returns>The color string.</returns> public static string ToHtml(ArgbColor c) { return(string.Concat('#', c.A.ToString("X2"), c.R.ToString("X2"), c.G.ToString("X2"), c.B.ToString("X2"))); }
/// <summary> /// Fills rectangle with specified color using drawing context. /// </summary> /// <param name="dc">The native drawing context.</param> /// <param name="x">The X coordinate of rectangle origin point.</param> /// <param name="y">The Y coordinate of rectangle origin point.</param> /// <param name="width">The width of rectangle.</param> /// <param name="height">The height of rectangle.</param> /// <param name="color">The fill color.</param> public abstract void Fill(object dc, double x, double y, double width, double height, ArgbColor color);
public void Inherits_From_ObservableObject() { var target = new ArgbColor(); Assert.True(target is ObservableObject); }
private static Brush CreateBrush(ArgbColor color) { var brush = new SolidColorBrush(ToColor(color)); brush.Freeze(); return brush; }
/// <inheritdoc/> public override void Fill(object dc, double x, double y, double width, double height, ArgbColor color) { var _gfx = dc as XGraphics; _gfx.DrawRectangle( ToXSolidBrush(color), _scaleToPage(x), _scaleToPage(y), _scaleToPage(width), _scaleToPage(height)); }
/// <summary> /// Converts a color to string. /// </summary> /// <param name="c">The color instance.</param> /// <returns>The color string.</returns> public static string ToHtml(ArgbColor c) { return string.Concat('#', c.A.ToString("X2"), c.R.ToString("X2"), c.G.ToString("X2"), c.B.ToString("X2")); }
/// <inheritdoc/> public override void Fill(object dc, double x, double y, double width, double height, ArgbColor color) { var _gfx = dc as Graphics; Brush brush = ToSolidBrush(color); _gfx.FillRectangle( brush, (float)x, (float)y, (float)width, (float)height); brush.Dispose(); }