DataPackageView.GetBitmapAsync DataPackageView.GetBitmapAsync DataPackageView.GetBitmapAsync DataPackageView.GetBitmapAsync DataPackageView.GetBitmapAsync Method

Definition

Gets the bitmap image contained in the DataPackageView

public : IAsyncOperation<RandomAccessStreamReference> GetBitmapAsync()
IAsyncOperation<RandomAccessStreamReference> GetBitmapAsync() const;
public IAsyncOperation<RandomAccessStreamReference> GetBitmapAsync()
Public Function GetBitmapAsync() As IAsyncOperation(Of RandomAccessStreamReference)
Windows.ApplicationModel.DataTransfer.DataPackageView.getBitmapAsync().done( /* Your success and error handlers */ );

Returns

Examples

if (shareOperation.data.contains(Windows.ApplicationModel.DataTransfer.StandardDataFormats.bitmap)) {

    if (shareOperation.data.properties.thumbnail) {
        shareOperation.data.properties.thumbnail.openReadAsync().then(function (thumbnailStream) {
            var thumbnailBlob = MSApp.createBlobFromRandomAccessStream(thumbnailStream.contentType, thumbnailStream);
            var thumbnailUrl = URL.createObjectURL(thumbnailBlob, false);
            // To display the thumbnail, you need an element with id of "thumbnail"
            // in your HTML page.
            document.getElementById("thumbnail").src = thumbnailUrl;
        });
    }
    shareOperation.data.getBitmapAsync().then(function (streamRef) {
        streamRef.openReadAsync().then(function (bitmapStream) {
            if (bitmapstream) {
                var blob = MSApp.createBlobFromRandomAccessStream(bitmapStream.contentType, bitmapstream);
                var imageUrl = URL.createObjectURL(blob, false);
                // To display the image, you need an element with id of "imageholder"
                // in your HTML page.
                document.getElementById("imageholder").src = imageUrl;
            }
        });
     });
}
shareOperation.reportCompleted();