Click or drag to resize
CanvasRenderTarget Class
A rendertarget is a bitmap that can be drawn onto.
Inheritance Hierarchy

Namespace:  Microsoft.Graphics.Canvas
Assembly:  Microsoft.Graphics.Canvas (in Microsoft.Graphics.Canvas.dll) Version: 0.0.0.0
Syntax
C#
public sealed class CanvasRenderTarget : CanvasBitmap, 
	ICanvasImage, IGraphicsEffectSource, IDisposable, IDirect3DSurface, ICanvasResourceCreatorWithDpi, 
	ICanvasResourceCreator

The CanvasRenderTarget type exposes the following members.

Constructors
  NameDescription
Public methodCanvasRenderTarget(ICanvasResourceCreatorWithDpi, Size)
Initializes a new instance of the CanvasRenderTarget class.
Public methodCanvasRenderTarget(ICanvasResourceCreatorWithDpi, Single, Single)
Initializes a new instance of the CanvasRenderTarget class.
Public methodCanvasRenderTarget(ICanvasResourceCreator, Single, Single, Single)
Initializes a new instance of the CanvasRenderTarget class.
Public methodCanvasRenderTarget(ICanvasResourceCreator, Single, Single, Single, DirectXPixelFormat, CanvasAlphaMode)
Initializes a new instance of the CanvasRenderTarget class.
Top
Properties
  NameDescription
Public propertyAlphaMode
Gets the alpha mode of this bitmap.
(Inherited from CanvasBitmap.)
Public propertyBounds
Gets the bounds of the bitmap, in device independent pixels (DIPs).
(Inherited from CanvasBitmap.)
Public propertyDescription
The description of this bitmap's underlying surface.
(Inherited from CanvasBitmap.)
Public propertyDevice
The device associated with this bitmap.
(Inherited from CanvasBitmap.)
Public propertyDpi
Gets the dots-per-inch (DPI) of this bitmap.
(Inherited from CanvasBitmap.)
Public propertyFormat
Gets the pixel format of this bitmap.
(Inherited from CanvasBitmap.)
Public propertySize
Gets the size of the bitmap, in device independent pixels (DIPs).
(Inherited from CanvasBitmap.)
Public propertySizeInPixels
Gets the size of the bitmap, in pixels.
(Inherited from CanvasBitmap.)
Top
Methods
  NameDescription
