Class PngSink
An ICliRenderSink that captures TigerCli text segments into a fixed-size terminal
grid and materializes the result as a PNG image.
public sealed class PngSink : ICliRenderSink
- Inheritance
-
PngSink
- Implements
- Inherited Members
Remarks
The sink exposes the configured columns and rows through the render-sink width/height properties so
grids can measure against the same dimensions that will be rasterized. Writes are stateful; call
Reset() to reuse an instance for a new frame.
Constructors
PngSink(PngSinkOptions)
Creates a PNG sink using the supplied options.
public PngSink(PngSinkOptions options)
Parameters
optionsPngSinkOptions
Exceptions
- ArgumentNullException
optionsis null.- ArgumentOutOfRangeException
- A configured dimension or font size is not positive.
Properties
MaxHeight
Hard height constraint reported to grid measurement, or
null when unbounded.public int? MaxHeight { get; }
Property Value
- int?
MaxWidth
Hard width constraint reported to grid measurement, or
null when unbounded.public int? MaxWidth { get; }
Property Value
- int?
SoftMaxHeight
Soft height constraint reported to grid measurement, or
null when unbounded.public int? SoftMaxHeight { get; }
Property Value
- int?
SoftMaxWidth
Soft width constraint reported to grid measurement, or
null when unbounded.public int? SoftMaxWidth { get; }
Property Value
- int?
WindowTitle
The current sanitized window title, from options or the latest SetWindowTitle(string) call.
public string? WindowTitle { get; }
Property Value
Methods
Flush()
Flushes buffered output.
public void Flush()
NewLine()
Writes a line break.
public void NewLine()
Reset()
Resets sink state.
public void Reset()
Save(Stream)
Renders the captured grid as PNG and writes it to
stream.public void Save(Stream stream)
Parameters
streamStream
Exceptions
- ArgumentNullException
streamis null.
SetWindowTitle(string)
Sets the terminal/window title when the sink supports terminal controls; default is no-op.
public void SetWindowTitle(string title)
Parameters
titlestring
ToBytes()
Renders the captured grid to PNG bytes.
public byte[] ToBytes()
Returns
- byte[]
Write(CliTextSegment)
Writes a styled text segment.
public void Write(CliTextSegment segment)
Parameters
segmentCliTextSegment