Fatsest way to edit alpha of CGImage (or UIImage) with touch and then display?
- by Pankaj
I have two image views, one on top of the another, with two different images. As the user touches the image and moves his/her finger, the top image should become transparent along the touch points with a fixed radius. (Like the PhotoChop app).
Currently I am doing it this way...
For each touch.
Get a copy of the image buffer from CGImage of the top image.
Edit the alpha channel of the buffer to create a transparent circle centered at the touch point.
Create new CGImage from the buffer.
Create UIImage from the CGImage and use the new UIImage as the top image view's image.
This works but as you can see too many copy, creates are involved and it is slow.
Can somebody please suggest me a faster way of doing the same thing?