Search code examples
uwpwin2d

what is the difference between CanvasBitmap and CanvasVirtualBitmap in Win2d?


what is the difference between CanvasBitmap and CanvasVirtualBitmap in Win2d?Which is efficient to use?And How they are differ from each other?


Solution

  • According to the description in the document:

    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.

    This explains the difference between CanvasVirtualBitmap and CanvasBitmap.

    CanvasBitmap is used to load a bitmap of a certain size and can be loaded by the current device. But for images of uncertain size that may exceed the current device rendering range, you can use CanvasVirtualBitmap.

    Thanks.