Skip to content

KgpImageExtensions

Namespace: Hex1b

Assembly: Hex1b.dll

Extension methods for creating and configuring .

csharp
public static class KgpImageExtensions

Inheritance

ObjectKgpImageExtensions

Methods

AboveText(KgpImageWidget)

Sets the z-ordering to above text (image renders on top of text).

Parameters:

Returns: KgpImageWidget

csharp
public static KgpImageWidget AboveText(this KgpImageWidget widget)

BelowText(KgpImageWidget)

Sets the z-ordering to below text (image renders behind text).

Parameters:

Returns: KgpImageWidget

csharp
public static KgpImageWidget BelowText(this KgpImageWidget widget)

Fill(KgpImageWidget)

Scales the image to completely fill the allocated area while preserving the aspect ratio. Excess portions of the source image are cropped.

Parameters:

Returns: KgpImageWidget

csharp
public static KgpImageWidget Fill(this KgpImageWidget widget)

Fit(KgpImageWidget)

Scales the image to fit within the allocated area while preserving the aspect ratio, maximizing one dimension. The image may be smaller than the available space in one dimension. Wrap in to control positioning.

Parameters:

Returns: KgpImageWidget

csharp
public static KgpImageWidget Fit(this KgpImageWidget widget)

KgpImage<TParent>(WidgetContext<TParent>, byte[], int, int, Func<WidgetContext<KgpImageWidget>, Hex1bWidget>, int?, int?)

Creates a with the specified RGBA32 pixel data and fallback builder.

Parameters:

  • ctx (WidgetContext<<TParent>>): The widget context.
  • imageData (Byte[]): Raw RGBA32 pixel data.
  • pixelWidth (Int32): Width of the image in pixels.
  • pixelHeight (Int32): Height of the image in pixels.
  • fallbackBuilder (Func<KgpImageWidget>, Hex1bWidget>): Builds the widget displayed when KGP is not supported.
  • width (Nullable<Int32>): Optional width in character cells.
  • height (Nullable<Int32>): Optional height in character cells.

Returns: KgpImageWidget

A new .

csharp
public static KgpImageWidget KgpImage<TParent>(this WidgetContext<TParent> ctx, byte[] imageData, int pixelWidth, int pixelHeight, Func<WidgetContext<KgpImageWidget>, Hex1bWidget> fallbackBuilder, int? width = null, int? height = null) where TParent : Hex1bWidget

NaturalSize(KgpImageWidget)

Displays the image at its natural pixel-to-cell dimensions without scaling.

Parameters:

Returns: KgpImageWidget

csharp
public static KgpImageWidget NaturalSize(this KgpImageWidget widget)

Stretched(KgpImageWidget)

Stretches the image to fill the allocated area. Aspect ratio is not preserved. This is the default behavior.

Parameters:

Returns: KgpImageWidget

csharp
public static KgpImageWidget Stretched(this KgpImageWidget widget)

WithHeight(KgpImageWidget, int)

Sets the display height in character cells.

Parameters:

Returns: KgpImageWidget

csharp
public static KgpImageWidget WithHeight(this KgpImageWidget widget, int height)

WithStretch(KgpImageWidget, KgpImageStretch)

Sets the image stretch mode.

Parameters:

Returns: KgpImageWidget

csharp
public static KgpImageWidget WithStretch(this KgpImageWidget widget, KgpImageStretch stretch)

WithWidth(KgpImageWidget, int)

Sets the display width in character cells.

Parameters:

Returns: KgpImageWidget

csharp
public static KgpImageWidget WithWidth(this KgpImageWidget widget, int width)

Released under the MIT License.