Class PixelPlane<TPixel>
- Namespace
- Egami
- Assembly
- Egami.dll
A width × height grid of pixels, stored row by row. A row is always one contiguous span, but the plane as a whole may be split into several blocks of whole rows. Planes belong to the raster or operation that hands them out, which returns their memory; user code reads and writes them but never frees them.
public sealed class PixelPlane<TPixel> where TPixel : unmanaged, IPixelType<TPixel>
Type Parameters
TPixelThe pixel type.
- Inheritance
-
PixelPlane<TPixel>
- Inherited Members
Examples
PixelPlane<Rgba8> plane = image.Frames[0].Plane;
if (plane.TryGetContiguous(out Span<Rgba8> all))
{
all.Fill(Rgba8.White); // one Span over every pixel when the rows are stored back to back
}
else
{
for (int y = 0; y < plane.Height; y++)
{
plane.Row(y).Fill(Rgba8.White);
}
}
Remarks
Spans returned by Row(int) and TryGetContiguous(out Span<TPixel>) point into the plane's memory. Do not keep them after the raster is disposed, or after an operation that changes its size, which gives the frame a new plane.
Properties
Height
Gets the height in pixels.
public int Height { get; }
Property Value
Width
Gets the width in pixels.
public int Width { get; }
Property Value
Methods
Row(int)
Returns one row of pixels.
public Span<TPixel> Row(int y)
Parameters
Returns
Exceptions
- ArgumentOutOfRangeException
yis outside the plane.- ObjectDisposedException
The plane has been disposed.
TryGetContiguous(out Span<TPixel>)
Gets all pixels as one span, if the plane is one block with no gap between rows.
public bool TryGetContiguous(out Span<TPixel> pixels)
Parameters
Returns
Exceptions
- ObjectDisposedException
The plane has been disposed.