Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
C++CodeIDE

How To Use Skia Shaders, SVG Images With C++ Builder 12

How To Use Skia Shaders SVG Images With C++ Builder 12

The latest RAD Studio C++ Builder 12 Update 1 has been released with a lot of amazing new features, such as the new bcc64x 64-bit CLANG compiler that has VCL/FMX/Skia GUI support with a one-click “64bit Windows Modern” platform option, a very useful Split Editor feature, fully integrated and enhanced Skia Library with an abundance of support for graphic formats (SVG, Animated GIF, WebP, and more), It also supports wonderful graphical shaders and has the powerful Visual Assist tool and an improved LSP CodeInsight among many other new improvements and bug fixes.

If you missed the webinar about the latest RAD Studio C++ Builder 12.1, here is the video of some of its great features. As part of our constant drive for improving quality and driving forward new features based on your feedback there is also a new patch released for RAD Studio 12 Update 1. If you have RAD Studio 12.1 this is how you can patch it.

What is a Skia Shader?

In modern graphics, a Shader is a GPU based program that calculates pixel colors by using Shader tasks in GPU, such as levels of light, darkness, and color during the rendering of a 3D scene. This process is known as a shading process, and it is a GPU based computation. Modern graphic cards have evolved to perform a variety of specialized functions in computer graphics, and shaders can be used for special effects and video post-processing, as well as general-purpose computing on graphics processing units. Each shader task can be programmed by the Skia Shading Language (SkSL). SkSL codes are very similar to C/C++ code, and it is Skia’s shading language. Also, the syntax of SkSL is very similar to GLSL codes too. Here are some SkSL code examples at Skia’s official page https://shaders.skia.org.

In this week’s round-up of posts we explain what a shader is, what is SkSL shader code, and how can we use the amazing Skia Shading Language (SkSL) in the latest C++ Builder 12. We explain how to use SVG images with Skia in C++ Builder. In modern C++, there is an algorithm library, and in this library, there is a very less know useful algorithm std::clamp, which is an algorithm that returns value in its range. In the last post, we explain what is std::clamp and how we can use it in our modern C++ applications.

Where I can I learn C++ and try C++ examples with a free C++ compiler?

If you don’t know anything about C++ or the C++ Builder IDE, don’t worry, we have a lot of great, easy to understand examples on the LearnCPlusPlus.org website and they’re all completely free. Just visit this site and copy and paste any examples there into a new Console, VCL, or FMX project, depending on the type of post. We keep adding more C and C++ posts with sample code. In today’s round-up of recent posts on LearnCPlusPlus.org, we have new articles with very simple examples that can be used with:

How to use Skia in programming with C++ Builder 12?

The latest RAD Studio / C++ Builder 12 comes with fully integrated 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 the first post, we explain what Skia is, its features and how we can use it in C++.

If you want to use Skia in your C++ Builder applications, you need to download the latest RAD Studio / C++ Builder. Then create a new C++ Builder FMX application or VCL application or open your project and you just need to enable Skia by right-clicking on your project in the Project window in C++ Builder, as below.

How To Use Skia With C++ Builder 12

You don’t need to install any 3rd party components, after the RAD Studio 12.1 version, it is completely included in the built-in libraries. In addition to Enabling Skia as above , it is recommended to add FMX.Skia.hpp header to your Project.cpp as shown below.

It is recommended to set true GlobalUseSkiaGlobalUseVulkan and set false GlobalUseSkiaRasterWhenAvailable flags in your Project.cpp like so:

How to use Skia shaders and SVG image with C++ Builder 12?

The latest RAD Studio / C++ Builder 12 comes with a lot of new features, one of which is Skia graphics library support in C++. Skia is an open-source graphic library that provides to support a variety of hardware and software platforms. One of Skia’s amazing features is its support for the shader graphics SkSL Shading Language. That means you can use GPU Shaders with Skia in C++ Builder 12. In the first post, we explain what a shader is, what is the SkSL Shading language, how you can create Skia shader code, and how you can run animations based on SkSL code in C++ Builder.

Skia supports a lot of new image formats, such as .bmp, .jpg, .gif, .gif animation, .svg, .ico, .webp, .wbmp, and raw images (.arw, .cr2, .dng, .nef, .nrw, .orf, .raf, .rw2, .pef and .srw). It is very useful for handling the SVG image format which is a Scalable Vector Graphics form. In the next post, we explain how to use SVG images with Skia in C++ Builder.

The C++17 brings a lot of features to the modern programming. The Parallelism Technical Specification adds several new algorithms to the standard C++ library. These are modernized in the <algorithm> header in the standard library. In programming, we sometimes want to limit our parameters by the given minimum and maximum values, and then we obtain new values in this range. In this library, there is a very less known useful algorithm std::clamp, which is an algorithm that returns value in its range. In the last post, we explain what is std::clamp and how we can use it in our modern C++ applications. This feature can be used to limit your graphical drawings and any other numerical parameters.

How to learn using Skia in modern C++ for free using C++ Builder 12?

LearnCPlusPlus.org has been producing full of educational articles about C and modern C++ that can be used with C++ Builder, C++ Builder CE, Dev-C++, BCC Compiler and some other compilers such as the GCC compiler. Here are our post picks for the latest C++ Builder 12 today.

We like to hear your feedback. You motivate us so much with your likes and comments on social media (find us on Facebook, LinkedIn, Reddit, Twitter / X and all over) and here on the blogs too. Thank you for your valuable comments and questions. All of them help improve the quality of our future posts.

We have a lot of unique posts waiting to come. We keep adding new topics every week about C++ in general and specific topics for C++ Builder, Dev-C++, and for the other C++ compilers. Please keep following our LearnCPlusPlus.org website for the latest posts and updates. Feel free to comment and share with your colleagues, students, members – knowledge is power, and knowledge shared is empowering.

How To Use Skia Shaders SVG Images With C++ Builder 12 C++ Logo

C++ Builder is the easiest and fastest C and C++ IDE for building everything from simple to professional applications. It is also easy for beginners to learn with its wide range of samples, tutorials, help files, and LSP support.

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.


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

   Free Delphi Community Edition   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.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES