Skip to content

CellSurfaceEditor Class

Methods to interact with a ICellSurface.

C#
public static class CellSurfaceEditor

Inheritance object

Sets each background of a cell to the array of colors. pixels must be the same length as the amount of cells in the surface.

C#
public static void SetPixels(this ISurface obj, Color[] pixels)

obj ISurface
The surface being edited.

pixels SadRogue.Primitives.Color[]
The colors to place.

Sets each background of a cell to the array of colors.

C#
public static void SetPixels(this ISurface obj, Rectangle area, Color[] pixels)

obj ISurface
The surface being edited.

area SadRogue.Primitives.Rectangle
An area to fill with pixels.

pixels SadRogue.Primitives.Color[]
Colors for each cell of the obj.Surface.

Tests if a cell is valid based on its x,y position.

C#
public static bool IsValidCell(this ISurface obj, int x, int y)

obj ISurface
The surface being edited.

x int
The x coordinate of the cell to test.

y int
The y coordinate of the cell to test.

bool
A true value indicating the cell by x,y does exist in this cell obj.Surface.

Tests if a cell is valid based on its x,y position.

C#
public static bool IsValidCell(this ISurface obj, Point coordinate)

obj ISurface
The surface being edited.

coordinate SadRogue.Primitives.Point
The coordinate of the cell to test.

bool
A true value indicating the cell by x,y does exist in this cell obj.Surface.

Tests if a cell is valid based on its x,y position.

C#
public static bool IsValidCell(this ISurface obj, int x, int y, out int index)

obj ISurface
The surface being edited.

x int
The x coordinate of the cell to test.

y int
The y coordinate of the cell to test.

index int
If the cell is valid, the index of the cell when found.

bool
A true value indicating the cell by x,y does exist in this cell obj.Surface.

Tests if a cell is valid based on its x,y position.

C#
public static bool IsValidCell(this ISurface obj, Point coordinate, out int index)

obj ISurface
The surface being edited.

coordinate SadRogue.Primitives.Point
The coordinate of the cell to test.

index int
If the cell is valid, the index of the cell when found.

bool
A true value indicating the cell by x,y does exist in this cell obj.Surface.

Tests if a cell is valid based on its index.

C#
public static bool IsValidCell(this ISurface obj, int index)

obj ISurface
The surface being edited.

index int
The index to test.

bool
A true value indicating the cell index is in this cell obj.Surface.

SetGlyph(ISurface, int, int, GlyphDefinition)

Section titled “SetGlyph(ISurface, int, int, GlyphDefinition)”

Changes the glyph and mirror of the specified cell.

C#
public static void SetGlyph(this ISurface obj, int x, int y, GlyphDefinition definition)

obj ISurface
The surface being edited.

x int
The x location of the cell.

y int
The y location of the cell.

definition GlyphDefinition
The glyph and mirror of the cell.

Changes the glyph of a specified cell to a new value.

C#
public static void SetGlyph(this ISurface obj, int x, int y, int glyph)

obj ISurface
The surface being edited.

x int
The x location of the cell.

y int
The y location of the cell.

glyph int
The desired glyph of the cell.

Changes the glyph and foreground of a cell.

C#
public static void SetGlyph(this ISurface obj, int x, int y, int glyph, Color foreground)

obj ISurface
The surface being edited.

x int
The x location of the cell.

y int
The y location of the cell.

glyph int
The desired glyph.

foreground SadRogue.Primitives.Color
The desired foreground.

SetGlyph(ISurface, int, int, int, Color, Color)

Section titled “SetGlyph(ISurface, int, int, int, Color, Color)”

Changes the glyph, foreground, and background of a cell.

C#
public static void SetGlyph(this ISurface obj, int x, int y, int glyph, Color foreground, Color background)

obj ISurface
The surface being edited.

x int
The x location of the cell.

y int
The y location of the cell.

glyph int
The desired glyph.

foreground SadRogue.Primitives.Color
The desired foreground.

background SadRogue.Primitives.Color
The desired background.

SetGlyph(ISurface, int, int, int, Color, Color, Mirror)

Section titled “SetGlyph(ISurface, int, int, int, Color, Color, Mirror)”

Changes the glyph, foreground, background, and mirror of a cell.

C#
public static void SetGlyph(this ISurface obj, int x, int y, int glyph, Color foreground, Color background, Mirror mirror)

obj ISurface
The surface being edited.

x int
The x location of the cell.

y int
The y location of the cell.

glyph int
The desired glyph.

foreground SadRogue.Primitives.Color
The desired foreground.

background SadRogue.Primitives.Color
The desired background.

mirror Mirror
Sets how the glyph will be mirrored.

SetGlyph(ISurface, int, int, int, Color, Color, Mirror, IEnumerable<CellDecorator>)

Section titled “SetGlyph(ISurface, int, int, int, Color, Color, Mirror, IEnumerable<CellDecorator>)”

Changes the glyph, foreground, background, and mirror of a cell.

C#
public static void SetGlyph(this ISurface obj, int x, int y, int glyph, Color foreground, Color background, Mirror mirror, IEnumerable<CellDecorator> decorators)

obj ISurface
The surface being edited.

x int
The x location of the cell.

y int
The y location of the cell.

glyph int
The desired glyph.

foreground SadRogue.Primitives.Color
The desired foreground.

background SadRogue.Primitives.Color
The desired background.

mirror Mirror
Sets how the glyph will be mirrored.

decorators IEnumerable<CellDecorator>
Decorators to set on the cell. Will clear existing decorators first.

Gets the glyph of a specified cell.

C#
public static int GetGlyph(this ISurface obj, int x, int y)

obj ISurface
The surface being edited.

x int
The x location of the cell.

y int
The y location of the cell.

int
The glyph index.

Changes the foreground of a specified cell to a new color.

C#
public static void SetForeground(this ISurface obj, int x, int y, Color color)

obj ISurface
The surface being edited.

