Class BitmapImageExtensions
Provides extension methods associated with the Splat.
- Inheritance
-
Bitmap
Image Extensions
Methods
ImageToBytes(IBitmap)
Convert an IBitmap to a byte array asynchronously.
Parameters
image
IBitmapThe 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
blobCache
IBlobCache The blob cache to load the image from.
key
stringThe key to look up in the cache.
desiredWidth
float?Optional desired width, if not specified will be the default size.
desiredHeight
float?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
blobCache
IBlobCache The blob cache to load the image from if available.
url
stringThe URL to download.
fetchAlways
boolIf we should always fetch the image from the URL even if we have one in the blob.
desiredWidth
float?Optional desired width, if not specified will be the default size.
desiredHeight
float?Optional desired height, if not specified will be the default size.
absoluteExpiration
DateTime ?Offset 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
blobCache
IBlobCache The blob cache to load the image from if available.
key
stringThe key to store with.
url
stringThe URL to download.
fetchAlways
boolIf we should always fetch the image from the URL even if we have one in the blob.
desiredWidth
float?Optional desired width, if not specified will be the default size.
desiredHeight
float?Optional desired height, if not specified will be the default size.
absoluteExpiration
DateTime ?Offset 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
blobCache
IBlobCache The blob cache to load the image from if available.
key
stringThe key to store with.
url
UriThe URL to download.
fetchAlways
boolIf we should always fetch the image from the URL even if we have one in the blob.
desiredWidth
float?Optional desired width, if not specified will be the default size.
desiredHeight
float?Optional desired height, if not specified will be the default size.
absoluteExpiration
DateTime ?Offset 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
blobCache
IBlobCache The blob cache to load the image from if available.
url
UriThe URL to download.
fetchAlways
boolIf we should always fetch the image from the URL even if we have one in the blob.
desiredWidth
float?Optional desired width, if not specified will be the default size.
desiredHeight
float?Optional desired height, if not specified will be the default size.
absoluteExpiration
DateTime ?Offset 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
blobCache
IBlobCache The blob cache to save the image to.
key
stringThe key to associate with the image.
image
IBitmapThe bitmap image to save.
absoluteExpiration
DateTime ?Offset 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.
Parameters
compressedImage
byte[]The compressed image buffer to check.
Returns
- IObservable<byte[]>
The byte[], or OnError if the buffer is corrupt (empty or too small).