Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

[PLEASE HELP] I want to apply 5 masks to one image.
Started by 0x0000ff Feb 29 2020 05:29 AM

8 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

0x0000ff

[GLOBAL: userInfoPane.html]
0x0000ff
  • Contributor

  • 112 posts
  • Corona SDK

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.

 

Attached Files



[TOPIC: post.html]
#2

sporkfin

[GLOBAL: userInfoPane.html]
sporkfin
  • Contributor

  • 809 posts
  • Corona SDK

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.



[TOPIC: post.html]
#3

0x0000ff

[GLOBAL: userInfoPane.html]
0x0000ff
  • Contributor

  • 112 posts
  • Corona SDK

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.


[TOPIC: post.html]
#4

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,974 posts
  • Corona SDK

 

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.



[TOPIC: post.html]
#5

0x0000ff

[GLOBAL: userInfoPane.html]
0x0000ff
  • Contributor

  • 112 posts
  • Corona SDK

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



[TOPIC: post.html]
#6

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Corona Geek

  • 1,246 posts
  • Corona SDK

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?



[TOPIC: post.html]
#7

0x0000ff

[GLOBAL: userInfoPane.html]
0x0000ff
  • Contributor

  • 112 posts
  • Corona SDK

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.)


[TOPIC: post.html]
#8

0x0000ff

[GLOBAL: userInfoPane.html]
0x0000ff
  • Contributor

  • 112 posts
  • Corona SDK

@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.


[TOPIC: post.html]
#9

sporkfin

[GLOBAL: userInfoPane.html]
sporkfin
  • Contributor

  • 809 posts
  • Corona SDK

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.




[topic_controls]
[/topic_controls]