Wednesday, July 13, 2011

Image Mask Test Project

As mentioned in this post on iPhone Dev SDK forum, there's this discussion about how to create a dynamic mask. Where a mask layer is presented above another photo layer and when user moves his/her finger on it, the photo below will be revealed.


This sounds like an interesting project, although have to admit it's far beyond my level of objective-c skills..... Did some research and found 2 links:
http://www.iphonedevsdk.com/forum/245649-post15.html
http://www.ifans.com/forums/showthread.php?t=132024

which gave me some idea. I sort of combined the two and created a small project with "similar" effect. Unfortunately I don't know how to "fill the whole screen with a solid colour" yet (yes it's a bit embarrassing...), so I sort of do it in a slightly different way.

As shown below, when the project starts, it shows the full image, then user starts moving finger to draw something (this mimics the fill up full screen with solid colour part :-P ). After that, click on "switch" to switch to "erase" mode, and the then when user moves finger around, the red paint get erased and revealed the photo below.....

Ok, I agree this is not exactly what the original request is asking for, but I guess if somehow i can work out how to fill up the full screen with some colour, I can just start with the "erase" mode and that should be quite close to the original request.... Leave this for future project then.

[UPDATE] See this post about info from analysing source code from the site http://buildingmyworld.wordpress.com/ which has better solution than mine.

Source for Image Mask Test Project

0 comments:

Post a Comment