Table of Contents

Class IndexedImageFrame<TPixel>

Namespace
SixLabors.ImageSharp
Assembly
SixLabors.ImageSharp.dll

A pixel-specific image frame where each pixel buffer value represents an index in a color palette.

public sealed class IndexedImageFrame<TPixel> : IDisposable where TPixel : unmanaged, IPixel<TPixel>

Type Parameters

TPixel

The pixel format.

Inheritance
IndexedImageFrame<TPixel>
Implements
Inherited Members

Constructors

IndexedImageFrame(Configuration, int, int, ReadOnlyMemory<TPixel>)

Initializes a new instance of the IndexedImageFrame<TPixel> class.

public IndexedImageFrame(Configuration configuration, int width, int height, ReadOnlyMemory<TPixel> palette)

Parameters

configuration Configuration

The configuration which allows altering default behavior or extending the library.

width int

The frame width.

height int

The frame height.

palette ReadOnlyMemory<TPixel>

The color palette.

Properties

Configuration

Gets the configuration which allows altering default behavior or extending the library.

public Configuration Configuration { get; }

Property Value

Configuration

Height

Gets the height of this IndexedImageFrame<TPixel>.

public int Height { get; }

Property Value

int

Palette

Gets the color palette of this IndexedImageFrame<TPixel>.

public ReadOnlyMemory<TPixel> Palette { get; }

Property Value

ReadOnlyMemory<TPixel>

Width

Gets the width of this IndexedImageFrame<TPixel>.

public int Width { get; }

Property Value

int

Methods

DangerousGetRowSpan(int)

Gets the representation of the pixels as a ReadOnlySpan<T> of contiguous memory at row rowIndex beginning from the first pixel on that row.

WARNING: Disposing or leaking the underlying IndexedImageFrame<TPixel> while still working with it's Span<T> might lead to memory corruption.

public ReadOnlySpan<byte> DangerousGetRowSpan(int rowIndex)

Parameters

rowIndex int

The row index in the pixel buffer.

Returns

ReadOnlySpan<byte>

The pixel row as a ReadOnlySpan<T>.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

GetWritablePixelRowSpanUnsafe(int)

Gets the representation of the pixels as a Span<T> of contiguous memory at row rowIndex beginning from the first pixel on that row.

Note: Values written to this span are not sanitized against the palette length. Care should be taken during assignment to prevent out-of-bounds errors.

public Span<byte> GetWritablePixelRowSpanUnsafe(int rowIndex)

Parameters

rowIndex int

The row index in the pixel buffer.

Returns

Span<byte>

The pixel row as a Span<T>.