SixelPixelBuffer
Namespace: Hex1b.Surfaces
Assembly: Hex1b.dll
Represents a decoded sixel image as RGBA pixels.
public sealed class SixelPixelBufferInheritance
Object → SixelPixelBuffer
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.
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:
public SixelPixelBuffer(int width, int height)Properties
Height
Gets the height of the image in pixels.
Returns: Int32
public int Height { get; }this[int, int]
Gets or sets the pixel at the specified position.
Parameters:
Returns: Rgba32
public Rgba32 this[int x, int y] { get; set; }Width
Gets the width of the image in pixels.
Returns: Int32
public int Width { get; }Methods
AsSpan()
Gets a span over the pixel data.
Returns: ReadOnlySpan<Rgba32>
public ReadOnlySpan<Rgba32> AsSpan()ComputeVisibleRegions(IEnumerable<PixelRect>)
Computes the visible regions of this buffer after subtracting occluding rectangles.
Parameters:
occlusions(IEnumerable<PixelRect>): Rectangles that occlude (hide) portions of this buffer.
Returns: IReadOnlyList<PixelRect>
List of visible regions that remain after subtracting occlusions.
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.
public SixelPixelBuffer Crop(int x, int y, int width, int height)Crop(PixelRect)
Creates a cropped copy using a PixelRect.
Parameters:
rect(PixelRect): The region to crop.
Returns: SixelPixelBuffer
A new buffer containing the cropped region.
public SixelPixelBuffer Crop(PixelRect rect)Fragment(IEnumerable<PixelRect>)
Fragments this buffer into multiple cropped buffers based on the specified regions.
Parameters:
regions(IEnumerable<PixelRect>): The regions to extract (in local coordinates of this buffer).
Returns: IReadOnlyList<PixelRect, SixelPixelBuffer>>
A list of tuples containing the region location and the cropped buffer. Empty regions are skipped.
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
public Rgba32 GetPixelOrTransparent(int x, int y)GetRow(int)
Gets a span over a single row.
Parameters:
y(Int32):
Returns: ReadOnlySpan<Rgba32>
public ReadOnlySpan<Rgba32> GetRow(int y)