Class Grid<T>
- Namespace
- OmegaEngine.Foundation.Geometry
- Assembly
- OmegaEngine.Foundation.dll
A 2D grid of values that can be stored in PNG files.
public abstract class Grid<T> where T : struct
Type Parameters
T
The type of values stored in the grid.
- Inheritance
-
Grid<T>
- Derived
- Inherited Members
- Extension Methods
Constructors
Grid(int, int)
Creates a new empty grid.
protected Grid(int width, int height)
Parameters
width
intThe width of the grid (number of values along the X axis).
height
intThe height of the grid (number of values along the Y axis).
Grid(T[,])
Creates a new grid based on an existing array.
protected Grid(T[,] data)
Parameters
data
T[,]Used as the internal array (no defensive copy). Do not modify once passing in!
Fields
Data
The internal array containing the values.
protected readonly T[,] Data
Field Value
- T[,]
Properties
Height
The height of the grid (number of values along the Y axis).
public int Height { get; }
Property Value
this[int, int]
public virtual T this[int x, int y] { get; set; }
Parameters
Property Value
- T
Width
The width of the grid (number of values along the X axis).
public int Width { get; }
Property Value
Methods
ClampedRead(int, int)
Reads a value in the grid and automatically clamps out of bound values of x
or y
.
public T ClampedRead(int x, int y)
Parameters
Returns
- T
GenerateBitmap()
Generates a bitmap representation of the grid.
public abstract Bitmap GenerateBitmap()
Returns
Save(Stream)
Saves the grid to a PNG stream.
public void Save(Stream stream)
Parameters
stream
Stream
Save(string)
Saves the grid to a PNG file.
public void Save(string path)
Parameters
path
string