예제 #1
0
 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();
 }
예제 #2
0
        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);
        }
예제 #3
0
 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;
 }
예제 #4
0
 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;
 }
예제 #5
0
 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;
 }
예제 #6
0
 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();
 }
예제 #7
0
 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);
             }
         }
     }
 }
예제 #8
0
 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;
            }
        }
예제 #10
0
 public Rectangle(int x, int y, int width, int height, CanvasColor borderColor) : this(x, y, width, height, borderColor, null)
 {
 }
예제 #11
0
 public bool DrawGlyph(Canvas canvas, int x, int y, CanvasColor color, int unicode)
 {
     return(DrawGlyph(canvas, x, y, color, null, unicode));
 }