Class ImageControl
- Namespace
- SharpConsoleUI.Controls
- Assembly
- SharpConsoleUI.dll
Displays a PixelBuffer as a half-block image in a console window. Each character cell represents 2 vertical pixels.
public class ImageControl : BaseControl, IWindowControl, IDisposable, IDOMPaintable, INotifyPropertyChanged
- Inheritance
-
ImageControl
- Implements
- Inherited Members
- Extension Methods
Properties
ContentWidth
Gets the minimum width needed to display the control's content, including margins. Returns null if width cannot be determined. This is calculated based on content (text length, child controls, etc.) and represents the natural/intrinsic size.
public override int? ContentWidth { get; }
Property Value
- int?
ScaleMode
How the image scales to fit available space.
public ImageScaleMode ScaleMode { get; set; }
Property Value
Source
The pixel buffer to render as an image.
public PixelBuffer? Source { get; set; }
Property Value
Methods
GetLogicalContentSize()
Gets the logical size of the control's content without rendering.
public override Size GetLogicalContentSize()
Returns
- Size
The size representing the content's natural dimensions.
MeasureDOM(LayoutConstraints)
Measures the control's desired size given the available constraints.
public override LayoutSize MeasureDOM(LayoutConstraints constraints)
Parameters
constraintsLayoutConstraintsThe layout constraints (min/max width/height).
Returns
- LayoutSize
The desired size of the control.
PaintDOM(CharacterBuffer, LayoutRect, LayoutRect, Color, Color)
Paints the control's content directly to a CharacterBuffer.
public override void PaintDOM(CharacterBuffer buffer, LayoutRect bounds, LayoutRect clipRect, Color defaultForeground, Color defaultBackground)
Parameters
bufferCharacterBufferThe buffer to paint to.
boundsLayoutRectThe absolute bounds where the control should paint.
clipRectLayoutRectThe clipping rectangle (visible area).
defaultForegroundColorThe default foreground color from the container.
defaultBackgroundColorThe default background color from the container.