Any ways to mask or crop images dynamically?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
Alfred Don
Posts: 44
Joined: Mon Aug 01, 2022 11:52 am

Any ways to mask or crop images dynamically?

Post by Alfred Don »

Just wondering, because the only way to mask, clip, or crop images that I know or involves the TEXTURES lump.
User avatar
Sir Robin
Posts: 537
Joined: Wed Dec 22, 2021 7:02 pm
Graphics Processor: Intel (Modern GZDoom)
Location: Medellin, Colombia

Re: Any ways to mask or crop images dynamically?

Post by Sir Robin »

Depends what you're trying to do. Maybe a custom shader?
User avatar
Xeotroid
Posts: 443
Joined: Sat Jun 23, 2012 7:44 am
Graphics Processor: nVidia with Vulkan support
Location: Czech Rep.

Re: Any ways to mask or crop images dynamically?

Post by Xeotroid »

You might be interested in canvases and the related DrawTexture function (it's the same as for drawing on screen) that allows shifting, clipping, scaling, and rotating a texture you draw on it through the tags argument pairs.
Last edited by Xeotroid on Sat Sep 23, 2023 10:00 am, edited 1 time in total.
User avatar
Sir Robin
Posts: 537
Joined: Wed Dec 22, 2021 7:02 pm
Graphics Processor: Intel (Modern GZDoom)
Location: Medellin, Colombia

Re: Any ways to mask or crop images dynamically?

Post by Sir Robin »

Xeotroid wrote: Thu Sep 21, 2023 7:29 am You might be interested in canvases and the related DrawScreen function (it's the same as for drawing on screen) that allows shifting, clipping, scaling, and rotating a texture you draw on it through the tags argument pairs.
Wow, didn't realize that was possible. Would you take a look at this thread? It's something I solved with a custom shader but maybe you can tell me if there is another/better way?
User avatar
Alfred Don
Posts: 44
Joined: Mon Aug 01, 2022 11:52 am

Re: Any ways to mask or crop images dynamically?

Post by Alfred Don »

Xeotroid wrote: Thu Sep 21, 2023 7:29 am You might be interested in canvases and the related DrawScreen function (it's the same as for drawing on screen) that allows shifting, clipping, scaling, and rotating a texture you draw on it through the tags argument pairs.
That does look interesting, and I think that will work for what I'm trying to do. Thanks!

Return to “Scripting”