public static bool Write(this ITerminalSink sink, Catena catena, Rectangle destination) { CharInfo[,] result = new CharInfo[destination.Height, destination.Width]; CharInfo[] buffer = catena.ToArray(); int index = 0; for (int y = 0; y < destination.Height; y++) { for (int x = 0; x < destination.Width && index < buffer.Length; x++, index++) { result[y, x] = buffer[index]; } } return(sink.Write(result, new Coord(destination.Left, destination.Top))); }
public override void Draw(ITerminalSink sink, Rectangle window) { if (!this.Region.Overlaps(window)) { return; } Coord destination = new Coord(window.Left, window.Top); window -= this.Region.TopLeft; sink.Write( this.backingFill.GetFullSize(), destination, new Rectangle( window.Left, window.Top, (short)(window.Right + 1), (short)(window.Bottom + 1))); }
/// <summary> /// Writes the specified <see cref="Catena"/> <paramref name="catena"/> starting at the coordinate specified by /// the <see cref="Coord"/> <paramref name="destination"/>, if possible. If the write operation completed, /// returns <see langword="true"/>; otherwise, returns <see langword="false"/>. The most common reason for an /// incomplete write operation is if the specified <paramref name="catena"/> extends past the writeable area of /// this sink. /// </summary> /// <param name="sink"> /// The <see cref="ITerminalSink"/> to write to. /// </param> /// <param name="catena"> /// The <see cref="Catena"/> to write. /// </param> /// <param name="destination"> /// The destination to start writing <paramref name="catena"/> from. /// </param> /// <returns> /// <see langword="true"/> if the write operation completed; otherwise, <see langword="false"/>. The most /// common reason for an incomplete write operation is if the specified <paramref name="catena"/> extends past /// the writeable area of this sink. /// </returns> public static bool Write(this ITerminalSink sink, Catena catena, Coord destination) { return(sink.Write(catena.ToArray(), destination)); }
/// <summary> /// Writes the specified <see cref="Catena"/> <paramref name="catena"/> and advances the cursor. /// </summary> /// <param name="sink"> /// The <see cref="ITerminalSink"/> to write to. /// </param> /// <param name="catena"> /// The <see cref="Catena"/> to write. /// </param> /// <returns> /// <see langword="true"/> if the write operation completed; otherwise, <see langword="false"/>. The most /// common reason for an incomplete write operation is if the specified <paramref name="catena"/> extends past /// the writeable area of this sink. /// </returns> public static bool Write(this ITerminalSink sink, Catena catena) { return(sink.Write(catena.ToArray())); }