CanvasImage Class

Represents a renderable image.
public sealed class CanvasImage : Renderable, IRenderable
Namespace
Spectre.Console
Interfaces
Base Types

Constructors

CanvasImage(ReadOnlySpan<byte>)
Initializes a new instance of the CanvasImage class.
CanvasImage(Stream)
Initializes a new instance of the CanvasImage class.
CanvasImage(string)
Initializes a new instance of the CanvasImage class.

Properties

int Height
Gets the image height.
int? MaxWidth
Gets or sets the render width of the canvas.
int PixelWidth
Gets or sets the render width of the canvas.
IResampler? Resampler
Gets or sets the IResampler that should be used when scaling the image. Defaults to bicubic sampling.
int Width
Gets the image width.

Methods

protected override Measurement Measure(RenderOptions, int)
Measures the renderable object.
protected override IEnumerable<Segment> Render(RenderOptions, int)
Renders the object.

Extension Methods

CanvasImage BicubicResampler()
Uses a bicubic sampler that implements the bicubic kernel algorithm W(x).
CanvasImage BilinearResampler()
Uses a bilinear sampler. This interpolation algorithm can be used where perfect image transformation with pixel matching is impossible, so that one can calculate and assign appropriate intensity values to pixels.
IEnumerable<Segment> GetSegments(IAnsiConsole)
Gets the segments for a renderable using the specified console.
CanvasImage MaxWidth(int?)
Sets the maximum width of the rendered image.
CanvasImage Mutate(Action<IImageProcessingContext>)
Mutates the underlying image.
CanvasImage NearestNeighborResampler()
Uses a Nearest-Neighbour sampler that implements the nearest neighbor algorithm. This uses a very fast, unscaled filter which will select the closest pixel to the new pixels position.
CanvasImage NoMaxWidth()
Disables the maximum width of the rendered image.
CanvasImage PixelWidth(int)
Sets the pixel width.