Click or drag to resize
AB4D logo

BitmapRenderingRenderToBitmap(FrameworkElement, Brush, Int32, RenderTargetBitmap) Method

Renders FrameworkElement specified with objectToRender to bitmap with specified backgroundBrush and dpi. The size of the created bitmap is the same as the size of the objectToRender.

Namespace: Ab3d.Utilities
Assembly: Ab3d.PowerToys (in Ab3d.PowerToys.dll) Version: 11.1.8864.1045
Syntax
C#
public static RenderTargetBitmap RenderToBitmap(
	FrameworkElement objectToRender,
	Brush backgroundBrush = null,
	int dpi = 96,
	RenderTargetBitmap renderTargetBitmapToReuse = null
)

Parameters

objectToRender  FrameworkElement
FrameworkElement to render
backgroundBrush  Brush  (Optional)
brush used for background or null to have no background. Default value is null.
dpi  Int32  (Optional)
DPI setting for the rendered bitmap. Default value is 96
renderTargetBitmapToReuse  RenderTargetBitmap  (Optional)
when not null and when its size is the same as the size of objectToRender, then the renderTargetBitmapToReuse is cleared and used again to improve memory usage.

Return Value

RenderTargetBitmap
RenderTargetBitmap
See Also