Skip to content

ComputeContext

Namespace: Hex1b.Surfaces

Assembly: Hex1b.dll

Provides context for computing a cell value during layer resolution.

csharp
public readonly ref struct ComputeContext

Properties

CellMetrics

Gets the cell metrics for pixel/cell conversion.

Returns: CellMetrics

csharp
public CellMetrics CellMetrics { get; }

X

Gets the X position (column) of the cell being computed.

Returns: Int32

csharp
public int X { get; }

Y

Gets the Y position (row) of the cell being computed.

Returns: Int32

csharp
public int Y { get; }

Methods

GetAdjacent(int, int)

Gets a cell from an adjacent position on the same layer.

Parameters:

  • dx (Int32): The X offset from the current position.
  • dy (Int32): The Y offset from the current position.

Returns: SurfaceCell

The cell at the adjacent position, or empty if out of bounds or cyclic.

csharp
public SurfaceCell GetAdjacent(int dx, int dy)

GetAtLayer(int, int)

Gets a cell from an absolute position on the same layer.

Parameters:

  • x (Int32): The X position to query.
  • y (Int32): The Y position to query.

Returns: SurfaceCell

The cell at the specified position, or empty if out of bounds or cyclic.

csharp
public SurfaceCell GetAtLayer(int x, int y)

GetBelow()

Gets the resolved cell from all layers below the current layer at this position.

Returns: SurfaceCell

The composited cell from layers below.

csharp
public SurfaceCell GetBelow()

GetBelowAt(int, int)

Gets the resolved cell from layers below at the specified position.

Parameters:

  • x (Int32): The X position to query.
  • y (Int32): The Y position to query.

Returns: SurfaceCell

The composited cell from layers below at the specified position.

csharp
public SurfaceCell GetBelowAt(int x, int y)

GetKgpBelow()

Gets KGP image information at this cell position from layers below.

Returns: KgpCellAccess

A KGP accessor for the image at this position, or default if none.

csharp
public KgpCellAccess GetKgpBelow()

GetKgpBelowAt(int, int)

Gets KGP image information at a specific cell position from layers below.

Parameters:

  • x (Int32): The X position to query.
  • y (Int32): The Y position to query.

Returns: KgpCellAccess

A KGP accessor for the image at the specified position, or default if none.

csharp
public KgpCellAccess GetKgpBelowAt(int x, int y)

GetSixelBelow()

Gets access to sixel pixel data at this cell position from layers below.

Returns: SixelPixelAccess

A pixel accessor for the sixel at this position.

csharp
public SixelPixelAccess GetSixelBelow()

GetSixelBelowAt(int, int)

Gets access to sixel pixel data at a specific cell position from layers below.

Parameters:

  • x (Int32): The X position to query.
  • y (Int32): The Y position to query.

Returns: SixelPixelAccess

A pixel accessor for the sixel at the specified position.

csharp
public SixelPixelAccess GetSixelBelowAt(int x, int y)

HasKgpBelow()

Checks if there is a KGP image at this position in layers below.

Returns: Boolean

True if a KGP image covers this cell position.

csharp
public bool HasKgpBelow()

HasSixelBelow()

Checks if there is a sixel visible at this position in layers below.

Returns: Boolean

True if a sixel covers this cell position.

csharp
public bool HasSixelBelow()

Remarks

This ref struct is passed to computed cell delegates during or . It provides access to: The position being computedCells from layers below the current layerAdjacent cells on the same layerSixel pixel data from layers belowKGP image data from layers below

The context includes cycle detection - if a computed cell queries another cell that is currently being computed (directly or indirectly), a fallback value is returned to prevent infinite recursion.

Released under the MIT License.