x int
The x location of the cell.

y int
The y location of the cell.

color SadRogue.Primitives.Color
The desired color of the cell.

Gets the foreground of a specified cell.

C#
public static Color GetForeground(this ISurface obj, int x, int y)

obj ISurface
The surface being edited.

x int
The x location of the cell.

y int
The y location of the cell.

SadRogue.Primitives.Color
The color.

Changes the background of a cell to the specified color.

C#
public static void SetBackground(this ISurface obj, int x, int y, Color color)

obj ISurface
The surface being edited.

x int
The x location of the cell.

y int
The y location of the cell.

color SadRogue.Primitives.Color
The desired color of the cell.

Gets the background of a specified cell.

C#
public static Color GetBackground(this ISurface obj, int x, int y)

obj ISurface
The surface being edited.

x int
The x location of the cell.

y int
The y location of the cell.

SadRogue.Primitives.Color
The color.

SetEffect(ISurface, int, int, ICellEffect?)

Section titled “SetEffect(ISurface, int, int, ICellEffect?)”

Changes the effect of a cell to the specified effect.

C#
public static void SetEffect(this ISurface obj, int x, int y, ICellEffect? effect)

obj ISurface
The surface being edited.

x int
The x location of the cell.

y int
The y location of the cell.

effect ICellEffect
The desired effect.

Changes the effect of a cell to the specified effect.

C#
public static void SetEffect(this ISurface obj, int index, ICellEffect? effect)

obj ISurface
The surface being edited.

index int
Index of the cell.

effect ICellEffect
The desired effect.

SetEffect(ISurface, IEnumerable<Point>, ICellEffect?)

Section titled “SetEffect(ISurface, IEnumerable<Point>, ICellEffect?)”

Changes the effect of a list of cells to the specified effect.

C#
public static void SetEffect(this ISurface obj, IEnumerable<Point> cells, ICellEffect? effect)

obj ISurface
The surface being edited.

cells IEnumerable<Point>
The cells for the effect.

effect ICellEffect
The desired effect.

SetEffect(ISurface, IEnumerable<int>, ICellEffect?)

Section titled “SetEffect(ISurface, IEnumerable<int>, ICellEffect?)”

Changes the effect of a list of cells to the specified effect.

C#
public static void SetEffect(this ISurface obj, IEnumerable<int> cells, ICellEffect? effect)

obj ISurface
The surface being edited.

cells IEnumerable<int>
The cells for the effect.

effect ICellEffect
The desired effect.

SetEffect(ISurface, ColoredGlyphBase, ICellEffect?)

Section titled “SetEffect(ISurface, ColoredGlyphBase, ICellEffect?)”

Changes the effect of a cell to the specified effect.

C#
public static void SetEffect(this ISurface obj, ColoredGlyphBase cell, ICellEffect? effect)

obj ISurface
The surface being edited.

cell ColoredGlyphBase
The cells for the effect.

effect ICellEffect
The desired effect.

SetEffect(ISurface, IEnumerable<ColoredGlyphBase>, ICellEffect?)

Section titled “SetEffect(ISurface, IEnumerable<ColoredGlyphBase>, ICellEffect?)”

Changes the effect of a cell to the specified effect.

C#
public static void SetEffect(this ISurface obj, IEnumerable<ColoredGlyphBase> cells, ICellEffect? effect)

obj ISurface
The surface being edited.

cells IEnumerable<ColoredGlyphBase>
The cells for the effect.

effect ICellEffect
The desired effect.

Gets the effect of the specified cell.

C#
public static ICellEffect? GetEffect(this ISurface obj, int x, int y)

obj ISurface
The surface being edited.

x int
The x location of the cell.

y int
The y location of the cell.

ICellEffect
The effect.

Gets the effect of the specified cell.

C#
public static ICellEffect? GetEffect(this ISurface obj, int index)

obj ISurface
The surface being edited.

index int
The index of the cell.

ICellEffect
The effect.

SetCellAppearance(ISurface, int, int, ColoredGlyphBase)

Section titled “SetCellAppearance(ISurface, int, int, ColoredGlyphBase)”

Changes the appearance of the cell to that of the provided colored glyph object.

C#
public static void SetCellAppearance(this ISurface obj, int x, int y, ColoredGlyphBase appearance)

obj ISurface
The surface being edited.

x int
The x location of the cell.

y int
The y location of the cell.

appearance ColoredGlyphBase
The desired appearance of the cell. A null value cannot be passed.

SetCellAppearance(ISurface, int, int, GlyphDefinition)

Section titled “SetCellAppearance(ISurface, int, int, GlyphDefinition)”

Changes the appearance of the cell to that of the provided colored glyph object.

C#
public static void SetCellAppearance(this ISurface obj, int x, int y, GlyphDefinition definition)

obj ISurface
The surface being edited.

x int
The x location of the cell.

y int
The y location of the cell.

definition GlyphDefinition
The glyph and mirror of the cell.

Gets the appearance of a cell.

C#
public static ColoredGlyphBase GetCellAppearance(this ISurface obj, int x, int y)

obj ISurface
The surface being edited.

x int
The x location of the cell.

y int
The y location of the cell.

ColoredGlyphBase
The appearance.

Gets an enumerable of cells over a specific area.

C#
public static IEnumerable<ColoredGlyphBase> GetCells(this ISurface obj, Rectangle area)

obj ISurface
The surface being edited.

area SadRogue.Primitives.Rectangle
The area to get cells from.

IEnumerable<ColoredGlyphBase>
A new array with references to each cell in the area.

Returns a new surface with reference to each cell inside of the view.

C#
public static ICellSurface GetSubSurface(this ISurface obj, Rectangle view)

obj ISurface
The surface being edited.

view SadRogue.Primitives.Rectangle
An area of the surface to create a view of.

ICellSurface
A new surface

Returns a new surface using the cells from the current surface.

C#
public static ICellSurface GetSubSurface(this ISurface obj)

