概述
iOS shouldRasterize 详解 是否光栅化
- /* When true, the layer is rendered as a bitmap in its local coordinate
- * space ("rasterized"), then the bitmap is composited into the
- * destination (with the minificationFilter and magnificationFilter
- * properties of the layer applied if the bitmap needs scaling).
- * Rasterization occurs after the layer's filters and shadow effects
- * are applied, but before the opacity modulation. As an implementation
- * detail the rendering engine may attempt to cache and reuse the
- * bitmap from one frame to the next. (Whether it does or not will have
- * no affect on the rendered output.)
- *
- * When false the layer is composited directly into the destination
- * whenever possible (however, certain features of the compositing
- * model may force rasterization, e.g. adding filters).
- *
- * Defaults to NO. Animatable. */
- @property BOOL shouldRasterize;
- /* The scale at which the layer will be rasterized (when the
- * shouldRasterize property has been set to YES) relative to the
- * coordinate space of the layer. Defaults to one. Animatable. */
- @property CGFloat rasterizationScale;
当shouldRasterize设成true时,layer被渲染成一个bitmap,并缓存起来,等下次使用时不会再重新去渲染了。
对于layer的shouldRasterize属性默认为NO,将此属性设置为YES时,会在对应的本地坐标空间创建一张bitmap图片,用来缓存图片,当在layer上添加filters或者shadow effects等特效时,将自动开启光栅化的功能,光栅化的开启与否不会影响最总的render output 既最终的渲染输出,但是有一点要注意,开启光栅化虽然不会影响最终的输出结果,但是却可能严重影响性能。
最后
以上就是跳跃大山为你收集整理的iOS shouldRasterize 详解 是否光栅化的全部内容,希望文章能够帮你解决iOS shouldRasterize 详解 是否光栅化所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复