I'm putting an image into a CALayer that could be irregularly transparent:
theCardLayer.front = [CALayer layer];
theCardLayer.front.contents = (id)[cardDrawing CGImage];
In other words, it might be a square filling the layer or it might be an octagon that leaves the corners see-through.
I want to sometimes darken this layer, but without darkening the see-through bits. Any suggestions for how to do so in a programmatic way?
Copyright Notice:Content Author:「Shannon A.」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/3755154/how-to-darken-an-irregularly-shaped-transparent-calayer-on-the-iphone