obj ISurface
The surface.

ICellSurface
A new surface instance.

Gets the mirror of a specified cell.

C#
public static Mirror GetMirror(this ISurface obj, int x, int y)

obj ISurface
The surface being edited.

x int
The x location of the cell.

y int
The y location of the cell.

Mirror
The Mirror of the cell.

Sets the mirror of a specified cell.

C#
public static void SetMirror(this ISurface obj, int x, int y, Mirror mirror)

obj ISurface
The surface being edited.

x int
The x location of the cell.

y int
The y location of the cell.

mirror Mirror
The mirror of the cell.

SetDecorator(ISurface, int, int, int, params CellDecorator[]?)

Section titled “SetDecorator(ISurface, int, int, int, params CellDecorator[]?)”

Sets the decorator of one or more cells.

C#
public static void SetDecorator(this ISurface obj, int x, int y, int count, params CellDecorator[]? decorators)

obj ISurface
The surface being edited.

x int
The x coordinate of the cell.

y int
The y coordinate of the cell.

count int
The count of cells to use from the x,y coordinate (inclusive).

decorators CellDecorator[]
The decorators. Use

null
to clear.

SetDecorator(ISurface, Point, params CellDecorator[]?)

Section titled “SetDecorator(ISurface, Point, params CellDecorator[]?)”

Sets the decorators of a cell.

C#
public static void SetDecorator(this ISurface obj, Point position, params CellDecorator[]? decorators)

obj ISurface
The surface being edited.

position SadRogue.Primitives.Point
The coordinate of the cell.

decorators CellDecorator[]
The decorators. Use

null
to clear.

SetDecorator(ISurface, int, int, params CellDecorator[]?)

Section titled “SetDecorator(ISurface, int, int, params CellDecorator[]?)”

Sets the decorator of one or more cells.

C#
public static void SetDecorator(this ISurface obj, int index, int count, params CellDecorator[]? decorators)

obj ISurface
The surface being edited.

index int
The index of the cell to start applying.

count int
The count of cells to use from the index (inclusive).

decorators CellDecorator[]
The decorators. Use

null
to clear.

SetDecorator(ISurface, int, params CellDecorator[]?)

Section titled “SetDecorator(ISurface, int, params CellDecorator[]?)”

Sets the decorators of a single cell.

C#
public static void SetDecorator(this ISurface obj, int index, params CellDecorator[]? decorators)

obj ISurface
The surface being edited.

index int
The index of the cell to start applying.

decorators CellDecorator[]
The decorators. Use

null
to clear.

AddDecorator(ISurface, int, int, int, params CellDecorator[])

Section titled “AddDecorator(ISurface, int, int, int, params CellDecorator[])”

Appends the decorators to one or more cells

C#
public static void AddDecorator(this ISurface obj, int x, int y, int count, params CellDecorator[] decorators)

obj ISurface
The surface being edited.

x int
The x coordinate of the cell.

y int
The y coordinate of the cell.

count int
The count of cells to use from the x,y coordinate (inclusive).

decorators CellDecorator[]
The decorators.

AddDecorator(ISurface, Point, params CellDecorator[])

Section titled “AddDecorator(ISurface, Point, params CellDecorator[])”

Appends the decorators to one or more cells

C#
public static void AddDecorator(this ISurface obj, Point position, params CellDecorator[] decorators)

obj ISurface
The surface being edited.

position SadRogue.Primitives.Point
The x,y coordinate of the cell.

decorators CellDecorator[]
The decorators.

AddDecorator(ISurface, int, int, params CellDecorator[])

Section titled “AddDecorator(ISurface, int, int, params CellDecorator[])”

Appends the decorators to one or more cells

C#
public static void AddDecorator(this ISurface obj, int index, int count, params CellDecorator[] decorators)

obj ISurface
The surface being edited.

index int
The index of the cell to start applying.

count int
The count of cells to use from the index (inclusive).

decorators CellDecorator[]
The decorators.

AddDecorator(ISurface, int, params CellDecorator[]?)

Section titled “AddDecorator(ISurface, int, params CellDecorator[]?)”

Appends the decorators to one or more cells

C#
public static void AddDecorator(this ISurface obj, int index, params CellDecorator[]? decorators)

obj ISurface
The surface being edited.

index int
The index of the cell to start applying.

decorators CellDecorator[]
The decorators.

RemoveDecorator(ISurface, int, int, int, params CellDecorator[])

Section titled “RemoveDecorator(ISurface, int, int, int, params CellDecorator[])”

Removes the decorators from one or more cells.

C#
public static void RemoveDecorator(this ISurface obj, int x, int y, int count, params CellDecorator[] decorators)

obj ISurface
The surface being edited.

x int
The x coordinate of the cell.

y int
The y coordinate of the cell.

count int
The count of cells to use from the x,y coordinate (inclusive).

decorators CellDecorator[]
The decorators.

RemoveDecorator(ISurface, Point, params CellDecorator[])

Section titled “RemoveDecorator(ISurface, Point, params CellDecorator[])”

Removes the decorators from a cell.

C#
public static void RemoveDecorator(this ISurface obj, Point position, params CellDecorator[] decorators)

obj ISurface
The surface being edited.

position SadRogue.Primitives.Point
The x,y coordinate of the cell.

decorators CellDecorator[]
The decorators.

RemoveDecorator(ISurface, int, int, params CellDecorator[])

Section titled “RemoveDecorator(ISurface, int, int, params CellDecorator[])”

Removes the decorators from one or more cells.

C#
public static void RemoveDecorator(this ISurface obj, int index, int count, params CellDecorator[] decorators)

obj ISurface
The surface being edited.

index int
The index of the cell to start applying.

count int
The count of cells to use from the index (inclusive).

decorators CellDecorator[]
The decorators.

RemoveDecorator(ISurface, int, params CellDecorator[])

Section titled “RemoveDecorator(ISurface, int, params CellDecorator[])”

