public override void Invalidate(Rectangle rect)
        {
            var charBufSize = new Kernel32.Coord((short)Width, (short)Height);
            var characterPos = new Kernel32.Coord((short)rect.X, (short)rect.Y);
            var writeArea = new Kernel32.SmallRect()
                                   {
                                       Left = (short)rect.X,
                                       Top = (short)rect.Y,
                                       Right = (short)(rect.Width + rect.X),
                                       Bottom = (short)(rect.Height + rect.Y)
                                   };

            for (var y = rect.Y; y < rect.Height + rect.Y; y++)
            for (var x = rect.X; x < rect.Width + rect.X; x++)
            {
                var i = (y*Width + x);

                    m_CharBuffer[i].Char.AsciiChar  = (byte)m_buffer[i].Character;
                    m_CharBuffer[i].Attributes      = (short)((int)m_buffer[i].Color.ForgroundColor |
                                                             ((int)m_buffer[i].Color.BackgroundColor << 4));
            }

            Kernel32.WriteConsoleOutput(
                m_consoleBufferWriteHandle,
                m_CharBuffer,
                charBufSize,
                characterPos,
                ref writeArea);
        }
Exemple #2
0
        public void Invalidate()
        {
            var g = AsciiGraphics.FromManagedConsole();
            var cRect = new Rectangle(0, 0, Size.Width, Size.Height);

            InvokePaint(this, new AsciiPaintEventArgs(g, cRect));
        }
Exemple #3
0
 public override void Invalidate(Rectangle rect)
 {
     for (var y = rect.Y; y < rect.Height + rect.Y; y++)
     for (var x = rect.X; x < rect.Width + rect.X; x++)
     {
         m_image[(y* rect.Width + x)] = m_buffer[(y* rect.Width + x)];
     }
 }
 public override void Invalidate(Rectangle rect)
 {
     for (var y = rect.Y; y < rect.Height + rect.Y; y++)
     for (var x = rect.X; x < rect.Width + rect.X; x++)
     {
         var cell = m_buffer[(y*rect.Width + x)];
         Console.BackgroundColor = cell.Color.BackgroundColor;
         Console.ForegroundColor = cell.Color.ForgroundColor;
         Console.SetCursorPosition((int)x, (int)y);
         Console.Write(cell.Character);
     }
 }
Exemple #5
0
 public static Rectangle Intersect(Rectangle a, Rectangle b)
 {
     var x = Math.Max(a.X, b.X);
     var num2 = Math.Min((a.X + a.Width), (b.X + b.Width));
     var y = Math.Max(a.Y, b.Y);
     var num4 = Math.Min((a.Y + a.Height),(b.Y + b.Height));
     if ((num2 >= x) && (num4 >= y))
     {
         return new Rectangle(x, y, num2 - x, num4 - y);
     }
     return Empty;
 }
Exemple #6
0
 public AsciiPaintEventArgs(AsciiGraphics graphics, Rectangle clipRect)
 {
     Graphics = graphics;
     ClipRectangle = clipRect;
 }
Exemple #7
0
 protected RenderSurferce(uint width, uint height)
 {
     ClientRectangle = new Rectangle(0, 0, width, height);
 }
Exemple #8
0
 public abstract void Invalidate(Rectangle rect);
Exemple #9
0
 public bool IntersectsWith(Rectangle rect)
 {
     return ((((rect.X < (this.X + this.Width)) &&
         (this.X < (rect.X + rect.Width))) &&
         (rect.Y < (this.Y + this.Height))) &&
         (this.Y < (rect.Y + rect.Height)));
 }
Exemple #10
0
 public Rectangle Intersect(Rectangle rect)
 {
     return Intersect(rect, this);
 }