Hex1bRenderContext
Namespace: Hex1b
Assembly: Hex1b.dll
public class Hex1bRenderContextInheritance
Object → Hex1bRenderContext
Constructors
Hex1bRenderContext(Hex1bTheme?)
Protected constructor for derived classes that don't use an adapter.
Parameters:
theme(Hex1bTheme):
protected Hex1bRenderContext(Hex1bTheme? theme)Hex1bRenderContext(IHex1bAppTerminalWorkloadAdapter, Hex1bTheme?)
Parameters:
adapter(IHex1bAppTerminalWorkloadAdapter):theme(Hex1bTheme):
public Hex1bRenderContext(IHex1bAppTerminalWorkloadAdapter adapter, Hex1bTheme? theme = null)Properties
AmbientBackground
The ambient background color established by a parent container (e.g., a window or a highlighted table row). Leaf nodes like TextBlockNode should apply this background when rendering content so that characters written on top of a pre-painted region preserve the parent's background color. Container nodes that paint a background should set this before rendering their children and restore the previous value afterwards.
Returns: Hex1bColor
public Hex1bColor AmbientBackground { get; set; }Capabilities
Terminal capabilities (Sixel support, colors, etc.).
Returns: TerminalCapabilities
public virtual TerminalCapabilities Capabilities { get; }CurrentLayoutProvider
The current layout provider in scope. Child nodes can use this to query whether characters should be rendered (for clipping support). Layout providers should consult their ParentLayoutProvider to ensure proper nested clipping.
Returns: ILayoutProvider
public ILayoutProvider? CurrentLayoutProvider { get; set; }Height
Returns: Int32
public virtual int Height { get; }KgpImageEpoch
Logical KGP image epoch. Incrementing this forces the same pixel content to map to a different Kitty image ID on subsequent renders.
Returns: UInt32
public uint KgpImageEpoch { get; set; }MouseX
The current mouse X position (0-based column), or -1 if mouse is not tracked.
Returns: Int32
public int MouseX { get; set; }MouseY
The current mouse Y position (0-based row), or -1 if mouse is not tracked.
Returns: Int32
public int MouseY { get; set; }Theme
Returns: Hex1bTheme
public Hex1bTheme Theme { get; set; }Width
Returns: Int32
public virtual int Width { get; }Methods
BeginFrame()
Signals the beginning of a render frame to the presentation filter pipeline. When frame buffering is enabled, updates are accumulated until is called. Also enables Synchronized Update Mode for terminals that support it (DEC 2026).
public virtual void BeginFrame()Clear()
public virtual void Clear()ClearRegion(Rect)
Clears a rectangular region by writing spaces. Used for dirty region clearing to avoid full-screen flicker. Respects global background color from the theme if set.
Parameters:
rect(Rect): The rectangle to clear.
public virtual void ClearRegion(Rect rect)ComputeKgpImageId(byte[])
Maps image content to a Kitty image ID, salted by so the same bytes can be reintroduced under a fresh ID after a terminal resize.
Parameters:
contentHash(Byte[]):
Returns: UInt32
protected uint ComputeKgpImageId(byte[] contentHash)EndFrame()
Signals the end of a render frame. The presentation filter pipeline will emit only the net changes between this frame and the previous committed frame. Also ends Synchronized Update Mode, triggering atomic render on supported terminals.
public virtual void EndFrame()EnterAlternateScreen()
public virtual void EnterAlternateScreen()ExitAlternateScreen()
public virtual void ExitAlternateScreen()RenderChild(Hex1bNode)
Renders a child node. Container nodes should call this instead of child.Render(context) to enable the framework to apply optimizations like caching.
Parameters:
child(Hex1bNode): The child node to render.
public virtual void RenderChild(Hex1bNode child)SetCursorPosition(int, int)
Parameters:
public virtual void SetCursorPosition(int left, int top)ShouldRenderAt(int, int)
Checks if a position should be rendered based on the current layout provider. If no layout provider is active, returns true.
Parameters:
Returns: Boolean
public virtual bool ShouldRenderAt(int x, int y)Write(string)
Parameters:
text(String):
public virtual void Write(string text)WriteClipped(int, int, string)
Writes text at the specified position, respecting the current layout provider's clipping. If no layout provider is active, the text is written as-is.
Parameters:
x(Int32): The X position to start writing.y(Int32): The Y position to write at.text(String): The text to write.
public virtual void WriteClipped(int x, int y, string text)WriteKgp(byte[], int, int, int, int, KgpZOrder, int, int, int, int)
Writes a KGP image at the current cursor position. The base implementation writes raw APC transmit and placement sequences directly. Surface-backed render contexts override this to populate surface cells with structured for compositing and diff-based emission.
Parameters:
imageData(Byte[]): Raw RGBA32 pixel data.pixelWidth(Int32): Source image width in pixels.pixelHeight(Int32): Source image height in pixels.cellWidth(Int32): Display width in terminal columns.cellHeight(Int32): Display height in terminal rows.zOrder(KgpZOrder): Stacking order relative to text.clipX(Int32): Pixel X offset into the source image for clipping (0 = no clip).clipY(Int32): Pixel Y offset into the source image for clipping (0 = no clip).clipW(Int32): Pixel width of the visible source region (0 = full width).clipH(Int32): Pixel height of the visible source region (0 = full height).
public virtual void WriteKgp(byte[] imageData, int pixelWidth, int pixelHeight, int cellWidth, int cellHeight, KgpZOrder zOrder, int clipX = 0, int clipY = 0, int clipW = 0, int clipH = 0)