Removes the decorators from a cell.

C#
public static void RemoveDecorator(this ISurface obj, int index, params CellDecorator[] decorators)

obj ISurface
The surface being edited.

index int
The index of the cell to start applying.

decorators CellDecorator[]
The decorators.

Clears the decorators of the specified cells.

C#
public static void ClearDecorators(this ISurface obj, int x, int y, int count)

obj ISurface
The surface being edited.

x int
The x coordinate of the cell.

y int
The y coordinate of the cell.

count int
The count of cells to use from the x,y coordinate (inclusive).

Clears the decorators of the specified cells

C#
public static void ClearDecorators(this ISurface obj, int index, int count)

obj ISurface
The surface being edited.

index int
The index of the cell to start applying.

count int
The count of cells to use from the index (inclusive).

Draws the string on the console at the specified location, wrapping if needed.

C#
public static void Print(this ISurface obj, int x, int y, string text)

obj ISurface
The surface being edited.

x int
X location of the text.

y int
Y location of the text.

text string
The string to display.

Draws the string on the console at the specified location and color, wrapping if needed.

C#
public static void Print(this ISurface obj, int x, int y, string text, Color foreground)

obj ISurface
The surface being edited.

x int
X location of the text.

y int
Y location of the text.

text string
The string to display.

foreground SadRogue.Primitives.Color
Sets the foreground of all characters in the text.

Print(ISurface, int, int, string, Color, Color)

Section titled “Print(ISurface, int, int, string, Color, Color)”

Draws the string on the console at the specified location with the specified foreground and background color, wrapping if needed.

C#
public static void Print(this ISurface obj, int x, int y, string text, Color foreground, Color background)

obj ISurface
The surface being edited.

x int
X location of the text.

y int
Y location of the text.

text string
The string to display.

foreground SadRogue.Primitives.Color
Sets the foreground of all characters in the text.

background SadRogue.Primitives.Color
Sets the background of all characters in the text.

Print(ISurface, int, int, string, Color, Color, Mirror)

Section titled “Print(ISurface, int, int, string, Color, Color, Mirror)”

Draws the string on the console at the specified location with the specified settings.

C#
public static void Print(this ISurface obj, int x, int y, string text, Color foreground, Color background, Mirror mirror)

obj ISurface
The surface being edited.

x int
X location of the text.

y int
Y location of the text.

text string
The string to display.

foreground SadRogue.Primitives.Color
Sets the foreground of all characters in the text.

background SadRogue.Primitives.Color
Sets the background of all characters in the text.

mirror Mirror
The mirror to set on all characters in the text.

Print(ISurface, int, int, string, Color, Color, Mirror, CellDecorator[])

Section titled “Print(ISurface, int, int, string, Color, Color, Mirror, CellDecorator[])”

Draws the string on the console at the specified location with the specified settings.

C#
public static void Print(this ISurface obj, int x, int y, string text, Color foreground, Color background, Mirror mirror, CellDecorator[] decorators)

obj ISurface
The surface being edited.

x int
X location of the text.

y int
Y location of the text.

text string
The string to display.

foreground SadRogue.Primitives.Color
Sets the foreground of all characters in the text.

background SadRogue.Primitives.Color
Sets the background of all characters in the text.

mirror Mirror
The mirror to set on all characters in the text.

decorators CellDecorator[]
An array of cell decorators to use on each glyph. A null value will clear the decorators.

Draws the string on the console at the specified location with the specified settings.

C#
public static void Print(this ISurface obj, int x, int y, string text, Mirror mirror)

obj ISurface
The surface being edited.

x int
X location of the text.

y int
Y location of the text.

text string
The string to display.

mirror Mirror
The mirror to set on all characters in the text.

Print(ISurface, int, int, string, ColoredGlyphBase, ICellEffect?)

Section titled “Print(ISurface, int, int, string, ColoredGlyphBase, ICellEffect?)”

Draws the string on the console at the specified location, wrapping if needed.

C#
public static void Print(this ISurface obj, int x, int y, string text, ColoredGlyphBase appearance, ICellEffect? effect = null)

obj ISurface
The surface being edited.

x int
X location of the text.

y int
Y location of the text.

text string
The string to display.

appearance ColoredGlyphBase
The appearance of the cell

effect ICellEffect
An optional effect to apply to the printed obj.Surface.

Draws the string on the console at the specified location, wrapping if needed.

C#
public static void Print(this ISurface obj, int x, int y, ColoredString text)

obj ISurface
The surface being edited.

x int
X location of the text.

y int
Y location of the text.

text ColoredString
The string to display.

Print(ISurface, int, int, ColoredGlyphBase[])

Section titled “Print(ISurface, int, int, ColoredGlyphBase[])”

Draws the string on the console at the specified location, wrapping if needed.

C#
public static void Print(this ISurface obj, int x, int y, ColoredGlyphBase[] glyphs)

obj ISurface
The surface being edited.

x int
X location of the text.

y int
Y location of the text.

glyphs ColoredGlyphBase[]
An array of glyphs to print at the specified position.

Print(ISurface, int, int, IEnumerable<ColoredGlyphBase>)

Section titled “Print(ISurface, int, int, IEnumerable<ColoredGlyphBase>)”

Draws the string on the console at the specified location, wrapping if needed.

C#
public static void Print(this ISurface obj, int x, int y, IEnumerable<ColoredGlyphBase> glyphs)

obj ISurface
The surface being edited.

x int
X location of the text.

y int
Y location of the text.

glyphs IEnumerable<ColoredGlyphBase>
An enumeration of glyphs to print at the specified position.

Builds a string from the text surface from the specified coordinates.

C#
public static string GetString(this ISurface obj, int x, int y, int length)

obj ISurface
The surface being edited.

x int
The x position of the surface to start at.

y int
The y position of the surface to start at.

length int
How many characters to fill the string with.

string
A string built from the text surface data.

Builds a string from the cells.

