Skip to content

SixelPixelBuffer

Namespace: Hex1b.Surfaces

Assembly: Hex1b.dll

Represents a decoded sixel image as RGBA pixels.

csharp
public sealed class SixelPixelBuffer

Inheritance

ObjectSixelPixelBuffer

Constructors

SixelPixelBuffer(int, int, Rgba32[])

Creates a pixel buffer from existing pixel data.

Parameters:

  • width (Int32): Image width.
  • height (Int32): Image height.
  • pixels (Rgba32[]): Pixel data in row-major order.
csharp
public SixelPixelBuffer(int width, int height, Rgba32[] pixels)

SixelPixelBuffer(int, int)

Creates a new pixel buffer with the specified dimensions. All pixels are initialized to transparent.

Parameters:

csharp
public SixelPixelBuffer(int width, int height)

Properties

Height

Gets the height of the image in pixels.

Returns: Int32

csharp
public int Height { get; }

this[int, int]

Gets or sets the pixel at the specified position.

Parameters:

Returns: Rgba32

csharp
public Rgba32 this[int x, int y] { get; set; }

Width

Gets the width of the image in pixels.

Returns: Int32

csharp
public int Width { get; }

Methods

AsSpan()

Gets a span over the pixel data.

Returns: ReadOnlySpan<Rgba32>

csharp
public ReadOnlySpan<Rgba32> AsSpan()

ComputeVisibleRegions(IEnumerable<PixelRect>)

Computes the visible regions of this buffer after subtracting occluding rectangles.

Parameters:

Returns: IReadOnlyList<PixelRect>

List of visible regions that remain after subtracting occlusions.

csharp
public IReadOnlyList<PixelRect> ComputeVisibleRegions(IEnumerable<PixelRect> occlusions)

Crop(int, int, int, int)

Creates a cropped copy of this buffer.

Parameters:

  • x (Int32): Left edge of crop region.
  • y (Int32): Top edge of crop region.
  • width (Int32): Width of crop region.
  • height (Int32): Height of crop region.

Returns: SixelPixelBuffer

A new buffer containing the cropped region.

csharp
public SixelPixelBuffer Crop(int x, int y, int width, int height)

Crop(PixelRect)

Creates a cropped copy using a PixelRect.

Parameters:

Returns: SixelPixelBuffer

A new buffer containing the cropped region.

csharp
public SixelPixelBuffer Crop(PixelRect rect)

Fragment(IEnumerable<PixelRect>)

Fragments this buffer into multiple cropped buffers based on the specified regions.

Parameters:

Returns: IReadOnlyList<PixelRect, SixelPixelBuffer>>

A list of tuples containing the region location and the cropped buffer. Empty regions are skipped.

csharp
public IReadOnlyList<(PixelRect Region, SixelPixelBuffer Buffer)> Fragment(IEnumerable<PixelRect> regions)

GetPixelOrTransparent(int, int)

Gets the pixel at the specified position, or transparent if out of bounds.

Parameters:

Returns: Rgba32

csharp
public Rgba32 GetPixelOrTransparent(int x, int y)

GetRow(int)

Gets a span over a single row.

Parameters:

Returns: ReadOnlySpan<Rgba32>

csharp
public ReadOnlySpan<Rgba32> GetRow(int y)

Released under the MIT License.