SixelFragment
Namespace: Hex1b.Surfaces
Assembly: Hex1b.dll
Represents a fragment of a sixel image after clipping or occlusion.
public sealed class SixelFragmentInheritance
Object → SixelFragment
Constructors
SixelFragment(SixelData, int, int, PixelRect)
Creates a new sixel fragment.
Parameters:
originalSixel(SixelData): The original sixel data.cellX(Int32): The cell X position for rendering.cellY(Int32): The cell Y position for rendering.pixelRegion(PixelRect): The visible pixel region within the original.
public SixelFragment(SixelData originalSixel, int cellX, int cellY, PixelRect pixelRegion)Properties
CellPosition
Gets the cell position where this fragment should be rendered.
Returns: ValueTuple<Int32, Int32>
public (int X, int Y) CellPosition { get; }IsComplete
Gets whether this fragment represents the complete original sixel (no clipping).
Returns: Boolean
public bool IsComplete { get; }OriginalSixel
Gets the original sixel data this fragment was derived from.
Returns: SixelData
public SixelData OriginalSixel { get; }PixelRegion
Gets the pixel region within the original sixel that this fragment represents.
Returns: PixelRect
public PixelRect PixelRegion { get; }Methods
Complete(SixelData, int, int)
Creates a fragment representing the complete original sixel.
Parameters:
Returns: SixelFragment
public static SixelFragment Complete(SixelData sixel, int cellX, int cellY)GetCellSpan()
Gets the cell span for this fragment using the protocol cell metrics captured by the original Sixel image.
Returns: ValueTuple<Int32, Int32>
The width and height in protocol cells.
public (int Width, int Height) GetCellSpan()GetCellSpan(CellMetrics)
Gets the cell span for this fragment using the protocol cell metrics captured by the original Sixel image.
Parameters:
metrics(CellMetrics): Ignored. Sixel placement metrics are captured by .
Returns: ValueTuple<Int32, Int32>
The width and height in protocol cells.
[Obsolete("Cell metrics are captured by SixelData. Use GetCellSpan().")]
public (int Width, int Height) GetCellSpan(CellMetrics metrics)GetPayload()
Gets the encoded sixel payload for this fragment. For complete fragments, returns the original payload. For cropped fragments, re-encodes the cropped pixels. The result is cached for subsequent calls.
Returns: String
The sixel payload string, or null if encoding fails.
public string? GetPayload()GetPixels()
Gets the cropped pixel buffer for this fragment. The result is cached for subsequent calls.
Returns: SixelPixelBuffer
The cropped pixel buffer, or null if the original cannot be decoded.
public SixelPixelBuffer? GetPixels()Remarks
When a sixel is partially occluded by overlapping content, it may be split into multiple fragments. Each fragment contains the visible portion of the original sixel along with its position.