I have an image objects and I need to draw them on the form but with rounded corners.
I went through Graphics methods, however there are only simple figures and whole rectangular image drawing.
Is there any suitable and fast way to do so?
You could set a clip region to a roundrect (make a Path, use addRoundedRectangle, then set it as the clip on the Graphics).
Or, you could create an Image with an alpha channel, draw a rounded rectangle into the alpha channel to give it shape and draw the image via the Graphics.
Thanks for the ideas,
however first one woudn’t work for me because I have an older JUCE versions and there are only rectangular Graphics clip regions.
Concerning the second one, I’m not sure that I understand all of it but I’ll try step by step.
[quote=“TheVinn”]You could set a clip region to a roundrect (make a Path, use addRoundedRectangle, then set it as the clip on the Graphics).
Or, you could create an Image with an alpha channel, draw a rounded rectangle into the alpha channel to give it shape and draw the image via the Graphics.[/quote]
I know this is old, but I can’t seem to find a way to clip by a rounded rectangle.
Graphics.excludeClipRegion only receives rectangles, not paths… Is that even possible?