I have a problem with masking images. I play a puzzle and must make custom images. I found and tried two ways to custom crop:
- Use of property
CALayer.mask. - Use of property
UIImage.mask.
In the first case, I create my own path, and then assigns it to the property CAShapeLayer.path, and then assigns the property CAShapeLayerto CALayer.mask. At the end, I have a custom cropped image. In the second option, I use the method first CGImageMaskCreate()(I use the previously created images of the black puzzle mask), then CGContextClipToMask(). In both cases, I have a performance problem (mainly when I crop the image into 16 puzzles and drag it around the screen).
Are there any other approaches to crop the image in my own way. (I do not know how to solve the performance problem). Thanks in advance.
source
share