Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

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:

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:

[crayon-673fa7bbda59c216232403/]

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.

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

Exit mobile version