/// <summary> /// Writes character and attribute information to a rectangular portion of the screen buffer. /// </summary> /// <param name="bufferName">Name of the buffer to write from.</param> /// <param name="bufferX">Column position of the first character to be written from the array.</param> /// <param name="bufferY">Row position of the first character to be written from the array.</param> /// <param name="left">Column position of the top-left corner of the screen buffer area where characters are to be written.</param> /// <param name="top">Row position of the top-left corner of the screen buffer area where characters are to be written.</param> /// <param name="right">Column position of the bottom-right corner of the screen buffer area where characters are to be written.</param> /// <param name="bottom">Row position of the bottom-right corner of the screen buffer area where characters are to be written.</param> public static void WriteBuffer(string bufferName, int bufferX, int bufferY, int left, int top, int right, int bottom) { CheckBuffer(bufferName); var buffer = buffers[bufferName]; var bufferSize = new CoordInternal (buffer.GetLength(1), buffer.GetLength(0)); var bufferPos = new CoordInternal(bufferX, bufferY); var writeRegion = new RectInternal(left, top, right, bottom); WinCon.WriteConsoleOutput(ZOutput.hConsoleOutput, buffer, bufferSize, bufferPos, writeRegion); }
public static void FillRectCharAttribute(int left, int top, int right, int bottom, ZCharAttribute attribute) { var result = 0; var width = right - left + 1; var height = bottom - top + 1; for (var i = 0; i < height; i++) { var coord = new CoordInternal(left, top+i); WinCon.FillConsoleOutputAttribute(hConsoleOutput, attribute, width, coord, ref result); } }
/// <summary> /// Reads a rectangular block of character and attribute information from the screen buffer into the passed array. /// </summary> /// <param name="bufferName">Name of the buffer to read to.</param> /// <param name="bufferX">The column position in the array where the first character is to be placed.</param> /// <param name="bufferY">The row position in the array where the first character is to be placed.</param> /// <param name="left">Column position of the top-left corner of the screen buffer area from which characters are to be read.</param> /// <param name="top">Row position of the top-left corner of the screen buffer area from which characters are to be read.</param> /// <param name="right">Column position of the bottom-right corner of the screen buffer area from which characters are to be read.</param> /// <param name="bottom">Row position of the bottom-right corner of the screen buffer area from which characters are to be read.</param> public static void ReadBuffer(string bufferName, int bufferX, int bufferY, int left, int top, int right, int bottom) { var buffer = new ZCharInfo[bottom-top+1,right-left+1]; var bufferSize = new CoordInternal(buffer.GetLength(1), buffer.GetLength(0)); var bufferPos = new CoordInternal(bufferX, bufferY); var readRegion = new RectInternal(left, top, right, bottom); WinCon.ReadConsoleOutput(ZOutput.hConsoleOutput, buffer, bufferSize, bufferPos, readRegion); if (buffers.ContainsKey(bufferName)) { buffers[bufferName] = buffer; } else { buffers.Add(bufferName, buffer); } }
public static void FillCharAttribute(int x, int y, ZCharAttribute attribute, int count = 1) { var result = 0; var coord = new CoordInternal(x, y); WinCon.FillConsoleOutputAttribute(hConsoleOutput, attribute, count, coord, ref result); }