Skip to content

KgpImageNode ​

Namespace: Hex1b.Nodes

Assembly: Hex1b.dll

A node that renders KGP (Kitty Graphics Protocol) images if the terminal supports it, otherwise falls back to rendering a fallback node.

csharp
public sealed class KgpImageNode : Hex1bNode

Inheritance ​

Object → Hex1bNode → KgpImageNode

Properties ​

Fallback ​

The fallback node to render if KGP is not supported.

Returns: Hex1bNode

csharp
public Hex1bNode? Fallback { get; set; }

ImageData ​

The raw RGBA32 pixel data for the image.

Returns: Byte[]

csharp
public byte[] ImageData { get; set; }

PixelHeight ​

Height of the source image in pixels.

Returns: Int32

csharp
public int PixelHeight { get; set; }

PixelWidth ​

Width of the source image in pixels.

Returns: Int32

csharp
public int PixelWidth { get; set; }

RequestedHeight ​

Requested height in character cells. If null, computed from pixel dimensions.

Returns: Nullable<Int32>

csharp
public int? RequestedHeight { get; set; }

RequestedWidth ​

Requested width in character cells. If null, computed from pixel dimensions.

Returns: Nullable<Int32>

csharp
public int? RequestedWidth { get; set; }

Stretch ​

How the image is scaled within its allocated cell area.

Returns: KgpImageStretch

csharp
public KgpImageStretch Stretch { get; set; }

ZOrder ​

Z-ordering relative to text content.

Returns: KgpZOrder

csharp
public KgpZOrder ZOrder { get; set; }

Methods ​

ArrangeCore(Rect) ​

Override this method to implement arranging logic for this node. The base implementation saves previous bounds, marks dirty on change, and sets bounds.

Parameters:

csharp
protected override void ArrangeCore(Rect bounds)

GetChildren() ​

Gets the direct children of this node for structural tree traversal. Container nodes should override this to return their children.

Returns: IEnumerable<Hex1bNode>

csharp
public override IEnumerable<Hex1bNode> GetChildren()

GetFocusableNodes() ​

Gets all focusable nodes in this subtree (including this node if focusable).

Returns: IEnumerable<Hex1bNode>

csharp
public override IEnumerable<Hex1bNode> GetFocusableNodes()

MeasureCore(Constraints) ​

Override this method to implement measuring logic for this node.

Parameters:

Returns: Size

csharp
protected override Size MeasureCore(Constraints constraints)

Render(Hex1bRenderContext) ​

Renders the KGP image if the terminal supports it, otherwise renders the fallback content.

Parameters:

csharp
public override void Render(Hex1bRenderContext context)

Released under the MIT License.