Class SkiaImageManager
public class SkiaImageManager : IDisposable
- Inheritance
-
SkiaImageManager
- Implements
- Inherited Members
- Extension Methods
Constructors
SkiaImageManager()
public SkiaImageManager()
Fields
CacheLongevitySecs
Caching provider setting
public static int CacheLongevitySecs
Field Value
EnableHttpRetry
Controls whether LoadImageFromInternetAsync should use retry logic. Default is true for iOS/Windows (where it's the fallback when Nuke/Glide is disabled), false for Android (uses Glide retry).
public static bool EnableHttpRetry
Field Value
HttpRetryMaxAttempts
Maximum number of retry attempts for HTTP image loading. Only applies when EnableHttpRetry is true.
public static int HttpRetryMaxAttempts
Field Value
LoadLocalAsync
Normally we load local images in a synchronous manner, and remote in async one. Set this to true if you want to load load images async too.
public static bool LoadLocalAsync
Field Value
LogEnabled
public static bool LogEnabled
Field Value
NativeFilePrefix
Convention for local files saved in native platform. Shared resources from Resources/Raw/ do not need this prefix.
public static string NativeFilePrefix
Field Value
ReuseBitmaps
If set to true will not return clones for same sources, but will just return the existing cached SKBitmap reference. Useful if you have a lot on images reusing same sources, but you have to be carefull not to dispose the shared image. SkiaImage is aware of this setting and will keep a cached SKBitmap from being disposed.
public static bool ReuseBitmaps
Field Value
Properties
Instance
public static SkiaImageManager Instance { get; }
Property Value
IsDisposed
public bool IsDisposed { get; protected set; }
Property Value
IsLoadingLocked
public bool IsLoadingLocked { get; set; }
Property Value
IsOffline
public bool IsOffline { get; protected set; }
Property Value
UseCache
public static bool UseCache { get; set; }
Property Value
Methods
AddToCache(string, SKBitmap, int)
Returns false if key already exists
public bool AddToCache(string uri, SKBitmap bitmap, int cacheLongevitySecs)
Parameters
Returns
CancelAll()
public void CancelAll()
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
GetFromCache(string)
Return bitmap from cache if existing, respects the ReuseBitmaps flag.
public SKBitmap GetFromCache(string url)
Parameters
urlstring
Returns
GetFromCacheInternal(string)
Used my manager for cache organization. You should use GetFromCache for custom controls instead.
public SKBitmap GetFromCacheInternal(string url)
Parameters
urlstring
Returns
GetUriFromImageSource(ImageSource)
public static string GetUriFromImageSource(ImageSource source)
Parameters
sourceImageSource
Returns
LoadFromFile(string, CancellationToken)
public static Task<SKBitmap> LoadFromFile(string filename, CancellationToken cancel)
Parameters
filenamestringcancelCancellationToken
Returns
LoadImageAsync(ImageSource, CancellationToken)
Direct load, without any queue or manager cache, for internal use. Please use LoadImageManagedAsync instead.
public virtual Task<SKBitmap> LoadImageAsync(ImageSource source, CancellationToken token)
Parameters
sourceImageSourcetokenCancellationToken
Returns
LoadImageFromInternetAsync(UriImageSource, CancellationToken)
public static Task<SKBitmap> LoadImageFromInternetAsync(UriImageSource uriSource, CancellationToken cancel)
Parameters
uriSourceUriImageSourcecancelCancellationToken
Returns
LoadImageManagedAsync(ImageSource, CancellationTokenSource, LoadPriority)
Uses queue and manager cache
public virtual Task<SKBitmap> LoadImageManagedAsync(ImageSource source, CancellationTokenSource token, LoadPriority priority = LoadPriority.Normal)
Parameters
sourceImageSourcetokenCancellationTokenSourcepriorityLoadPriority
Returns
LoadImageOnPlatformAsync(ImageSource, CancellationToken)
public static Task<SKBitmap> LoadImageOnPlatformAsync(ImageSource source, CancellationToken cancel)
Parameters
sourceImageSourcecancelCancellationToken
Returns
Preload(ImageSource, CancellationTokenSource)
public Task Preload(ImageSource source, CancellationTokenSource cts)
Parameters
sourceImageSourcectsCancellationTokenSource
Returns
PreloadBanners<T>(IList<T>, CancellationTokenSource)
public virtual Task PreloadBanners<T>(IList<T> list, CancellationTokenSource cancel = null) where T : IHasBanner
Parameters
listIList<T>cancelCancellationTokenSource
Returns
Type Parameters
T
PreloadImage(ImageSource, CancellationTokenSource)
Preloads an image from the given source.
public virtual Task PreloadImage(ImageSource source, CancellationTokenSource cancel = null)
Parameters
sourceImageSourceThe image source to preload
cancelCancellationTokenSource
Returns
PreloadImage(string, CancellationTokenSource)
public virtual Task PreloadImage(string source, CancellationTokenSource cancel = null)
Parameters
sourcestringcancelCancellationTokenSource
Returns
PreloadImages(IList<string>, CancellationTokenSource)
public virtual Task PreloadImages(IList<string> list, CancellationTokenSource cancel = null)
Parameters
listIList<string>cancelCancellationTokenSource
Returns
TraceLog(string)
public static void TraceLog(string message)
Parameters
messagestring
UpdateInCache(string, SKBitmap, int)
public void UpdateInCache(string uri, SKBitmap bitmap, int cacheLongevityMinutes)
Parameters
Events
CanReload
public event EventHandler CanReload