Click or drag to resize
ICanvasResourceCreator Interface
Represents any object that can create graphics resources. Implemented by CanvasControl, CanvasDevice, and CanvasDrawingSession.

Namespace:  Microsoft.Graphics.Canvas
Assembly:  Microsoft.Graphics.Canvas (in Microsoft.Graphics.Canvas.dll) Version: 0.0.0.0
Syntax
C#
public interface ICanvasResourceCreator

The ICanvasResourceCreator type exposes the following members.

Properties
  NameDescription
Public propertyDevice
The device that will be used to create resources.
Top
Remarks

Many types of graphics resource are attached to a graphics device object. Their constructors take a CanvasDevice parameter, so in order to create such a resource you must first have access to a CanvasDevice.

But what if you don't have a CanvasDevice lying around handy? Much of the time, you will be dealing with a CanvasControl object instead. You can always get a CanvasDevice from a CanvasControl, so you could create resources like this:

var brush = new CanvasSolidColorBrush(canvasControl.Device, Colors.OliveDrab);

but it soon gets annoying having to keep typing ".Device" all over the place!

For those of us with less patience, ICanvasResourceCreator allows resource constructors to accept either a CanvasDevice OR a CanvasControl, so we can call them more conveniently:

var brush = new CanvasSolidColorBrush(canvasControl, Colors.MistyRose);
See Also