Class NibbleGrid
- Namespace
- OmegaEngine.Foundation.Geometry
- Assembly
- OmegaEngine.Foundation.dll
A 2D grid of nibble (half a byte / 4 bits) values that can be stored in 16 colors PNG files.
public class NibbleGrid : Grid<byte>
- Inheritance
-
NibbleGrid
- Inherited Members
- Extension Methods
Constructors
NibbleGrid(byte[,])
Creates a new grid based on an existing array.
public NibbleGrid(byte[,] data)
Parameters
data
byte[,]Used as the internal array (no defensive copy). Do not modify once passing in!
NibbleGrid(int, int)
Creates a new empty grid.
public NibbleGrid(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).
Properties
this[int, int]
Gets or sets a value in the grid.
public override byte this[int x, int y] { get; set; }
Parameters
Property Value
Exceptions
- IndexOutOfRangeException
x
ory
are out of bounds.- ArgumentOutOfRangeException
A value larger than 15 is set.
Methods
GenerateBitmap()
Generates a bitmap representation of the grid.
public override Bitmap GenerateBitmap()
Returns
Load(Stream)
Loads a grid from a PNG stream.
public static NibbleGrid Load(Stream stream)
Parameters
stream
Stream
Returns
Exceptions
- ArgumentOutOfRangeException
Any of the colors in the imag is not part of the classic 16 colors palette.