ICanvasResourceCreator Interface |
Namespace: Microsoft.Graphics.Canvas
public interface ICanvasResourceCreator
The ICanvasResourceCreator type exposes the following members.
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);