Package | NuGet |
---|---|
SkiaImageView.Wpf | |
SkiaImageView.Avalonia11 | |
SkiaImageView.Avalonia | |
SkiaImageView.Xamarin.Forms | |
SkiaImageView.Maui |
A control for easy way showing SkiaSharp-based image objects onto UI applications.
You can simply bind a SkiaSharp image object to Source
property.
SKImageView
is a control of SkiaSharp image drawing.
You can manipulate same as with WPF's System.Windows.Controls.Image
.
Supported SkiaSharp types are: SKBitmap
, SKImage
, SKPicture
, SKDrawable
and SKSurface
.
XAML example:
<Window xmlns:siv="https://github.com/kekyo/SkiaImageView">
<siv:SKImageView
Stretch="Uniform"
Source="{Binding PreviewImage}" />
</Window>
public sealed class ViewModel
{
public SKBitmap? PreviewImage { get; set; }
// ...
}
Fully sample code is here:
Regardless of which platform you use, the usage is almost identical.
- .NET 7, 6, 5 (
net7.0-windows
,net6.0-windows
,net5.0-windows
) - .NET Core 3.1, 3.0 (
netcoreapp3.1
,netcoreapp3.0
) - .NET Framework 4.8, 4.6.2 (
net48
,net462
) - SkiaSharp: 2.80.0 or upper.
- .NET 7, 6, 5 (
net7.0
,net6.0
,net5.0
) - .NET Core 3.1, 3.0, (
netcoreapp3.1
,netcoreapp3.0
) - .NET Core 2.2, 2.1, 2.0 (
netcoreapp2.2
,netcoreapp2.1
,netcoreapp2.0
) - .NET Framework 4.8, 4.6.2 (
net48
,net462
) - Avalonia 11:
- Avalonia: 11.0.0 or upper
- SkiaSharp: 2.88.3 or upper.
- Avalonia (older):
- Avalonia: 0.10.0 or upper
- SkiaSharp: 2.80.0 or upper.
- .NET Standard 2.0 (
netstandard2.0
) - Xamarin Forms: 5.0.0.1874 or upper
- SkiaSharp: 2.80.0 or upper.
- .NET 7, 6 (
net7.0
,net6.0
) - .NET MAUI: 6 or upper.
- SkiaSharp: 2.88.0 or upper. (NOT 2.80.0, because the package contains some invalid type references.)
Name | Detail |
---|---|
Source |
SkiaSharp image related objects. See listed below. |
Stretch |
Stretch enum value |
StretchDirection |
StretchDirection enum value |
RenderMode |
Rendering into back buffer by synchronous or asynchronous. |
The Source
property accepts the following SkiaSharp types:
Supported Type | Aspect ratio from | Note |
---|---|---|
SKBitmap |
Origin | |
SKImage |
Origin | |
SKPicture |
Measured RenderSize |
|
SKDrawable |
Measured RenderSize |
|
SKSurface |
Measured RenderSize |
|
string |
Origin | URL string for downloading content |
Uri |
Origin | URL for downloading content |
Some types are drawn with aspect ratio corresponding to the current measured RenderSize
area.
Therefore, to maintain the aspect ratio, the size must be explicitly controlled in XAML.
Note: If you specify a URL to display, the URL does NOT accept the WPF resource format.
(application:
and pack:
protocol based.)
Choose rendering into back buffer by synchronous or asynchronous:
RenderMode | Note |
---|---|
Synchronously |
All rendering process is synchronously. |
AsynchronouslyForFetching |
Defaulted, Will operate asynchronously when giving URL in Source property (string or Uri ). |
Asynchronously |
All rendering process is asynchronously. |
AsynchronouslyForFetching
is defaulted.
Because, when set to Asynchronously
, all instances given to Source
must not be implicitly modified.
Maybe, this constraint can be difficult to achieve on your project.
Apache-v2.
- 1.5.0:
- Supported Avalonia 11.
- 1.4.0:
- Supported .NET MAUI. (Tested on 6.0.547).
- 1.3.0:
- Supported Avalonia platform (>= 0.10.0).
- Downgraded Xamarin Forms package version (>= 5.0.0.1874).
- 1.2.0:
- Fixed misconfigured bitfield of RGBA on Xamarin Forms.
- Added ProjectionQuality property for Xamarin Forms (You can adjust final image quality when need to make better performance.)
- 1.1.0:
- Supported Xamarin Forms.
- 1.0.1:
- Downgraded SkiaSharp to 2.80.0 (Because known bug related.)
- 1.0.0:
- Reached 1.0.0 ๐
- Fixed updating new image instance.
- 0.4.0:
- Added RenderMode features and supported StretchDirection.
- Added sample code.
- 0.3.0:
- Fixed XAML namespace.
- 0.2.0:
- Fixed some problems, add WIP feature.
- 0.1.0:
- Initial release.