[PLEASE HELP] I want to apply 5 masks to one image.

I have tested put several groups one inside the other and add mask to them.

Anyway, this method can apply up to 3 masks.

Is there any way to apply 5 masks?

I can not speak English very well.

I also attached the test code because I can’t ask the question correctly.

Corona supports 3 levels so that is a hard limit.  If you can make a snapshot of the masked object and then mask the snapshot I suppose that could be a workaround.  I’m not sure how masks would accept snapshots but there might be a way.

Thank you for answer.

I looked at the newMask documentation and found that it was limited to three.

Very embarrassing.

How can it be possible with snapshots?

I can’t feel it.

You do three masks, take a ‘snapshot’ of the group containing all the images, save that snapshot to disk, load it back as a new image and then continue masking on that image.

I tried it but it doesn’t seem to work. ;-;

I took a quick look at your code and it isn’t clear at all as to what you are trying to accomplish. What do you need five nested masks for precisely?

Yes, four masks must be nested in exactly one sprite.

There is one mask in the entire scene. So a total of five masks can be nested.

(The arrow mask image used in the test code is an image created for the public purpose, and the mask image used in my game is geometric and overlaps with each other.)

@sporkfin As you say, the only way to do this is to dynamically create a mask file and finally apply one mask.

I’m testing because there may be a performance problem, but it was successful.

Depending on your objects.  Another approach could be to have an object and fill it with another object (adjust the fill if needed) and then apply the mask to the first object (3 objects - 2 levels).  You can also mess around with composite paint.  These are all methods of used but they are specific to the ultimate goal and not a generic solution.

I have done mask + image capturing before in the app. But note that performing this will cause the  app to lag. I do this while app is loading or during transitions.  Maybe it will be ok on newer & faster phones. 

After applying the mask + image, do a screen capture using display.captureBounds or display.captureScreen

Remember the 3-layer max limit, and this also includes any scroll view, text, etc that you have.

http://docs.coronalabs.com/api/library/display/captureBounds.html