Showing posts with label iOS;iPhone; UIImage;UIImageView;Reflection;Scaling; translation. Show all posts
Showing posts with label iOS;iPhone; UIImage;UIImageView;Reflection;Scaling; translation. Show all posts

Wednesday, 18 May 2011

Understanding the image reflection

There is a sample provided by Apple to demonstrate UIImageView reflection effect as implemented in iTunes and iPod player applications. Although it is a small sample but it covers number of concepts which if understood properly could be very helpful for developers and could be used  in other scenarios. In next couple of posts, I would like to cover following concepts which are used in this example:
  1. Image inversion.
  2. Gradient
  3. Masking
Today I will discuss image inversion. In my next posts I have discussed Gradient and Masking. If you are looking for complete example which includes image inversion, gradient and masking then you can refer my post about image masking. For this post, I have provided sample code which you can download and test on your machine. The output of our application will look like as in the picture below. Note that we not only want to vertically invert our image but we also want to control the height of reflection which is being displayed.