LazyTextureCache<TKey>

References
public abstract class LazyTextureCache<TKey>
Abstract base class for multi-resolution lazy texture evaluations and caching. This cache is designed to generate a family of related textures that can be indexed by key, such as slices through colour spaces, or animation frames.
TKeyLookup key to use to identify specific textures. For colour spaces this is usually some sort of transformation or slice parameter, for animations it is usually the timestamp or frame index.

Constructors

LazyTextureCache

#
Create a new instance of the lazy texture cache.
protected LazyTextureCache(
Size
quickSize,
Resolution of low quality images.
Size
prettySize,
Resolution of high quality images.
padding,
Padding edges around computed slices.
comparer
Comparer.
)

LazyTextureCache

#
Create a new instance of the lazy texture cache.
protected LazyTextureCache(
Size
quickSize,
Resolution for quick (low quality) images.
Size
prettySize,
Resolution for pretty (high quality) images.
padding
Padding edges around computed images.
)

Fields

DefaultCacheLimit

#
The global default cache limit.
public const int DefaultCacheLimit = 512

Properties

AutoCancelRendering

#
Gets or sets whether high quality texture rendering will be cancelled automatically if a new texture is requested.
public bool AutoCancelRendering { get; set; }

CacheLimit

#
Gets or sets the cache size limit. If the number of cached textures exceeds this limit the cache will be emptied entirely. Note that changes to the cache limit won't be taken into consideration until the next texture is scheduled for caching.
public int CacheLimit { get; set; }

Count

#
Gets the total number of cached textures. This includes textures of all quality levels.
public int Count { get; }

Filter

#
Gets or sets the rounding table to use when making textures.
public NamedPalette Filter { get; set; }

Padding

#
Gets the padding (in pixels) for all textures.
public int Padding { get; }

PrettySize

#
Gets the resolution for high quality, fine textures.
public Size PrettySize { get; }

QuickSize

#
Gets the resolution for low quality, coarse textures.
public Size QuickSize { get; }

Indexers

this[]

#
Gets the texture associated with the given key. If the requested texture hasn't been created yet, it will be rendered in low resolution in the caller thread and a high resolution rendering will commence in a background thread.
public IMultiResolutionTexture this[
TKey
key,
Key to retrieve.
access = TextureCacheAccess.QuickNowPrettyLater
Cache access.
] { get; }
Cached texture.

Methods

Clear

#
Clear all cached textures.
public void Clear()

CreateTexture

#
Implement this method to generate custom textures.
protected abstract Bitmap CreateTexture(
Size
size,
Size of texture.
padding,
Padding around texture.
TKey
key,
Texture key.
token
Cancellation token for process.
)
Texture. Dimensions must be size.Width+2*padding by size.Height+2*padding.

ProcessKey

#
Override this method if you wish to perform some operation to key values such as rounding or limiting. The base implementation returns the input key. A common operation would be rounding or clipping.
protected virtual TKey ProcessKey(
TKey
key
Key to process.
)
Processed key.