Public methodConvertDipsToPixels
Converts units from device independent pixels (DIPs) to physical pixels based on the DPI of this bitmap.
(Inherited from CanvasBitmap.)
Public methodConvertPixelsToDips
Converts units from physical pixels to device independent pixels (DIPs) based on the DPI of this bitmap.
(Inherited from CanvasBitmap.)
Public methodCopyPixelsFromBitmap(CanvasBitmap)
Copies the entire bitmap specified into this bitmap, at position (0, 0).
(Inherited from CanvasBitmap.)
Public methodCopyPixelsFromBitmap(CanvasBitmap, Int32, Int32)
Copies the entire bitmap specified into this bitmap at the point specified.
(Inherited from CanvasBitmap.)
Public methodCopyPixelsFromBitmap(CanvasBitmap, Int32, Int32, Int32, Int32, Int32, Int32)
Copies the specified region of a bitmap into this bitmap, at the point specified.
(Inherited from CanvasBitmap.)
Public methodCode exampleCreateDrawingSession
Returns a new drawing session. The drawing session draws onto the CanvasRenderTarget.
Public methodStatic memberCreateFromDirect3D11Surface(ICanvasResourceCreator, IDirect3DSurface)
Creates a CanvasRenderTarget from an existing Direct3D graphics surface, using premultiplied alpha and default (96) DPI.
Public methodStatic memberCreateFromDirect3D11Surface(ICanvasResourceCreator, IDirect3DSurface, Single)
Creates a CanvasRenderTarget from an existing Direct3D graphics surface, using the specified DPI and premultiplied alpha.
Public methodStatic memberCreateFromDirect3D11Surface(ICanvasResourceCreator, IDirect3DSurface, Single, CanvasAlphaMode)
Creates a CanvasRenderTarget from an existing Direct3D graphics surface, using the specified DPI and alpha behavior.
Public methodDispose
Releases all resources used by the CanvasBitmap.
(Inherited from CanvasBitmap.)
Public methodGetBounds(ICanvasResourceCreator)
Retrieves the bounds of this CanvasBitmap.
(Inherited from CanvasBitmap.)
Public methodGetBounds(ICanvasResourceCreator, Matrix3x2)
Retrieves the bounds of this CanvasBitmap.
(Inherited from CanvasBitmap.)
Public methodGetPixelBytes
Returns an array of raw byte data for the entire bitmap.
(Inherited from CanvasBitmap.)
Public methodGetPixelBytes(IBuffer)
Copies raw byte data for the entire bitmap into the specified buffer.
(Inherited from CanvasBitmap.)
Public methodGetPixelBytes(Int32, Int32, Int32, Int32)
Returns an array of raw byte data for a subregion of the bitmap.
(Inherited from CanvasBitmap.)
Public methodGetPixelBytes(IBuffer, Int32, Int32, Int32, Int32)
Copies raw byte data for a subregion of the bitmap into the specified buffer.
(Inherited from CanvasBitmap.)
Public methodGetPixelColors
Returns an array of color data for the entire bitmap.
(Inherited from CanvasBitmap.)
Public methodGetPixelColors(Int32, Int32, Int32, Int32)
Returns an array of color data for a subregion of the bitmap.
(Inherited from CanvasBitmap.)
Public methodSaveAsync(String)
Saves the entire bitmap to a file with the specified file name, using a default quality level of 0.9 and CanvasBitmapFileFormat.Auto.
(Inherited from CanvasBitmap.)
Public methodSaveAsync(String, CanvasBitmapFileFormat)
Saves the entire bitmap to a file with the specified file name and file format, and a default quality level of 0.9.
(Inherited from CanvasBitmap.)
Public methodSaveAsync(IRandomAccessStream, CanvasBitmapFileFormat)
Saves the entire bitmap to the specified stream with the specified file format, using a default quality level of 0.9.
(Inherited from CanvasBitmap.)
Public methodSaveAsync(String, CanvasBitmapFileFormat, Single)
Saves the entire bitmap to a file with the specified file name and file format, and quality level.
(Inherited from CanvasBitmap.)
Public methodSaveAsync(IRandomAccessStream, CanvasBitmapFileFormat, Single)
Saves the entire bitmap to the specified stream with the specified file format and quality level.
(Inherited from CanvasBitmap.)
Public methodSetPixelBytes(Byte)
Sets the byte data of the bitmap from the specified array.
(Inherited from CanvasBitmap.)
Public methodSetPixelBytes(IBuffer)
Sets the byte data of the bitmap from the specified buffer.
(Inherited from CanvasBitmap.)
Public methodSetPixelBytes(Byte, Int32, Int32, Int32, Int32)
Sets the byte data of a subregion of the bitmap.
(Inherited from CanvasBitmap.)
Public methodSetPixelBytes(IBuffer, Int32, Int32, Int32, Int32)
Sets the byte data of a subregion of the bitmap from the specified buffer.
(Inherited from CanvasBitmap.)
Public methodSetPixelColors(Color)
Sets the color data of the bitmap from the specified array.
(Inherited from CanvasBitmap.)
Public methodSetPixelColors(Color, Int32, Int32, Int32, Int32)
Sets the color data for a subregion of the bitmap from the specified array.
(Inherited from CanvasBitmap.)
Top
Remarks

For more information about how to use CanvasRenderTarget, see "Offscreen drawing".

When using Direct2D interop, this Win2D class corresponds to an ID2D1Bitmap1 with the D2D1_BITMAP_OPTIONS_TARGET flag.

See Also