SkiaSharp is a cross-platform 2D graphics API for the .NET platform, based on Google's Skia graphics library. It provides a comprehensive 2D API for rendering images on mobile, server, and desktop models.SkiaSharp is available on multiple .NET platforms, including Core, WPF, Winform, MAUI, AvaloniaUI, and Uno.
Skia is a library of 2D vector graphics processing functions, including fonts, coordinate conversions, and dot-matrix graphics with high performance and simplicity. Skia is not only used in Google Chrome, but also in the Android open mobile platform, which uses Skia as a graphics processor with OpenGL/ES and specific hardware features to enhance the display.
Since Skia was acquired by Google in 2005, it has been quite mysterious and low-profile until early 2007, when the source code of Skia GL was revealed as the graphics engine for Google's Android platform, and later for the Google Chrome browser. With the release of the source code for Android and Chrome (the open source version is called "Chromium"), skia was also released under Apache License v2 (note that this means it is incompatible with the GPLv2 license), and there is a copy of [skia] in the codebase of both Android and Chrome. The Chrome codebase has a copy of [skia], which has been partially modified due to different needs, such as [chrome/trunk/src/skia] under the Chrome project, and it should be noted that skia itself does not deal with underlying environments, such as the Linux Framebuffer or the Gtk+ interface, which is why Android (via the Linux Framebuffer) is not compatible with the GPLv2 license. Framebuffer) and Chrome (the Linux version in development uses Gtk+) need to provide a copy of the modification in order to interface with the system.
SkiaSharp is a powerful cross-platform drawing framework , you can use SkiaSharp in WPF, Android client drawing , can also be used to create PDF drawings , but because it does not support web page drawings , so it is always a pity because the mainstream browsers are Google Chrom kernel , why Google does not support its own Skia in the web page directly draw it ? If SkiaSharp can directly draw on the web (Blazor webassembly), then it is a cross-platform drawing framework. Finally, on October 12, 2021, .NET 6 was released in RC2 Release Candidate (the last release before the official release), announcing a breakthrough technology: support for SkiaSharp canvas drawing on web pages. This is a pioneering step in the development of cross-platform technology for .NET, using C# to draw directly on the web page canvas, breaking the long-term monopoly of JavaScript+canvas.C# is a strongly typed language, which can seamlessly interface with structured data obtained from the server side, effectively improving development efficiency and quality.
Core updates in .NET 6 Release Candidate 2 - Blog ()
SkiaSharp is a cross-platform 2D graphics library for .NET based on the native Skia graphics library, and it now has preview support for Blazor WebAssembly. Let’s give it a try!
In MAUI, SkiaSharp is used through the library. It is a cross-platform graphics library that uses SkiaSharp as the underlying rendering engine to provide consistent API access to native graphics capabilities. This means that developers can use SkiaSharp to draw shapes, text and save images in MAUI applications. In addition, SkiaSharp can be used to create custom controls, such as wheel or pie charts in MAUI with customizable colors and angles.
For the Uno platform, SkiaSharp can also be integrated into Uno. Developers can use SkiaSharp by adding the NuGet package "SkiaSharp" to the shared class library and adding the SkXamlCanvas control to XAML, however, sometimes compilation issues may be encountered and it is necessary to make sure that the correct namespace is found.
AvaloniaUI uses the Skia rendering engine by default because the architecture of AvaloniaUI is designed to include SkiaSharp. In order to improve graphic rendering performance, AvaloniaUI has enhanced the graphic rendering capabilities of its composite renderer and introduced GPU interoperability, which allows AvaloniaUI to work more efficiently with GPUs to improve rendering performance and visual effects. This allows Avalonia to work more efficiently with GPUs to improve rendering performance and visualization, however, it is important to note that the Skia used by AvaloniaUI is a limited subset of Skia and is used for functionality necessary for the operation of Avalonia, excluding image processing, image metadata, and image decoding. SkiaSharp is a better choice for developers who need multi-purpose image processing. When using SkiaSharp 3.0, developers need to manually include the target platform's NativeAssets package.
SkiaSharp is widely used in MAUI, AvaloniaUI and Uno and provides consistent cross-platform graphics rendering capabilities through . NET platforms such as MAUI, AvaloniaUI, and Uno, but may require additional optimizations on mobile devices to avoid performance issues.The performance of SkiaSharp is shown below:
AvaloniaUI: Avalonia uses SkiaSharp as its rendering engine, enabling high-performance graphics rendering and a consistent user interface across different operating systems. However, it has been suggested that Avalonia may experience performance issues on mobile devices due to being based on Skia.
MAUIMAUI and SkiaSharp are important libraries in MAUI that provide developers with powerful graphics drawing capabilities. MAUI is designed to improve performance and reduce overhead in UI rendering by implementing a streamlined, decoupled handler mapper pattern on native platform controls.
UnoNET platform, SkiaSharp is described as a cross-platform 2D graphics API for the .NET platform, providing a comprehensive 2D API that can be used to render images for mobile, server, and desktop models.
Application scenario wise, it is suitable for a variety of application scenarios including but not limited to:
drawing tool: SkiaSharp can be used to develop a variety of drawing tools, such as rich-text editors, image drawing tools, and so on. For example, SkiaSharp can be used to create a powerful drawing tool that supports complex graphic drawing and editing functions.
Report production: In report development, SkiaSharp can be used to generate high-quality report images that support a wide range of data formats and layout requirements.
Image Generation: SkiaSharp can be used to generate a variety of images, such as verification codes, QR codes, etc. For example, you can use SkiaSharp to generate QR codes for authentication purposes.
User Interface Drawing: SkiaSharp can be used to draw complex graphics and animation effects in user interface design. For example, you can use SkiaSharp to implement self-drawing bouncing balls, particle gardens, and other special effects in WPF applications.
game development: SkiaSharp can be used to develop simple games, such as shooting mini-games, by self-drawing to realize the animation and interactive effects in the game.
PDF drawing: SkiaSharp can also draw on PDF, supporting the generation of graphical content in PDF files on multiple platforms.
cross-platform application: Since SkiaSharp is cross-platform, it can be used on multiple platforms such as Windows, Linux, Android, iOS, etc. It supports rendering images and graphics on different devices.
open source project: SkiaSharp is widely used in various open source projects, such as the Kimono designer, which supports the graphical creation of 2D images and generates cross-platform code.