Graphics Reference
In-Depth Information
self
.imageView.
layer
.
mask
= maskLayer;
}
@end
Figure 4.13
Our
UIImageView
, after the
mask
layer has been applied
The
really
cool feature of
CALayer
masking is that you are not limited to using static
images for your masks. Anything that can be composed out of layers can be used as the
mask
property, which means that your masks can be created dynamically using code, and
even animated in real time.
The final topic we cover in this chapter is the effect of the
minificationFilter
and
magnificationFilter
properties. Generally on iOS, when you display images, you
should try to display them at the correct size (that is, with a 1:1 correlation between the
pixels in the image and the pixels onscreen). The reasons for this are as follows:
▪
It provides the best possible quality, because the pixels aren't stretched or resampled.
▪
It makes the best use of RAM, because you aren't storing more pixels than needed.
▪
It yields the best performance, because the GPU doesn't have to work as hard.