C++C++17Code SnippetGame DevelopmentLanguage FeatureLearn C++

What Is Skia In Modern C++?

What Is Skia In Modern C++

The latest RAD Studio / C++ Builder 12 comes with Skia graphics library support for C++. Skia is an open-source graphic library that provides to support a variety of hardware and software platforms. Google sponsor the Skia project but the library available for use by anyone under the BSD Free Software License. Projects which include Skia find that it provides smooth 2D graphics that uses GPU efficiently. In this post we explain what Skia is, its features and how we can use it in C++.

What is Skia in modern C++?

Skia is an open-source graphic library that provides support variety of hardware and software platforms. Google sponsor the Skia project but is available for use by anyone under the BSD Free Software License. It was originally designed for The Google Chrome web browser and ChromeOS, Android, and Flutter It was also initially adopted by Mozilla Firefox and the Firefox OS, but now it is used in a great many other products. The core components are provided by the Skia development team, but they consider and include contributions from any source.

Skia works with VCL and FMX. With FMX, you can switch to Skia as your rendering engine to significantly improve the performance of your FireMonkey applications and unlock smoother animations with a single line of code.

Embarcadero’s implementation of Skia support provides a comprehensive 2D API to render images across mobile, server, and desktop models. It is compatible with all RAD Studio frameworks (Console, FMX, and VCL) and platforms. It provides common 2D APIs by abstracting complexities in implementing low-level libraries used behind, such as OpenGL, Vulkan, DirectX, and Metal, among others, implementing optimizations and new features.

Although the basic Skia library is compatible with all frameworks, some features are unique:

What are the Skia features that can be used in a modern C++ app?

Here are some of the Skia features;

FEATUREDETAILS
2D drawsShapes, paths, and texts
SVGRender and creation.
Image decodersBMP, GIF, ICO, JPG, PNG, WBMP, WEBP, and raw
images.
Image encodersPNG, JPG, and WEBP.
Animations playerLottie, Telegram Stickers, animated GIFs, and
animated WEBP
Anti-aliasingHigh draw quality, no jagged edges.
FontFont weight, families fallbacks, and custom font
(without installation), ligature.
TextMultiple styles, max lines, line spacing, justified text,
text outline, gradient, and decorations.
Right-To-Left
languages
Rendering of texts in Persian, Arabic, Hebrew, etc.
PDFGeneration of vectorized PDF.
UnicodeGraphemes parser.
FiltersColor, mask, and image filters
ClippingsSupport for many advanced clipping operations such
as paths and shaders.
GradientsLinear, radial, sweep, and conical gradients.
ShaderCreation of shaders to execute specific draws directly
on the GPU through a single shader language (SkSL).

Which Operating Systems are supported by Skia?

Maybe this is one of the reasons why Skia is important, it is friendly with most of popular operating systems, here are the platforms supported;

  • Windows
  • macOS
  • iOS (including simulator)
  • Android (including simulator)
  • Linux (main distributions)
  • FuschiaOS
  • Tizen
  • tvOS
  • watchOS

How can we enable Skia in modern C++ Builder 12.1 RAD Studio IDE?

Skia is a new 2D render feature of RAD Studio / C++ Builder 12.1. It comes with Skia.Package.FMX, Skia.Package.RTL, Skia.Package.VCL. package libraries officially.

If you want to use Skia in your C++ Builder applications, first you need to download the latest RAD Studio / C++ Builder. Then open your project and you just need to enable Skia by right-clicking on your project in the Project window in C++ Builder. You don’t need to install any 3rd party components, after the RAD Studio 12.1 version, it is completely included in RAD Studio libraries.

This step automatically configures the links and deployments of the library binaries to the project. In addition, it adds code to the project source code.

The Skia library integration also offers some new specific native controls and components. These controls are available only if Skia is enabled and deployed to the target platform. TSkAnimatedImage, TSkLabel, TSkSVG, TSkPaintBox and TSkAnimatedPaintBox.

How can we enable Skia in modern C++ Builder project code?

In addition to Enabling Skia as above , it is recommended to add the FMX.Skia.hpp header to your Project.cpp as shown below:

and recommended to set true GlobalUseSkia, GlobalUseVulkan and set false GlobalUseSkiaRasterWhenAvailable flags inyour Project.cpp like so:

As an example, your Project.cpp could be something like this:

Now you can add Skia components to your application. They can be found in Palette window in the latest C++ Builder 12.

Why Skia is an important feature in C++?

Skia looks like it has faster graphics in most of the graphical visuals, but also it is smooth and friendly with GPU. It has amazing Shaders support which means you can use every shader of your GPU to calculate each pixel, and it has Vulkan options too. It is very useful in 2D graphics but you can use it in 3D graphics too.

How can I support and follow the Skia project?

If you are good at graphics and want to improve Skia, you can follow this project from below,

If you want to know more about Skia features in RAD Studio and Delphi please read this post for details.

Are there any document and more links about Skia?

If you want to see more examples, please install the latest RAD Studio / C++ Builder12.1 full or trial version and check this sample in Samples folder:
C:\Users\Public\Documents\Embarcadero\Studio\23.0\Samples\CPP\Multi-Device Samples\Skia4Delphi project. It has many examples that runs different Skia graphical examples.

What Is Skia In Modern C++ C++ logo

C++ Builder is the easiest and fastest C and C++ compiler and IDE for building simple or professional applications on the Windows operating system. It is also easy for beginners to learn with its wide range of samples, tutorials, help files, and LSP support for code. RAD Studio’s C++ Builder version comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for UIs.

There is a free C++ Builder Community Edition for students, beginners, and startups; it can be downloaded from here. For professional developers, there are Professional, Architect, or Enterprise versions of C++ Builder and there is a trial version you can download from here.

Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome C++ content in your inbox, every day.

We don’t spam! Read our privacy policy for more info.


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial

Free C++Builder Community Edition

About author

Dr. Yilmaz Yoru has 35+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He graduated and received his MSc and PhD degrees from the Department of Mechanical Engineering of Eskisehir Osmangazi University. He is the founder and CEO of ESENJA LLC Company. His interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.
Related posts
C++C++11C++14C++17C++20Introduction to C++Learn C++

Learn Copy Constructors in C++ Classes

C++C++11C++14C++17Introduction to C++Learn C++Syntax

Learn How To Use Types Of Destructors In C++?

C++C++11C++14Learn C++Syntax

How To Convert u32string To A wstring In C++

C++C++11C++14C++17C++20Introduction to C++Learn C++

How To Learn The Move Constructors In Modern C++?