I try to darken the surrounding area of my UIImageView and leave the part alone (which I define with my mask).
Now I define my mask and set my imageView.layer.mask, but instead of darkening the rest of the image, it completely removes it.
An example of the type of effect I want: 
An example of what I get: 
Reference documents mention that the mask uses its layer alpha, so I tried to manipulate the opacity of the mask. However, this only affects the opacity of the part that I want to leave alone, while the rest of the image is still completely cut out.
Can someone point out what I'm doing wrong? Thanks.
Here is my code:
CAShapeLayer *mask = [CAShapeLayer layer]; GMutablePathRef path = CGPathCreateMutable(); CGPathMoveToPoint(path, nil, 1052, 448); CGPathAddLineToPoint(path, nil, 2, 484); CGPathAddLineToPoint(path, nil, 54, 1263); CGPathAddLineToPoint(path, nil, 56, 1305); CGPathAddLineToPoint(path, nil, 380, 1304); CGPathAddLineToPoint(path, nil, 1050, 1311); CGPathCloseSubpath(path); mask.path = path; CGPathRelease(path);