Skip to main content

RenderTargetBitmap Class

Definition

Assembly:Avalonia.Base
Package:Avalonia

A bitmap that holds the rendering of a Avalonia.Visual.

public class RenderTargetBitmap

Inheritance: object -> Bitmap -> RenderTargetBitmap

Constructors

NameDescription
RenderTargetBitmap (2 overloads)Initializes a new instance of the Avalonia.Media.Imaging.RenderTargetBitmap class.

RenderTargetBitmap overloads

RenderTargetBitmap Constructor

Initializes a new instance of the Avalonia.Media.Imaging.RenderTargetBitmap class.

public RenderTargetBitmap(Avalonia.PixelSize pixelSize)
Parameters

pixelSize Avalonia.PixelSize

The size of the bitmap.

RenderTargetBitmap Constructor

Initializes a new instance of the Avalonia.Media.Imaging.RenderTargetBitmap class.

public RenderTargetBitmap(Avalonia.PixelSize pixelSize, Avalonia.Vector dpi)
Parameters

pixelSize Avalonia.PixelSize

The size of the bitmap in device pixels.

dpi Avalonia.Vector

The DPI of the bitmap.

Methods

NameDescription
CreateDrawingContext (2 overloads)Creates a Avalonia.Media.DrawingContext for drawing to the Avalonia.Media.Imaging.RenderTargetBitmap. Clears the current image data to transparent.
DisposeNo summary available.
RenderRenders a visual to the Avalonia.Media.Imaging.RenderTargetBitmap.
CopyPixels (2 overloads)Inherited from Bitmap.
CreateScaledBitmapCreates a Bitmap scaled to a specified size from the current bitmap. Inherited from Bitmap.
DecodeToHeightLoads a Bitmap from a stream and decodes at the desired height. Aspect ratio is maintained. This is more efficient than loading and then resizing. Inherited from Bitmap.
DecodeToWidthLoads a Bitmap from a stream and decodes at the desired width. Aspect ratio is maintained. This is more efficient than loading and then resizing. Inherited from Bitmap.
Save (2 overloads)Inherited from Bitmap.

CreateDrawingContext overloads

CreateDrawingContext Method

Creates a Avalonia.Media.DrawingContext for drawing to the Avalonia.Media.Imaging.RenderTargetBitmap. Clears the current image data to transparent.

public Avalonia.Media.DrawingContext CreateDrawingContext()
Returns

Avalonia.Media.DrawingContext

The drawing context.

CreateDrawingContext Method

Creates a Avalonia.Media.DrawingContext for drawing to the Avalonia.Media.Imaging.RenderTargetBitmap.

public Avalonia.Media.DrawingContext CreateDrawingContext(bool clear)
Parameters

clear bool

If true, clears the current image data to transparent, if false, leaves the image data unchanged.

Returns

Avalonia.Media.DrawingContext

The drawing context.

Dispose Method

public void Dispose()

Render Method

Renders a visual to the Avalonia.Media.Imaging.RenderTargetBitmap.

public void Render(Avalonia.Visual visual)

Parameters

visual Avalonia.Visual

The visual to render.

Properties

NameDescription
AlphaFormatInherited from Bitmap.
DpiInherited from Bitmap.
FormatInherited from Bitmap.
PixelSizeInherited from Bitmap.
SizeGets the size of the image, in device independent pixels. Inherited from Bitmap.