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

Easily Cutout An Image With A Pixel Shader On Windows

delphi firemonkey shader programming make cutout for any image

In the previous example on Shader programming with Delphi FireMonkey, we created a texture feature to show images. So the material source manages the image bitmap.

In this sample, you will create this:

transparenttexture-5896379

We can do this by adjusting the texture itself and setting all the pixels outside of the circle to be transparent. This needs a change to the texture. By utilizing a transformed pixel shader, you could make the cutout for any image.

Pixel Shaders

We can keep the same vertex shaders as the previous example. The pixel shaders have to be updated through:

gpu04-1649434

In this part no need to update the materials at the Delphi side since all changes are controlled by the shader.

embarcadero-delphi-firemonkey-shader-programming-delphi-programming-6700611

Be sure to check out the full blog post here on Grijjy blogs.

With the use of Windows IDE, you can easily cut out an image with a pixel shader on Windows. Try your Free Trial here.


What's Coming in Delphi, C++Builder, and RAD Studio 11.2 Alexandria

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

Software Developer | CS(CyberSec) Undergrad at APU Malaysia | Delphi/C++ Builder Enthusiast | Microsoft Learn Student Ambassador | Microsoft Azure Certified

1 Comment

Leave a Reply to Or Évier De Cuisine Cancel reply

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

IN THE ARTICLES