Class BitmapImageExtensions
Provides extension methods associated with the IBitmap interface.
public static class BitmapImageExtensions
- Inheritance
-
BitmapImageExtensions
Methods
ImageToBytes(IBitmap)
Convert an IBitmap to a byte array asynchronously.
public static IObservable<byte[]> ImageToBytes(this IBitmap image)
Parameters
imageIBitmapThe bitmap image to convert.
Returns
- IObservable<byte[]>
A Future result representing the byte array.
LoadImage(IBlobCache, string, float?, float?)
Load an image from the blob cache.
public static IObservable<IBitmap> LoadImage(this IBlobCache blobCache, string key, float? desiredWidth = null, float? desiredHeight = null)
Parameters
blobCacheIBlobCacheThe blob cache to load the image from.
keystringThe key to look up in the cache.
desiredWidthfloat?Optional desired width, if not specified will be the default size.
desiredHeightfloat?Optional desired height, if not specified will be the default size.
Returns
- IObservable<IBitmap>
A Future result representing the bitmap image. blobCache Observable is guaranteed to be returned on the UI thread.
LoadImageFromUrl(IBlobCache, string, bool, float?, float?, DateTimeOffset?)
A combination of DownloadUrl and LoadImage, this method fetches an image from a remote URL (using the cached value if possible) and returns the image.
public static IObservable<IBitmap> LoadImageFromUrl(this IBlobCache blobCache, string url, bool fetchAlways = false, float? desiredWidth = null, float? desiredHeight = null, DateTimeOffset? absoluteExpiration = null)
Parameters
blobCacheIBlobCacheThe blob cache to load the image from if available.
urlstringThe URL to download.
fetchAlwaysboolIf we should always fetch the image from the URL even if we have one in the blob.
desiredWidthfloat?Optional desired width, if not specified will be the default size.
desiredHeightfloat?Optional desired height, if not specified will be the default size.
absoluteExpirationDateTimeOffset?An optional expiration date.
Returns
- IObservable<IBitmap>
A Future result representing the bitmap image. blobCache Observable is guaranteed to be returned on the UI thread.
LoadImageFromUrl(IBlobCache, string, string, bool, float?, float?, DateTimeOffset?)
A combination of DownloadUrl and LoadImage, this method fetches an image from a remote URL (using the cached value if possible) and returns the image.
public static IObservable<IBitmap> LoadImageFromUrl(this IBlobCache blobCache, string key, string url, bool fetchAlways = false, float? desiredWidth = null, float? desiredHeight = null, DateTimeOffset? absoluteExpiration = null)
Parameters
blobCacheIBlobCacheThe blob cache to load the image from if available.
keystringThe key to store with.
urlstringThe URL to download.
fetchAlwaysboolIf we should always fetch the image from the URL even if we have one in the blob.
desiredWidthfloat?Optional desired width, if not specified will be the default size.
desiredHeightfloat?Optional desired height, if not specified will be the default size.
absoluteExpirationDateTimeOffset?An optional expiration date.
Returns
- IObservable<IBitmap>
A Future result representing the bitmap image. blobCache Observable is guaranteed to be returned on the UI thread.
LoadImageFromUrl(IBlobCache, string, Uri, bool, float?, float?, DateTimeOffset?)
A combination of DownloadUrl and LoadImage, this method fetches an image from a remote URL (using the cached value if possible) and returns the image.
public static IObservable<IBitmap> LoadImageFromUrl(this IBlobCache blobCache, string key, Uri url, bool fetchAlways = false, float? desiredWidth = null, float? desiredHeight = null, DateTimeOffset? absoluteExpiration = null)
Parameters
blobCacheIBlobCacheThe blob cache to load the image from if available.
keystringThe key to store with.
urlUriThe URL to download.
fetchAlwaysboolIf we should always fetch the image from the URL even if we have one in the blob.
desiredWidthfloat?Optional desired width, if not specified will be the default size.
desiredHeightfloat?Optional desired height, if not specified will be the default size.
absoluteExpirationDateTimeOffset?An optional expiration date.
Returns
- IObservable<IBitmap>
A Future result representing the bitmap image. blobCache Observable is guaranteed to be returned on the UI thread.
LoadImageFromUrl(IBlobCache, Uri, bool, float?, float?, DateTimeOffset?)
A combination of DownloadUrl and LoadImage, this method fetches an image from a remote URL (using the cached value if possible) and returns the image.
public static IObservable<IBitmap> LoadImageFromUrl(this IBlobCache blobCache, Uri url, bool fetchAlways = false, float? desiredWidth = null, float? desiredHeight = null, DateTimeOffset? absoluteExpiration = null)
Parameters
blobCacheIBlobCacheThe blob cache to load the image from if available.
urlUriThe URL to download.
fetchAlwaysboolIf we should always fetch the image from the URL even if we have one in the blob.
desiredWidthfloat?Optional desired width, if not specified will be the default size.
desiredHeightfloat?Optional desired height, if not specified will be the default size.
absoluteExpirationDateTimeOffset?An optional expiration date.
Returns
- IObservable<IBitmap>
A Future result representing the bitmap image. blobCache Observable is guaranteed to be returned on the UI thread.
SaveImage(IBlobCache, string, IBitmap, DateTimeOffset?)
Save an image to the blob cache.
public static IObservable<Unit> SaveImage(this IBlobCache blobCache, string key, IBitmap image, DateTimeOffset? absoluteExpiration = null)
Parameters
blobCacheIBlobCacheThe blob cache to save the image to.
keystringThe key to associate with the image.
imageIBitmapThe bitmap image to save.
absoluteExpirationDateTimeOffset?An optional expiration date.
Returns
- IObservable<Unit>
A Future result representing the completion of the save operation.
ThrowOnBadImageBuffer(byte[])
Converts bad image buffers into an exception.
public static IObservable<byte[]> ThrowOnBadImageBuffer(this byte[] compressedImage)
Parameters
compressedImagebyte[]The compressed image buffer to check.
Returns
- IObservable<byte[]>
The byte[], or OnError if the buffer is corrupt (empty or too small).