CanvasVirtualImageSource Class |
Namespace: Microsoft.Graphics.Canvas.UI.Xaml
public sealed class CanvasVirtualImageSource : ICanvasResourceCreatorWithDpi, ICanvasResourceCreator
The CanvasVirtualImageSource type exposes the following members.
Name | Description | |
---|---|---|
CanvasVirtualImageSource(ICanvasResourceCreatorWithDpi, Size) | Initializes a new instance of the CanvasVirtualImageSource class. | |
CanvasVirtualImageSource(ICanvasResourceCreatorWithDpi, Single, Single) | Initializes a new instance of the CanvasVirtualImageSource class. | |
CanvasVirtualImageSource(ICanvasResourceCreator, Single, Single, Single) | Initializes a new instance of the CanvasVirtualImageSource class. | |
CanvasVirtualImageSource(ICanvasResourceCreator, Single, Single, Single, CanvasAlphaMode) | Initializes a new instance of the CanvasVirtualImageSource class. |
Name | Description | |
---|---|---|
AlphaMode | Returns the alpha mode for this image source that was passed in
to the constructor. | |
Device | Gets the device used by this image source. | |
Dpi | Gets the dots-per-inch (DPI) of this image source. | |
Size | Gets the size of the image source, in device independent pixels (DIPs). | |
SizeInPixels | Gets the size of the image source, in pixels. | |
Source | Gets the VirtualSurfaceImageSource wrapped by this object. |
Name | Description | |
---|---|---|
ConvertDipsToPixels | Converts units from device independent pixels (DIPs) to physical pixels based on the DPI of this image source. | |
ConvertPixelsToDips | Converts units from physical pixels to device independent pixels (DIPs) based on the DPI of this image source. | |
CreateDrawingSession | Returns a new drawing session for updating a region of the image source. | |
Invalidate | Marks the entire image as needing to be redrawn. | |
Invalidate(Rect) | Marks a region of the image as needing to be redrawn. | |
RaiseRegionsInvalidatedIfAny | Raises RegionsInvalidated if there are any invalid regions. | |
Recreate | Recreates the underlying image source associating it with a different CanvasDevice. | |
Resize(Size) | Resizes the virtual image. | |
Resize(Single, Single) | Resizes the virtual image. | |
Resize(Single, Single, Single) | Resizes the virtual image and possibly changes the DPI. | |
ResumeDrawingSession | Resumes a previously suspended drawing session. | |
SuspendDrawingSession | Suspends a drawing session so that it may be resumed on another thread. |
Name | Description | |
---|---|---|
RegionsInvalidated | Occurs when a region of the image needs redrawing. |
A CanvasVirtualImageSource can be sized much larger than the largest image that Win2D can render to. CanvasVirtualImageSource provides events to indicate when regions of the image need to be redrawn.
var imageSource = new CanvasVirtualImageSource(canvasDevice, width, height, dpi); imageControl.Source = imageSource.Source; imageSource.RegionsInvalidated += ImageSource_RegionsInvalidated; private void ImageSource_RegionsInvalidated(CanvasVirtualImageSource sender, CanvasRegionsInvalidatedEventArgs args) { foreach (var region in args.InvalidatedRegions) { using (var ds = sender.CreateDrawingSession(clearColor, region)) { // drawing commands } } }