With the R3 2023 release, we added a SkiaSharp library-based implementation as an alternative to the GDI+ rendering engine. Let’s take a deeper dive.
GDI+ stands for Graphics Device Interface Plus. It is a 2D graphics programming interface and library provided by Microsoft as part of the Windows operating system. GDI+ is a successor to the original GDI (Graphics Device Interface) and offers more advanced features and capabilities for rendering 2D graphics in applications developed for the Windows platform. The services of GDI+ are exposed through a set of C++ classes.
GDI+ provides a set of APIs that allow developers to create and manipulate graphics, draw shapes, text and images, and perform various graphical operations. It is often used in Windows applications to handle tasks like drawing graphics, rendering images, and creating user interfaces. GDI+ supports features like anti-aliased rendering, alpha blending, gradient fills and various image formats.
While GDI+ has been widely used in Windows application development, it has been largely replaced by newer graphics technologies, such as Direct2D and Windows Presentation Foundation (WPF), which offer improved performance and better support for modern graphics hardware. Nevertheless, GDI+ remains a valuable tool for developers working with legacy applications and for certain types of graphics tasks in Windows programming.
While System.Drawing is a .NET Framework namespace that provides managed wrappers and classes for GDI+ functionality, the System.Drawing.Common was ported to be a platform independent wrapper which has been decided to bring over because of Mono’s cross-platform implementation—the native library libgdiplus.
“Since System.Drawing.Common was really designed to be a thin wrapper over Windows technologies, its cross-platform implementation is a bit like a square peg in a round hole; it’s subpar because it was only designed with Windows in mind.”
— Microsoft by Santiago Fernandez Madero
To cut a long story short, Microsoft announced they are not planning to continue with the development of the System.Drawing.Common to work on non-Windows platforms: Make System.Drawing.Common only supported on Windows.
So, our only shot was to find the best alternative.
SkiaSharp’s cross-platform support makes it an attractive choice for developers who need to create applications that run on multiple operating systems.
As we can see from the SkiaSharp GitHub repository, SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google’s Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server, and desktop models to render images.
SkiaSharp provides cross-platform bindings for:
SkiaSharp benefits from an active open-source community and has gained popularity for its cross-platform capabilities, resulting in a wealth of resources and support.
After the library was chosen, the entire process was separated into three main stages:
Abstraction – In this stage, we designed a Telerik.Drawing.Contract class library where we created a layer of abstraction of all the System.Drawing classes/methods/properties that we use in our code base. Abstraction logic is handled by nearly 100 classes and approximately 1,200 methods. The idea was to have the option to easily change the rendering implementation when needed.
GDI+ implementation – The next (maybe most important stage) was to get everything working again. We created a Telerik.Drawing.GDI class library which implements the contract abstraction by using the original System.Drawing APIs. This step should preserve the full functionality of Telerik Reporting as it was before the changes.
SkiaSharp implementation – The most challenging part was to mimic all these functions to use SkiaSharp APIs and to achieve (for now—almost) the same result as it had initially.
This level of abstraction gives us the option to change and provide more rendering implementations easily if needed.
With the R3 2023 release, we provided support for PDF, HTML, Image and OOXML rendering with our new SKIA engine.
We have a plan to continuously improve the already provided rendering options with (and not only) better performance and to upgrade with XAML rendering as well.
With R3 2023, Telerik Reporting provided an easy-to-set-up option for changing the default graphics engine between GDI and SKIA.
The provided options are as follows:
PlatformDependent – The default value. On the Windows platform, the report engine will use the GDI graphics engine. On non-Windows platforms, the report engine will use the Skia graphics engine.
GDI – The application will use GDI graphics engine. On non-Windows platforms in applications that target .NET 7 or higher, this will cause runtime exceptions of type PlatformNotSupported to be thrown. For .NET 6 and lower frameworks, this setting will require installing libgdiplus library that handles GDI calls.
Skia – The application will use the Skia graphics engine through the SkiaSharp implementation. Can be used on Windows and non-Windows platforms in applications that target .NET 6 or higher framework.
The complete description can be found in the Configuring the Report Engine/GraphicsEngine help article.
SkiaSharp is known for its performance and is optimized for modern hardware, making it suitable for graphics-intensive applications. It uses hardware acceleration when available, which can result in improved performance.
GDI+ is older technology and may not offer the same level of performance as SkiaSharp, especially on newer hardware. It lacks some of the optimizations and hardware acceleration available in more modern graphics libraries.
There are still some differences and missing features that we want to bring to address:
Here is an example of our Dashboard report exported to PDF file using both rendering options:
In summary, the choice between SkiaSharp and GDI+ depends on your specific requirements. SkiaSharp is a more versatile and performance-oriented choice, especially if you need cross-platform compatibility. GDI+ may still be suitable for Windows applications or when specific requirements necessitate its use (e.g., WinForms, WPF, WinUI), but it is less favored for modern graphics development on the Windows platform.
Providing our clients the ability to render their reports on various OS is a major step to another challenge—having a fully featured, cross-platform Telerik Report Server.
In 2024, our development efforts will be pointed toward migrating the Telerik Report Server to .NET 6. This includes refactoring on both client- and server-side of the web application, retargeting to a modern web framework like ASP.NET Core MVC, and allowing hosting it on web servers other than IIS (Internet Information Services). Naturally, the journey will end with reusing the Skia rendering engine in Report Server application, allowing for embedding it in cloud applications that run on different Linux distributions.
Get yourself a free trial of Telerik Reporting today and start developing your apps better, faster and more easily.
Let’s continue to build the future of Telerik Reporting together! So, do not forget to share your thoughts as a comment below or let us know if you have any suggestions and/or need any features/components by visiting our Feedback Portal and Telerik Reporting Forum.
Martin is a Software Engineer, part of the Document Processing team in Sofia, Bulgaria since July 2019. He is passionate about new technologies and is always on the crest of a wave with the novelties. In his spare time, Martin likes travelling to new destinations and exploring new cultures, hanging out with friends, reading books, practicing sports, and more.
Subscribe to be the first to get our expert-written articles and tutorials for developers!
All fields are required