Click or drag to resize
CanvasVirtualBitmap Class
Loads a bitmap that may be larger than the maximum size of a CanvasBitmap.
Inheritance Hierarchy
SystemObject
  Microsoft.Graphics.CanvasCanvasVirtualBitmap

Namespace:  Microsoft.Graphics.Canvas
Assembly:  Microsoft.Graphics.Canvas (in Microsoft.Graphics.Canvas.dll) Version: 0.0.0.0
Syntax
C#
public sealed class CanvasVirtualBitmap : IDisposable, 
	ICanvasImage, IGraphicsEffectSource

The CanvasVirtualBitmap type exposes the following members.

Properties
  NameDescription
Public propertyBounds
Gets the bounds of the virtual bitmap in device independent pixels (DIPs).
Public propertyDevice
The device associated with this CanvasVirtualBitmap.
Public propertyIsCachedOnDemand
Gets whether or not the current virtual bitmap is cached on demand.
Public propertySize
Gets the size of the bitmap, in device independent pixels (DIPs).
Public propertySizeInPixels
Gets the size of the bitmap, in pixels.
Top
Methods
  NameDescription
Public methodDispose
Releases all resources used by the CanvasVirtualBitmap.
Public methodGetBounds(ICanvasResourceCreator)
Retrieves the bounds of this CanvasVirtualBitmap.
Public methodGetBounds(ICanvasResourceCreator, Matrix3x2)
Retrieves the bounds of this CanvasVirtualBitmap.
Public methodStatic memberLoadAsync(ICanvasResourceCreator, String)
Loads a virtual bitmap from an image file.
Public methodStatic memberLoadAsync(ICanvasResourceCreator, Uri)
Loads a virtual bitmap from a URI.
Public methodStatic memberLoadAsync(ICanvasResourceCreator, IRandomAccessStream)
Loads a virtual bitmap from a stream.
Public methodStatic memberLoadAsync(ICanvasResourceCreator, String, CanvasVirtualBitmapOptions)
Loads a virtual bitmap from an image file.
Public methodStatic memberLoadAsync(ICanvasResourceCreator, Uri, CanvasVirtualBitmapOptions)
Loads a virtual bitmap from a URI.
Public methodStatic memberLoadAsync(ICanvasResourceCreator, IRandomAccessStream, CanvasVirtualBitmapOptions)
Loads a virtual bitmap from a stream.
Public methodStatic memberLoadAsync(ICanvasResourceCreator, String, CanvasVirtualBitmapOptions, CanvasAlphaMode)
Loads a virtual bitmap from an image file.
Public methodStatic memberLoadAsync(ICanvasResourceCreator, Uri, CanvasVirtualBitmapOptions, CanvasAlphaMode)
Loads a virtual bitmap from a URI.
Public methodStatic memberLoadAsync(ICanvasResourceCreator, IRandomAccessStream, CanvasVirtualBitmapOptions, CanvasAlphaMode)
Loads a virtual bitmap from a stream.
Top
Remarks

CanvasVirtualBitmap can be used to load and draw images that are larger than the maximum size of bitmaps supported on this device. CanvasDevice.MaximumBitmapSizeInPixels can be used to determine this size. Generally, you can assume that this value is at least 4096. Any attempt to load a CanvasBitmap larger than the maximum bitmap size will fail. CanvasVirtualBitmap allows you to reliably load any sized image.

CanvasVirtualBitmaps are always treated as 96 DPI. This means that the size in pixels and the size in DIPs have the same numerical values.

CanvasVirtualBitmaps can operate in two major modes, controlled by the CanvasVirtualBitmapOptions value passed to LoadAsync. The default, CanvasVirtualBitmapOptions.None, loads the entire image in one go, making it immediately available for drawing.

The other mode, CanvasVirtualBitmapOptions.CacheOnDemand, attempts to cache (load) only the parts of the image that are required. Drawing a part of the image that hasn't previously been cached can trigger IO.

Not all images support CacheOnDemand (currently only certain jpeg images support this). The IsCachedOnDemand property can be used to determine if the image loaded is actually using cache on demand.

When using Direct2D interop, this Win2D class corresponds to one of the Direct2D interfaces ID2D1ImageSource or ID2D1TransformedImageSource.

See Also