Quantumm.Image
1.1.5
See the version list below for details.
dotnet add package Quantumm.Image --version 1.1.5
NuGet\Install-Package Quantumm.Image -Version 1.1.5
<PackageReference Include="Quantumm.Image" Version="1.1.5" />
<PackageVersion Include="Quantumm.Image" Version="1.1.5" />
<PackageReference Include="Quantumm.Image" />
paket add Quantumm.Image --version 1.1.5
#r "nuget: Quantumm.Image, 1.1.5"
#:package Quantumm.Image@1.1.5
#addin nuget:?package=Quantumm.Image&version=1.1.5
#tool nuget:?package=Quantumm.Image&version=1.1.5
Quantumm.Image
Quantumm.Image is an asynchronous, thread-safe, LRU-aware image caching library designed for Avalonia applications. It provides fast and memory-efficient image loading with support for dependency injection and duplicate download prevention.
Features
- Asynchronous image loading from disk
- Memory-limited LRU (Least Recently Used) caching
- Thread-safe access to cached images
- Automatic eviction of least recently used images
- Prevents multiple concurrent loads of the same image
- Easy dependency injection integration with
Microsoft.Extensions.DependencyInjection - Detailed XML documentation for all public interfaces
- Supports Avalonia 11 and .NET 9
Installation
Install via NuGet:
dotnet add package Quantumm.Image --version 1.1
Usage
- Register the service in your DI container
using Microsoft.Extensions.DependencyInjection; using Quantumm.Image.Services.DependencyInjection; var services = new ServiceCollection(); // Register ImageCacheService with optional capacity (default 100) services.AddImageCache(capacity: 200); var serviceProvider = services.BuildServiceProvider(); - Resolve and use the service
using Quantumm.Image.Services.ImageCache; using Avalonia.Media.Imaging; var imageCache = serviceProvider.GetRequiredService<IImageCacheService>(); // Load an image asynchronously Bitmap image = await imageCache.LoadImage("path/to/image.png"); // Update an image in cache if the file has changed Bitmap updatedImage = await imageCache.UpdateImage("path/to/image.png");
API
IImageCacheService
Task<Bitmap> LoadImage(string filePath) Loads an image from cache or disk asynchronously. Adds it to the cache if it wasn't already present.
Task<Bitmap> UpdateImage(string path) Updates an existing image in the cache by loading a new version from disk. Adds it if it does not exist.
Logging
ImageCacheService supports logging via Microsoft.Extensions.Logging. Useful events include:
- Image loading
- Image eviction
- Errors during image load or disposal
services.AddLogging(builder => builder.AddConsole());
Supported Platforms
- Avalonia 11
- .NET 9.0
License
MIT License. See LICENSE for details.
Contributors
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Avalonia (>= 11.3.6)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.