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


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:


We can do this by adjusting the texture itself and set all pixels outside of the circle to 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:


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


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

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
Related posts

A Beginner's Guide To The Best Python Tools

DelphiTech Partner

What You Need To Know About TabOrder And Cross Platform Apps


12 Steps To Find The Best Low Code Platform


How To Get Your C++ App To Pixelate Images And Use AI

1 Comment

Leave a Reply

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