ios - UIImageView 添加了layer mask,想要给mask增加inset
PHPz
PHPz 2017-04-18 09:45:34
0
2
847

最近在做拼图,参考的linecamera, 怎么设置inset呢。

追加问题: 现在出现一个新的问题, 我要改变北京色为图片, 这时候就有问题了,不能是layer压在上面了, 需要用这个layer去做整体的mask,但是,layer的stroke color 设置为透明,fill 黑色,mask之后显示出来的部分只有一半。 因为fill会填充stroke的一半。。。。

PHPz
PHPz

学习是最好的投资!

reply all(2)
Peter_Zhu

Actually, I made this problem complicated myself, and it can be solved by adding a borderLayer.
First subtract the borderwidth from the size of the canvas, construct the path based on the Size, get the borderLayer, and add it.
It’s actually very simple, but there are a lot of things associated with it. There are shapes, editpoints, and other elements on the canvas, and their positions need to be recalculated based on the borderWidth.

左手右手慢动作

Use all gray as the background color, cover it with red and green, and set the view.layer.mask twice to meet the requirements of CAShapeLayer(). Isn’t it quite convenient?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template