Click or drag to resize
AB4D logo

BitmapRenderingRenderToBitmap Method (FrameworkElement, Brush, Int32, RenderTargetBitmap)

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: 10.1.8147.1045
public static RenderTargetBitmap RenderToBitmap(
	FrameworkElement objectToRender,
	Brush backgroundBrush = null,
	int dpi = 96,
	RenderTargetBitmap renderTargetBitmapToReuse = null


Type: System.WindowsFrameworkElement
FrameworkElement to render
backgroundBrush (Optional)
Type: System.Windows.MediaBrush
brush used for background or null to have no background. Default value is null.
dpi (Optional)
Type: SystemInt32
DPI setting for the rendered bitmap. Default value is 96
renderTargetBitmapToReuse (Optional)
Type: System.Windows.Media.ImagingRenderTargetBitmap
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

Type: RenderTargetBitmap
See Also