C#
public static string GetString(this ISurface obj, int index, int length)

obj ISurface
The surface being edited.

index int
Where to start getting characters from.

length int
How many characters to fill the string with.

string
A string built from the text surface data.

Builds a string from the text surface from the specified coordinates.

C#
public static ColoredString GetStringColored(this ISurface obj, int x, int y, int length)

obj ISurface
The surface being edited.

x int
The x position of the surface to start at.

y int
The y position of the surface to start at.

length int
How many characters to fill the string with.

ColoredString
A string built from the text surface data.

Builds a string from the text surface.

C#
public static ColoredString GetStringColored(this ISurface obj, int index, int length)

obj ISurface
The surface being edited.

index int
Where to start getting characters from.

length int
How many characters to fill the string with.

ColoredString
A string built from the text surface data.

Resets the shifted amounts to 0, as if the surface has never shifted.

C#
public static void ClearShiftValues(this ISurface obj)

obj ISurface
The surface being edited.

Shifts the entire row by the specified amount.

C#
public static void ShiftRow(this ISurface obj, int row, int amount, bool wrap)

obj ISurface
The surface being edited.

row int
The row to shift.

amount int
The amount to shift by. A negative value shifts left and a positive value shifts right.

wrap bool
When true, wraps the glyph data from one side to another, otherwise clears the glyphs left behind.

ShiftRow(ISurface, int, int, int, int, bool)

Section titled “ShiftRow(ISurface, int, int, int, int, bool)”

Shifts the specified row from an X position, by the specified amount.

C#
public static void ShiftRow(this ISurface obj, int row, int startingX, int count, int amount, bool wrap)

obj ISurface
The surface being edited.

row int
The row to shift.

startingX int
The starting column to shift from.

count int
The number of cells to shift starting from startingX.

amount int
The amount to shift by. A negative value shifts left and a positive value shifts right.

wrap bool
When true, wraps the glyph data from one side to another, otherwise clears the glyphs left behind.

ArgumentOutOfRangeException
One of the parameters is outside of the surface width.

ShiftRowRight(ISurface, int, int, int, int, bool)

Section titled “ShiftRowRight(ISurface, int, int, int, int, bool)”

Shifts the specified row from an X position, by the specified amount, to the right.

C#
public static void ShiftRowRight(this ISurface obj, int row, int startingX, int count, int amount, bool wrap)

obj ISurface
The surface being edited.

row int
The row to shift.

startingX int
The starting column to shift from.

count int
The number of cells to shift starting from startingX.

amount int
The amount to shift by. A negative value shifts left and a positive value shifts right.

wrap bool
When true, wraps the glyph data from one side to another, otherwise clears the glyphs left behind.

ArgumentOutOfRangeException
One of the parameters is outside of the surface width.

ShiftRowLeft(ISurface, int, int, int, int, bool)

Section titled “ShiftRowLeft(ISurface, int, int, int, int, bool)”

Shifts the specified row from an X position, by the specified amount, to the left.

C#
public static void ShiftRowLeft(this ISurface obj, int row, int startingX, int count, int amount, bool wrap)

obj ISurface
The surface being edited.

row int
The row to shift.

startingX int
The starting column to shift from.

count int
The number of cells to shift starting from startingX.

amount int
The amount to shift by. A negative value shifts left and a positive value shifts right.

wrap bool
When true, wraps the glyph data from one side to another, otherwise clears the glyphs left behind.

ArgumentOutOfRangeException
One of the parameters is outside of the surface width.

ShiftRowRightUnchecked(ISurface, int, int, int, int, bool)

Section titled “ShiftRowRightUnchecked(ISurface, int, int, int, int, bool)”

Internal use. Doesn’t do any checks on valid values. Shifts the specified row from an X position, by the specified amount, to the right.

C#
public static void ShiftRowRightUnchecked(this ISurface obj, int row, int startingX, int count, int amount, bool wrap)

obj ISurface
The surface being edited.

row int
The row to shift.

startingX int
The starting column to shift from.

count int
The number of cells to shift starting from startingX.

amount int
The amount to shift by. A negative value shifts left and a positive value shifts right.

wrap bool
When true, wraps the glyph data from one side to another, otherwise clears the glyphs left behind.

ShiftRowLeftUnchecked(ISurface, int, int, int, int, bool)

Section titled “ShiftRowLeftUnchecked(ISurface, int, int, int, int, bool)”

Internal use. Doesn’t do any checks on valid values. Shifts the specified row from an X position, by the specified amount, to the left.

C#
public static void ShiftRowLeftUnchecked(this ISurface obj, int row, int startingX, int count, int amount, bool wrap)

obj ISurface
The surface being edited.

row int
The row to shift.

startingX int
The starting column to shift from.

count int
The number of cells to shift starting from startingX.

amount int
The amount to shift by. A negative value shifts left and a positive value shifts right.

wrap bool
When true, wraps the glyph data from one side to another, otherwise clears the glyphs left behind.

Shifts the entire column by the specified amount.

C#
public static void ShiftColumn(this ISurface obj, int col, int amount, bool wrap)

obj ISurface
The surface being edited.

col int
The column to shift.

amount int
The amount to shift by. A negative value shifts left and a positive value shifts right.

wrap bool
When true, wraps the glyph data from one side to another, otherwise clears the glyphs left behind.

ShiftColumn(ISurface, int, int, int, int, bool)

Section titled “ShiftColumn(ISurface, int, int, int, int, bool)”

Shifts the specified row from an X position, by the specified amount.

C#
public static void ShiftColumn(this ISurface obj, int col, int startingY, int count, int amount, bool wrap)

obj ISurface
The surface being edited.

col int
The column to shift.

startingY int
The starting row to shift from.

count int
The number of cells to shift starting from startingY.

amount int
The amount to shift by. A negative value shifts left and a positive value shifts right.

wrap bool
When true, wraps the glyph data from one side to another, otherwise clears the glyphs left behind.

