2

Typically, it will be presented like Figure 3, if use the image masking by below codes,

let maskLayer = CALayer()
maskLayer.contents = [CGImage Object]    // CGImage Object is Figure 2
imageView.layer.mask = maskLayer

But, I want to get the reversed result.
The black area of Figure 2 is clear color.
Yes, I can use reversed image for masking.
Let us assume that the size of Figure 1 is 100x100, Figure 2 is 30x30.
The Result is same with Figure 3.
But, the expected result should present Figure 1 area that outside of Figure 2(masking image), like Figure 4.
How can I do that?

enter image description here

Figure 1

enter image description here

Figure 2

enter image description here

Figure 3

enter image description here

Figure 4

Jaylon
  • 55
  • 7
strawnut
  • 359
  • 5
  • 21
  • https://stackoverflow.com/questions/42238603/reverse-a-calayer-mask ? – Larme Oct 29 '19 at 13:19
  • @Larme I already checked it. My needs is a little bit different. In that example, the foreground image's out area of masking image area was clipped. And the inside area of characters is show for foreground image. my needs is just exactly reversed. – strawnut Oct 30 '19 at 06:59

0 Answers0