Skip to content

KgpCellAccess ​

Namespace: Hex1b.Surfaces

Assembly: Hex1b.dll

Provides read-only access to KGP image metadata at a specific cell position.

csharp
public readonly struct KgpCellAccess

Properties ​

CellOffsetX ​

Gets the cell X offset within the KGP image (0 = leftmost cell of the image).

Returns: Int32

csharp
public int CellOffsetX { get; }

CellOffsetY ​

Gets the cell Y offset within the KGP image (0 = topmost cell of the image).

Returns: Int32

csharp
public int CellOffsetY { get; }

Data ​

Gets the underlying KGP cell data, or null if this accessor is invalid.

Returns: KgpCellData

csharp
public KgpCellData? Data { get; }

HeightInCells ​

Gets the height of the KGP image in terminal rows.

Returns: Int32

csharp
public int HeightInCells { get; }

ImageId ​

Gets the KGP image ID.

Returns: UInt32

csharp
public uint ImageId { get; }

IsAnchor ​

Gets whether this cell is at the anchor position (top-left) of the KGP image.

Returns: Boolean

csharp
public bool IsAnchor { get; }

IsValid ​

Gets whether this accessor has valid KGP data.

Returns: Boolean

csharp
public bool IsValid { get; }

SourcePixelHeight ​

Gets the source image height in pixels.

Returns: UInt32

csharp
public uint SourcePixelHeight { get; }

SourcePixelWidth ​

Gets the source image width in pixels.

Returns: UInt32

csharp
public uint SourcePixelWidth { get; }

WidthInCells ​

Gets the width of the KGP image in terminal columns.

Returns: Int32

csharp
public int WidthInCells { get; }

ZIndex ​

Gets the z-index of the KGP placement (negative = below text, positive = above text).

Returns: Int32

csharp
public int ZIndex { get; }

Remarks ​

Unlike , KGP images don't store pixel data in-memory — the pixel data is transmitted to the terminal. This type provides metadata about the KGP image covering a cell position, including the image ID, source dimensions, clip region, and the cell's offset within the image.

This enables computed layers to make decisions based on KGP image presence and position (e.g., tinting text that overlaps a KGP background, or adjusting opacity).

Released under the MIT License.