How can I create a Canvas Clipping Region?
I was wondering if there is some neat trick I'm missing to make a Canvas have a clipping region?
Basically this means I can set a region on the canvas, when something is drawn outside this region, it is clipped appropriately. I looked at
Is using multiple RenderTargets really the only other way? Or is there something even more low-level than Canvas I can utilize to render textures, which does support clipping appropriately?
For a scenario: I've drawn a 100x25 texture on the Canvas on position (10,10), this is supposed to be a button. I then draw text on top of it using a generated bitmap font. The goal is then to set the Clipping Region to (10,10,100,125), and anything drawn (partially) outside those bounds isn't rendered.
I looked into this awhile back. As far as I can tell, there is no way to clip the canvas right now. It looks like there was some left over functionality of this feature in FCanvas::PushMaskRegion/PopMaskRegion, but they are not exposed as part of the engine API and if you examine the source code it looks like the back end logic isn't hooked up.
In the mean time, you can clip textures by playing around with the U, V, UL, VL parameters passed into DrawTexture. Thats how I worked around it. Unfortunately, this won't work for clipping texture.
It would be great actually if someone on the Unreal team can weigh in on this. Hope that helps.
answered Jun 09 '14 at 08:41 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here