ArgumentOutOfRangeException
One of the parameters is outside of the surface height.

ShiftColumnDown(ISurface, int, int, int, int, bool)

Section titled “ShiftColumnDown(ISurface, int, int, int, int, bool)”

Shifts the specified row from n Y position, by the specified amount, down.

C#
public static void ShiftColumnDown(this ISurface obj, int col, int startingY, int count, int amount, bool wrap)

obj ISurface
The surface being edited.

col int
The column to shift.

startingY int
The starting row to shift from.

count int
The number of cells to shift starting from startingY.

amount int
The amount to shift by. A negative value shifts left and a positive value shifts right.

wrap bool
When true, wraps the glyph data from one side to another, otherwise clears the glyphs left behind.

ArgumentOutOfRangeException
One of the parameters is outside of the surface height.

ShiftColumnUp(ISurface, int, int, int, int, bool)

Section titled “ShiftColumnUp(ISurface, int, int, int, int, bool)”

Shifts the specified row from n Y position, by the specified amount, up.

C#
public static void ShiftColumnUp(this ISurface obj, int col, int startingY, int count, int amount, bool wrap)

obj ISurface
The surface being edited.

col int
The column to shift.

startingY int
The starting row to shift from.

count int
The number of cells to shift starting from startingY.

amount int
The amount to shift by. A negative value shifts left and a positive value shifts right.

wrap bool
When true, wraps the glyph data from one side to another, otherwise clears the glyphs left behind.

ArgumentOutOfRangeException
One of the parameters is outside of the surface height.

ShiftColumnDownUnchecked(ISurface, int, int, int, int, bool)

Section titled “ShiftColumnDownUnchecked(ISurface, int, int, int, int, bool)”

Internal use. Doesn’t do any checks on valid values. Shifts the specified row from a Y position, by the specified amount, down.

C#
public static void ShiftColumnDownUnchecked(this ISurface obj, int col, int startingY, int count, int amount, bool wrap)

obj ISurface
The surface being edited.

col int
The column to shift.

startingY int
The starting column to shift from.

count int
The number of cells to shift starting from startingY.

amount int
The amount to shift by. A negative value shifts left and a positive value shifts right.

wrap bool
When true, wraps the glyph data from one side to another, otherwise clears the glyphs left behind.

ShiftColumnUpUnchecked(ISurface, int, int, int, int, bool)

Section titled “ShiftColumnUpUnchecked(ISurface, int, int, int, int, bool)”

Internal use. Doesn’t do any checks on valid values. Shifts the specified row from a Y position, by the specified amount, up.

C#
public static void ShiftColumnUpUnchecked(this ISurface obj, int col, int startingY, int count, int amount, bool wrap)

obj ISurface
The surface being edited.

col int
The column to shift.

startingY int
The starting column to shift from.

count int
The number of cells to shift starting from startingY.

amount int
The amount to shift by. A negative value shifts left and a positive value shifts right.

wrap bool
When true, wraps the glyph data from one side to another, otherwise clears the glyphs left behind.

Scrolls all the console data up by one.

C#
public static void ShiftUp(this ISurface obj)

obj ISurface
The surface being edited.

Scrolls all the console data up by the specified amount of rows.

C#
public static void ShiftUp(this ISurface obj, int amount, bool wrap = false)

obj ISurface
The surface being edited.

amount int
How many rows to shift.

wrap bool
When false, a blank line appears at the bottom. When true, the top line appears at the bottom.

Scrolls all the console data down by one.

C#
public static void ShiftDown(this ISurface obj)

obj ISurface
The surface being edited.

Scrolls all the console data down by the specified amount of rows.

C#
public static void ShiftDown(this ISurface obj, int amount, bool wrap = false)

obj ISurface
The surface being edited.

amount int
How many rows to shift.

wrap bool
When false, a blank line appears at the top. When true, the bottom line appears at the top.

Scrolls all the console data right by one.

C#
public static void ShiftRight(this ISurface obj)

obj ISurface
The surface being edited.

Scrolls all the console data right by the specified amount.

C#
public static void ShiftRight(this ISurface obj, int amount, bool wrap = false)

obj ISurface
The surface being edited.

amount int
How much to scroll.

wrap bool
When false, a blank line appears at the left. When true, the right line appears at the left.

Scrolls all the console data left by one.

C#
public static void ShiftLeft(this ISurface obj)

obj ISurface
The surface being edited.

Scrolls all the console data left by the specified amount.

C#
public static void ShiftLeft(this ISurface obj, int amount, bool wrap = false)

obj ISurface
The surface being edited.

amount int
How much to scroll.

wrap bool
When false, a blank line appears at the right. When true, the left line appears at the right.

Starting at the specified coordinate, clears the glyph, mirror, and decorators, for the specified count of obj.Surface. Doesn’t clear the effect, foreground, or background.

C#
public static ColoredGlyphBase[] Erase(this ISurface obj, int x, int y, int count)

obj ISurface
The surface being edited.

x int
The x position.

y int
The y position.

count int
The count of glyphs to erase.

ColoredGlyphBase[]
The cells processed by this method.

Cells altered by this method has the Glyph set to DefaultGlyph, the Decorators array reset, and the Mirror set to None.

Clears the glyph, mirror, and decorators, for the specified cell. Doesn’t clear the effect.

C#
public static void Erase(this ISurface obj, int x, int y)

obj ISurface
The surface being edited.

x int
The x position.

y int
The y position.

The cell altered by this method has the Glyph set to DefaultGlyph, the Decorators array reset, and the Mirror set to None.

Erases all cells which clears the glyph, mirror, and decorators. Doesn’t clear the effect.

C#
public static void Erase(this ISurface obj)

obj ISurface
The surface being edited.

All cells have Glyph set to DefaultGlyph, the Decorators array reset, and the Mirror set to None.

Clears the console data. Characters are reset to 0, the foreground and background are set to default, and mirror set to none. Clears cell decorators.

