Advanced Mask Usage...

I’m starting a new project and need some information regarding image masks… maybe some of you already have worked with the new graphics 2.0 and masks and can answer my questions?..

I’m just starting to use the new graphics 2.0 and maybe you can help me with my following needs…

  1. Is it possible to draw (like in a paint app) on the screen and use this drawn information instantly (while drawing) as a mask somehow?

  2. Can I use an image group as mask?

  3. How can I use a mask like this for example: I have an image object, like a tree with leaves and I want to “erase” or “recolor” the areas where I paint with my finger on the tree leaves… so not only in a specific area, like a circle, like with the flashlight example but I also need the areas where my finger was to stay “clean” or “recolored”?

Any ideas and help is much appreciated!

Best,

Daniela

Hi there,

  1. We’ve written a function just for that (: http://ragdogstudios.com/?p=1325

  2. It could be possible, following our function example, to completely make the image white/group of images white, I’ll see if I can put that in as soon as I have time.

  3. This should be possible, but to do correctly without performances issues takes a bit of thinking and time. The rough way would be to keep a separated layer with white circles drawn by the finger. You then save that layer into a mask (always following our example), or snapshot it into a texture 2^ with black background and then save and use as a mask, but as I said, doing this will surely make the frame drop to a crawl after a bit. Or also mask with a single circle, and save the actual masked image at each frame (save and reload).

If having a real-time effect is not needed, you can then let the player “erase”, showing them a white trail, and as soon as their finger is released, use that as a mask. It would surely avoid too many performance issue while the player is drawing.

Thank you very much for your help! Much appreciated!

  • Daniela

Hi there,

  1. We’ve written a function just for that (: http://ragdogstudios.com/?p=1325

  2. It could be possible, following our function example, to completely make the image white/group of images white, I’ll see if I can put that in as soon as I have time.

  3. This should be possible, but to do correctly without performances issues takes a bit of thinking and time. The rough way would be to keep a separated layer with white circles drawn by the finger. You then save that layer into a mask (always following our example), or snapshot it into a texture 2^ with black background and then save and use as a mask, but as I said, doing this will surely make the frame drop to a crawl after a bit. Or also mask with a single circle, and save the actual masked image at each frame (save and reload).

If having a real-time effect is not needed, you can then let the player “erase”, showing them a white trail, and as soon as their finger is released, use that as a mask. It would surely avoid too many performance issue while the player is drawing.

Thank you very much for your help! Much appreciated!

  • Daniela