Class BitmapImageMixin
- Namespace
- Akavache
- Assembly
- Akavache.Drawing.dll
Provides extension methods associated with the IBitmap interface.
public static class BitmapImageMixin
- Inheritance
-
BitmapImageMixin
Methods
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
IBlobCacheThe 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
IBlobCacheThe 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
DateTimeOffset?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
IBlobCacheThe 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
DateTimeOffset?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
IBlobCacheThe 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
DateTimeOffset?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
IBlobCacheThe 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
DateTimeOffset?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.
ThrowOnBadImageBuffer(byte[])
Converts bad image buffers into an exception.
public static IObservable<byte[]> ThrowOnBadImageBuffer(byte[] compressedImage)
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).