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

Developer Stories: Jarrod Davis Speaks Of His GameVision Toolkit Application


Developer Stories: Manuel Lopez Shares More About His Portraits With Craps Application


Developer Stories: John Hardy Elaborates More On His Equation Visualization Application


Developer Stories: Flavius Fernandes Talks Through His ERP Sirius +Mobile

1 Comment

Leave a Reply

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