C# Class SadConsole.Consoles.TextSurfaceExtensions

Extension methods relating to all text surface types.
Show file Open project: Thraka/SadConsole

Public Methods

Method Description
Copy ( this source, ITextSurface destination ) : void

Copies the contents of the cell surface to the destination.

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

Copy ( this source, ITextSurface destination, int x, int y ) : void

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

Copy ( this source, int x, int y, int width, int height, ITextSurface destination, int destinationX, int destinationY ) : void

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

GetCell ( this surface, int x, int y ) : Cell

Gets a cell based on it's coordinates on the surface.

GetIndexFromPoint ( this surface, Point location ) : int

Gets the index of a location on the surface by point.

GetIndexFromPoint ( this surface, int x, int y ) : int

Gets the index of a location on the surface by coordinate.

GetPointFromIndex ( this surface, int index ) : Point

Gets the x,y of an index on the surface.

IsValidCell ( this surface, int x, int y ) : bool

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

IsValidCell ( this surface, int x, int y, int &index ) : bool

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

Method Details

Copy() public static method

Copies the contents of the cell surface to the destination.
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
public static Copy ( this source, ITextSurface destination ) : void
source this The source surface
destination ITextSurface The destination surface.
return void

Copy() public static method

Copies the contents of the cell surface to the destination at the specified x,y.
public static Copy ( this source, ITextSurface destination, int x, int y ) : void
source this The source surface
destination ITextSurface The destination surface.
x int The x coordinate of the destination.
y int The y coordinate of the destination.
return void

Copy() public static method

Copies the contents of this cell surface at the specified x,y coordinates to the destination, only with the specified width and height, and copies it to the specified destinationX and destinationY position.
public static Copy ( this source, int x, int y, int width, int height, ITextSurface destination, int destinationX, int destinationY ) : void
source this The source surface
x int The x coordinate to start from.
y int The y coordinate to start from.
width int The width to copy from.
height int The height to copy from.
destination ITextSurface The destination surface.
destinationX int The x coordinate to copy to.
destinationY int The y coordinate to copy to.
return void

GetCell() public static method

Gets a cell based on it's coordinates on the surface.
public static GetCell ( this surface, int x, int y ) : Cell
surface this The surface to check.
x int The X coordinate.
y int The Y coordinate.
return Cell

GetIndexFromPoint() public static method

Gets the index of a location on the surface by point.
public static GetIndexFromPoint ( this surface, Point location ) : int
surface this The surface to check.
location Microsoft.Xna.Framework.Point The location of the index to get.
return int

GetIndexFromPoint() public static method

Gets the index of a location on the surface by coordinate.
public static GetIndexFromPoint ( this surface, int x, int y ) : int
surface this The surface to check.
x int The x of the location.
y int The y of the location.
return int

GetPointFromIndex() public static method

Gets the x,y of an index on the surface.
public static GetPointFromIndex ( this surface, int index ) : Point
surface this The surface to check.
index int The index to get.
return Microsoft.Xna.Framework.Point

IsValidCell() public static method

Tests if a cell is valid based on its x,y position.
public static IsValidCell ( this surface, int x, int y ) : bool
surface this The surface to check.
x int The x coordinate of the cell to test.
y int The y coordinate of the cell to test.
return bool

IsValidCell() public static method

Tests if a cell is valid based on its x,y position.
public static IsValidCell ( this surface, int x, int y, int &index ) : bool
surface this The surface to check.
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.
return bool