private void MovePointerDuringReposition(int i, int j) { EpPointer.SetValue(Canvas.LeftProperty, (double)(i - 3)); EpPointer.SetValue(Canvas.TopProperty, (double)(j - 3)); EpPointer.InvalidateVisual(); CanvasColor.InvalidateVisual(); }
public bool DrawGlyph(Canvas canvas, int x, int y, CanvasColor color, CanvasColor background, int unicode) { var glyph = FindGlyph(unicode); if (glyph == null) { glyph = FindGlyph(UnicodeReplacementCodepoint); } if (glyph == null) { return(false); } for (int _y = 0; _y < glyph.Height; _y++) { var bitmap = glyph.Bitmap[_y]; var bitString = Convert.ToString(bitmap, 2); int[] bits = bitString.PadLeft(8, '0') // Add 0's from left .Select(c => int.Parse(c.ToString())) // convert each char to int .ToArray(); for (int _x = 0; _x < glyph.DeviceWidth; _x++) { if (bits[_x] == 1) { canvas.SetPixel(x + _x, y + _y, color); } if (bits[_x] == 0 && background != null) { canvas.SetPixel(x + _x, y + _y, background); } } } return(true); }
public Rectangle(int x, int y, int width, int height, CanvasColor borderColor, CanvasColor fillColor) : base() { X = x; Y = y; Width = width; Height = height; this.BorderColor = borderColor; this.FillColor = fillColor; }
public Label(string text, BDFFont font, CanvasColor color) : base() { if (font == null) { throw new ArgumentException("Font is not providet"); } Font = font; Text = text; Color = color; }
public Ellipse(int x, int y, double width, double height, CanvasColor borderColor) : base() { X = x; Y = y; this.rx = width / 2; this.ry = height / 2; Width = (int)width; Height = (int)height; this.BorderColor = borderColor; }
public override void Update() { for (var x = 0; x < image.Width; x++) { for (var y = 0; y < image.Height; y++) { var rawColor = image[x, y]; var color = new CanvasColor((int)rawColor.R, (int)rawColor.G, (int)rawColor.B); if (rawColor.A != 0) { SetPixel(x, y, color); } } } base.Update(); }
public override void Update() { Clear(); for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { CanvasColor drawColor = FillColor; if (x == 0 || y == 0 || x == 0 + Width - 1 || y == 0 + Height - 1) { drawColor = BorderColor; } if (drawColor != null) { SetPixel(x, y, drawColor); } } } }
private void MovePointer() { EpPointer.SetValue(Canvas.LeftProperty, (double)(Mouse.GetPosition(CanvasColor).X - 5)); EpPointer.SetValue(Canvas.TopProperty, (double)(Mouse.GetPosition(CanvasColor).Y - 5)); CanvasColor.InvalidateVisual(); }
void ReleaseDesignerOutlets() { if (DeleteButton != null) { DeleteButton.Dispose(); DeleteButton = null; } if (CanvasColor != null) { CanvasColor.Dispose(); CanvasColor = null; } if (CanvasColorCheckbox != null) { CanvasColorCheckbox.Dispose(); CanvasColorCheckbox = null; } if (OpacitySlider != null) { OpacitySlider.Dispose(); OpacitySlider = null; } if (OpacityValue != null) { OpacityValue.Dispose(); OpacityValue = null; } if (SketchHeight != null) { SketchHeight.Dispose(); SketchHeight = null; } if (SketchName != null) { SketchName.Dispose(); SketchName = null; } if (SketchWidth != null) { SketchWidth.Dispose(); SketchWidth = null; } if (ToBitmapCheckbox != null) { ToBitmapCheckbox.Dispose(); ToBitmapCheckbox = null; } if (ToCanvasCheckbox != null) { ToCanvasCheckbox.Dispose(); ToCanvasCheckbox = null; } if (ToDataCheckbox != null) { ToDataCheckbox.Dispose(); ToDataCheckbox = null; } if (UseSkiaSharpViewsCheckbox != null) { UseSkiaSharpViewsCheckbox.Dispose(); UseSkiaSharpViewsCheckbox = null; } }
public Rectangle(int x, int y, int width, int height, CanvasColor borderColor) : this(x, y, width, height, borderColor, null) { }
public bool DrawGlyph(Canvas canvas, int x, int y, CanvasColor color, int unicode) { return(DrawGlyph(canvas, x, y, color, null, unicode)); }