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 | B.Tech-CSE at AUT | Delphi/C++ Builder Enthusiast | Microsoft Learn Student Ambassador | Microsoft Azure Certified | Udacity Alumni
Related posts

Day 3 – Learn to Code Summer Camp 2021 - Now with More C++!


Join us Live for Delphi, Training, Jobs, and Education on TCoffeeAndCode

DelphiRAD Studio

How To Validate And Lookup Global Phone Numbers In Your Apps


This Is How To Protect Your Source Code from Hackers

1 Comment

Leave a Reply

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