private void EraseDisplay() { var type = GetParamOrDefault(0, 0); var currentPosition = terminal.Cursor.Position; IntegerPosition clearBegin, clearEnd; switch (type) { case 0: clearBegin = currentPosition; clearEnd = terminal.Cursor.MaximalPosition; break; case 1: clearBegin = new IntegerPosition(); clearEnd = currentPosition; break; case 2: clearBegin = new IntegerPosition(); clearEnd = terminal.Cursor.MaximalPosition; cursor.Position = new IntegerPosition(0, 0); break; default: logger.Log("Unimplemented erase display mode."); return; } terminal.EraseScreen(clearBegin, clearEnd, graphicRendition.Background); }
public void EraseScreen(IntegerPosition from, IntegerPosition to, Color?background) { for (var rowScreenPosition = from.Y; rowScreenPosition <= to.Y; rowScreenPosition++) { var row = GetScreenRow(rowScreenPosition); row.Erase(rowScreenPosition == from.Y ? from.X : 0, rowScreenPosition == to.Y ? to.X : row.CurrentMaximalCursorPosition, background); } canvas.Redraw(); }