C#
public static void Clear(this ISurface obj)

obj ISurface
The surface being edited.

Clears a cell. Character is reset to 0, the foreground and background is set to default, and mirror is set to none. Clears cell decorators.

C#
public static void Clear(this ISurface obj, int x, int y)

obj ISurface
The surface being edited.

x int
The x location of the cell.

y int
The y location of the cell.

Clears a segment of cells, starting from the left, extending to the right, and wrapping if needed. Character is reset to 0, the foreground and background is set to default, and mirror is set to none. Clears cell decorators.

C#
public static void Clear(this ISurface obj, int x, int y, int length)

obj ISurface
The surface being edited.

x int
The x position of the left end of the segment.

y int
The y position of the segment.

length int
The length of the segment. If it extends beyond the line, it will wrap to the next line. If it extends beyond the console, then it automatically ends at the last valid cell.

This works similarly to printing a string of whitespace

Clears an area of obj.Surface. Each cell is reset to its default state. Then, Glyph, foreground, and background, are reset to the surface’s default values.

C#
public static void Clear(this ISurface obj, Rectangle area)

obj ISurface
The surface being edited.

area SadRogue.Primitives.Rectangle
The area to clear.

Clears an area of obj.Surface. Each cell is reset to its default state. Then, Glyph, foreground, and background, are reset to the surface’s default values.

C#
public static void Clear(this ISurface obj, IEnumerable<Point> cellPositions)

obj ISurface
The surface being edited.

cellPositions IEnumerable<Point>
The cells to clear.

Fills the console. Clears cell decorators and effects.

C#
public static ColoredGlyphBase[] Fill(this ISurface obj, ColoredGlyphBase iconAppearance)

obj ISurface
The surface being edited.

iconAppearance ColoredGlyphBase
The appearance that is copied to every cell.

ColoredGlyphBase[]
The array of all cells in this console, starting from the top left corner.

Fill(ISurface, Color?, Color?, int?, Mirror?)

Section titled “Fill(ISurface, Color?, Color?, int?, Mirror?)”

Fills the console. Clears cell decorators and effects.

C#
public static ColoredGlyphBase[] Fill(this ISurface obj, Color? foreground = null, Color? background = null, int? glyph = null, Mirror? mirror = null)

obj ISurface
The surface being edited.

foreground System.NullableSadRogue.Primitives.Color
Foreground to apply. If null, skips.

background System.NullableSadRogue.Primitives.Color
Foreground to apply. If null, skips.

glyph int?
Glyph to apply. If null, skips.

mirror Mirror?
Mirror to apply. If null, skips.

ColoredGlyphBase[]
The array of all cells in this console, starting from the top left corner.

Fill(ISurface, int, int, int, Color?, Color?, int?, Mirror?)

Section titled “Fill(ISurface, int, int, int, Color?, Color?, int?, Mirror?)”

Fills a segment of cells, starting from the left, extending to the right, and wrapping if needed. Clears cell decorators.

C#
public static ColoredGlyphBase[] Fill(this ISurface obj, int x, int y, int length, Color? foreground = null, Color? background = null, int? glyph = null, Mirror? mirror = null)

obj ISurface
The surface being edited.

x int
The x position of the left end of the segment.

y int
The y position of the segment.

length int
The length of the segment. If it extends beyond the line, it will wrap to the next line. If it extends beyond the console, then it automatically ends at the last valid cell.

foreground System.NullableSadRogue.Primitives.Color
Foreground to apply. If null, skips.

background System.NullableSadRogue.Primitives.Color
Background to apply. If null, skips.

glyph int?
Glyph to apply. If null, skips.

mirror Mirror?
Mirror to apply. If null, skips.

ColoredGlyphBase[]
An array containing the affected cells, starting from the top left corner. If x or y are out of bounds, nothing happens and an empty array is returned

Fill(ISurface, Rectangle, Color?, Color?, int?, Mirror?)

Section titled “Fill(ISurface, Rectangle, Color?, Color?, int?, Mirror?)”

Fills the specified area. Clears cell decorators.

C#
public static ColoredGlyphBase[] Fill(this ISurface obj, Rectangle area, Color? foreground = null, Color? background = null, int? glyph = null, Mirror? mirror = null)

obj ISurface
The surface being edited.

area SadRogue.Primitives.Rectangle
The area to fill.

foreground System.NullableSadRogue.Primitives.Color
Foreground to apply. If null, skips.

background System.NullableSadRogue.Primitives.Color
Background to apply. If null, skips.

glyph int?
Glyph to apply. If null, skips.

mirror Mirror?
Mirror to apply. If null, skips.

ColoredGlyphBase[]
An array containing the affected cells, starting from the top left corner. If the area is out of bounds, nothing happens and an empty array is returned.

DrawLine(ISurface, Point, Point, int?, Color?, Color?, Mirror?)

Section titled “DrawLine(ISurface, Point, Point, int?, Color?, Color?, Mirror?)”

Draws a line from start to end.

C#
public static IEnumerable<ColoredGlyphBase> DrawLine(this ISurface obj, Point start, Point end, int? glyph, Color? foreground = null, Color? background = null, Mirror? mirror = null)

obj ISurface
The surface being edited.

start SadRogue.Primitives.Point
Starting point of the line.

end SadRogue.Primitives.Point
Ending point of the line.

glyph int?
Glyph to set. If null, skipped.

foreground System.NullableSadRogue.Primitives.Color
Foreground to set. If null, skipped.

background System.NullableSadRogue.Primitives.Color
Background to set. If null, skipped.

mirror Mirror?
Mirror to set. If null, skipped.

IEnumerable<ColoredGlyphBase>
A list of cells the line touched; ordered from first to last.

To simply return the list of cells that would be drawn to, use null for glyph, foreground, background, and mirror.

DrawBox(ISurface, Rectangle, ShapeParameters)

Section titled “DrawBox(ISurface, Rectangle, ShapeParameters)”

Draws a box.

C#
public static void DrawBox(this ISurface obj, Rectangle area, ShapeParameters parameters)

obj ISurface
The surface being edited.

area SadRogue.Primitives.Rectangle
The area of the box.

parameters ShapeParameters
Provides the options for drawing a border and filling the box.

DrawCircle(ISurface, Rectangle, ShapeParameters)

Section titled “DrawCircle(ISurface, Rectangle, ShapeParameters)”

Draws an ellipse.

C#
public static void DrawCircle(this ISurface obj, Rectangle area, ShapeParameters parameters)

obj ISurface
The surface being edited.

area SadRogue.Primitives.Rectangle
The area the ellipse

parameters ShapeParameters
Provides the options for drawing a border and filling the circle.

Connects all lines in a surface for both ConnectedLineThin and ConnectedLineThick styles.

C#
public static void ConnectLines(this ISurface obj)

obj ISurface
The surface being edited.

Connects all lines in this based on the lineStyle style provided.

C#
public static void ConnectLines(this ISurface obj, int[] lineStyle)

obj ISurface
The surface being edited.

lineStyle int[]
The array of line styles indexed by ICellSurface.ConnectedLineIndex.

Connects all lines in this based on the lineStyle style provided.

C#
public static void ConnectLines(this ISurface obj, int[] lineStyle, Rectangle area)

obj ISurface
The surface being edited.

lineStyle int[]
The array of line styles indexed by ICellSurface.ConnectedLineIndex.

area SadRogue.Primitives.Rectangle
The area to process.

Copies the contents of the cell surface to the destination.

C#
public static void Copy(this ISurface obj, ICellSurface destination)

obj ISurface
The surface being edited.

destination ICellSurface
The destination obj.Surface.

If the sizes to not match, it will always start at 0,0 and work with what it can and move on to the next row when either surface runs out of columns being processed

Copies the contents of the cell surface to the destination at the specified x,y.

C#
public static void Copy(this ISurface obj, ICellSurface destination, int x, int y)

obj ISurface
The surface being edited.

destination ICellSurface
The destination obj.Surface.

x int
The x coordinate of the destination.

y int
The y coordinate of the destination.

Copy(ISurface, Rectangle, ICellSurface, int, int)

Section titled “Copy(ISurface, Rectangle, ICellSurface, int, int)”

Copies an area of this cell surface to the destination surface.

C#
public static void Copy(this ISurface obj, Rectangle area, ICellSurface destination, int destinationX, int destinationY)

obj ISurface
The surface being edited.

area SadRogue.Primitives.Rectangle
The area to copy.

destination ICellSurface
The destination obj.Surface.

destinationX int
The x coordinate to copy to.

destinationY int
The y coordinate to copy to.

Copy(ISurface, int, int, int, int, ICellSurface, int, int)

Section titled “Copy(ISurface, int, int, int, int, ICellSurface, int, int)”

Copies the contents of this cell surface at the specified x,y coordinates to the destination, only with the specified obj.Surface.BufferWidth and obj.Surface.BufferHeight, and copies it to the specified destinationX and destinationY position.

C#
public static void Copy(this ISurface obj, int x, int y, int width, int height, ICellSurface destination, int destinationX, int destinationY)

obj ISurface
The surface being edited.

x int
The x coordinate to start from.

y int
The y coordinate to start from.

width int
The BufferWidth to copy from.

height int
The BufferHeight to copy from.

destination ICellSurface
The destination obj.Surface.

destinationX int
The x coordinate to copy to.

destinationY int
The y coordinate to copy to.

Fills a console with random colors and glyphs.

C#
public static void FillWithRandomGarbage(this ISurface obj, IFont associatedFont)

obj ISurface
The surface being edited.

associatedFont IFont
The font used in assigning glyphs randomly.

Fills a console with random colors and glyphs.

C#
public static void FillWithRandomGarbage(this ISurface obj, int maxGlyphValue)

obj ISurface
The surface being edited.

maxGlyphValue int
The maximum glyph value to use on the obj.Surface.

FillWithRandomGarbage(ISurface, int, Rectangle)

Section titled “FillWithRandomGarbage(ISurface, int, Rectangle)”

Fills a console with random colors and glyphs.

C#
public static void FillWithRandomGarbage(this ISurface obj, int maxGlyphValue, Rectangle area)

obj ISurface
The surface being edited.

maxGlyphValue int
The maximum glyph value to use on the obj.Surface.

area SadRogue.Primitives.Rectangle
The area to fill with random garbage.

PrintTheDraw(ICellSurface, int, string, TheDrawFont, HorizontalAlignment, int)

Section titled “PrintTheDraw(ICellSurface, int, string, TheDrawFont, HorizontalAlignment, int)”

Prints text using TheDrawFont and horizontal alignment specified. Calculates x coordinate. Truncates string to fit it in one line.

C#
public static void PrintTheDraw(this ICellSurface cellSurface, int y, string text, TheDrawFont drawFont, HorizontalAlignment alignment, int padding = 0)

cellSurface ICellSurface
Class implementing ICellSurface.

y int
Y coordinate of the obj.Surface.

text string
Text to print.

drawFont TheDrawFont
Instance of the TheDrawFont to use.

alignment HorizontalAlignment
HorizontalAlignment to use.

padding int
Amount of regular font characters used as horizontal padding on both sides of the output.

PrintTheDraw(ICellSurface, int, int, string, TheDrawFont)

Section titled “PrintTheDraw(ICellSurface, int, int, string, TheDrawFont)”

Prints text using TheDrawFont.

C#
public static void PrintTheDraw(this ICellSurface cellSurface, int x, int y, string text, TheDrawFont drawFont)

cellSurface ICellSurface
Class implementing ICellSurface.

x int
X coordinate of the obj.Surface.

y int
Y coordinate of the obj.Surface.

text string
Text to print.

drawFont TheDrawFont
Instance of the TheDrawFont to use.