What is going on with masks of display groups and images in them?

My screen is 320x480. My mask file, mask.png is 320x480 with some white, black and slightly opaque black parts. When I set a mask on a display group, the mask is way off. Even though it says it’s maskX and maskY is 0 and 0, I can only see the whole part of my masked display group when I move the mask to 160,240 (the center of my screen)

And how come I can’t set the alpha of images inside my display group, but I can set the alpha to other display objects?

\_W = display.contentWidth  
\_H = display.contentHeight  
  
local dg = display.newGroup()  
local mask = graphics.newMask('mask.png')  
dg:setMask(mask)  
print (dg.maskX,dg.maskY) -- maskX and maskY are 0 and 0 but...  
dg.maskX = 160 -- i have to set this  
dg.maskY = 240 -- and this to the center of the screen  
 -- otherwise i only see the top left corner of the mask  
 -- as if the default maskX and maskY are -160 and -240  
 -- even though printing them shows 0 and 0!  
  
local rect = display.newRect(dg,0,0,\_W,\_H)  
rect.alpha = .5 -- the rect I draw can have its alpha adjusted  
  
local box = display.newImage(dg,'box.png',20,20)  
box.alpha = .5 -- the image I draw can NOT have its alpha adjusted???  

box.png
mask.png
[import]uid: 213270 topic_id: 36144 reply_id: 336144[/import]

Off the top of my head I would think if the x/y is 0,0 then the mask must be setup with a center reference point. I am not familair with using masks much except with my table views.

As for the alpha, that could be a bug that was around for quite some time with masks. I know it was fixed with alpha and table views in a recent daily build. However I don’t know if that fixed masked all the way around.

Your posting account says test driver so you may not have a paid account. If you are using public build .971 then it still has alpha/mask issues. [import]uid: 56820 topic_id: 36144 reply_id: 143552[/import]

Thanks for the info! The reference point was my assumption too, but I didn’t see that behavior when I put mask on other display objects or a way to change the reference points for the mask.

You are correct, I have not committed yet to the full version of Corona and am using build .971. I am still testing the waters, making sure that developing a full app (game actually) is totally doable with Corona.

So I guess I can only hope that this issue won’t arise in the latest build? [import]uid: 213270 topic_id: 36144 reply_id: 143555[/import]

Hi @mike.rp99,
Please see the following API pages on masks, if you haven’t already. Applying a mask to a display group versus a display object requires a re-positioning (for a group) because the group’s inherent top-left reference point.

http://docs.coronalabs.com/api/library/graphics/newMask.html
http://docs.coronalabs.com/api/type/DisplayObject/setMask.html

Also, your mask should have a black border around it of 4 pixels or so. This is documented above. Finally, as of Daily Build 1025, alpha now works on masked images.

Hope this helps,
Brent [import]uid: 200026 topic_id: 36144 reply_id: 143621[/import]

Gotcha. That’s good news that the alphas for masked objects are fixed. And thanks for the info and links to documentation on using masks, Brent! [import]uid: 213270 topic_id: 36144 reply_id: 143677[/import]

Off the top of my head I would think if the x/y is 0,0 then the mask must be setup with a center reference point. I am not familair with using masks much except with my table views.

As for the alpha, that could be a bug that was around for quite some time with masks. I know it was fixed with alpha and table views in a recent daily build. However I don’t know if that fixed masked all the way around.

Your posting account says test driver so you may not have a paid account. If you are using public build .971 then it still has alpha/mask issues. [import]uid: 56820 topic_id: 36144 reply_id: 143552[/import]

Thanks for the info! The reference point was my assumption too, but I didn’t see that behavior when I put mask on other display objects or a way to change the reference points for the mask.

You are correct, I have not committed yet to the full version of Corona and am using build .971. I am still testing the waters, making sure that developing a full app (game actually) is totally doable with Corona.

So I guess I can only hope that this issue won’t arise in the latest build? [import]uid: 213270 topic_id: 36144 reply_id: 143555[/import]

Hi @mike.rp99,
Please see the following API pages on masks, if you haven’t already. Applying a mask to a display group versus a display object requires a re-positioning (for a group) because the group’s inherent top-left reference point.

http://docs.coronalabs.com/api/library/graphics/newMask.html
http://docs.coronalabs.com/api/type/DisplayObject/setMask.html

Also, your mask should have a black border around it of 4 pixels or so. This is documented above. Finally, as of Daily Build 1025, alpha now works on masked images.

Hope this helps,
Brent [import]uid: 200026 topic_id: 36144 reply_id: 143621[/import]

Gotcha. That’s good news that the alphas for masked objects are fixed. And thanks for the info and links to documentation on using masks, Brent! [import]uid: 213270 topic_id: 36144 reply_id: 143677[/import]

Off the top of my head I would think if the x/y is 0,0 then the mask must be setup with a center reference point. I am not familair with using masks much except with my table views.

As for the alpha, that could be a bug that was around for quite some time with masks. I know it was fixed with alpha and table views in a recent daily build. However I don’t know if that fixed masked all the way around.

Your posting account says test driver so you may not have a paid account. If you are using public build .971 then it still has alpha/mask issues. [import]uid: 56820 topic_id: 36144 reply_id: 143552[/import]

Thanks for the info! The reference point was my assumption too, but I didn’t see that behavior when I put mask on other display objects or a way to change the reference points for the mask.

You are correct, I have not committed yet to the full version of Corona and am using build .971. I am still testing the waters, making sure that developing a full app (game actually) is totally doable with Corona.

So I guess I can only hope that this issue won’t arise in the latest build? [import]uid: 213270 topic_id: 36144 reply_id: 143555[/import]

Hi @mike.rp99,
Please see the following API pages on masks, if you haven’t already. Applying a mask to a display group versus a display object requires a re-positioning (for a group) because the group’s inherent top-left reference point.

http://docs.coronalabs.com/api/library/graphics/newMask.html
http://docs.coronalabs.com/api/type/DisplayObject/setMask.html

Also, your mask should have a black border around it of 4 pixels or so. This is documented above. Finally, as of Daily Build 1025, alpha now works on masked images.

Hope this helps,
Brent [import]uid: 200026 topic_id: 36144 reply_id: 143621[/import]

Gotcha. That’s good news that the alphas for masked objects are fixed. And thanks for the info and links to documentation on using masks, Brent! [import]uid: 213270 topic_id: 36144 reply_id: 143677[/import]

Off the top of my head I would think if the x/y is 0,0 then the mask must be setup with a center reference point. I am not familair with using masks much except with my table views.

As for the alpha, that could be a bug that was around for quite some time with masks. I know it was fixed with alpha and table views in a recent daily build. However I don’t know if that fixed masked all the way around.

Your posting account says test driver so you may not have a paid account. If you are using public build .971 then it still has alpha/mask issues. [import]uid: 56820 topic_id: 36144 reply_id: 143552[/import]

Thanks for the info! The reference point was my assumption too, but I didn’t see that behavior when I put mask on other display objects or a way to change the reference points for the mask.

You are correct, I have not committed yet to the full version of Corona and am using build .971. I am still testing the waters, making sure that developing a full app (game actually) is totally doable with Corona.

So I guess I can only hope that this issue won’t arise in the latest build? [import]uid: 213270 topic_id: 36144 reply_id: 143555[/import]

Hi @mike.rp99,
Please see the following API pages on masks, if you haven’t already. Applying a mask to a display group versus a display object requires a re-positioning (for a group) because the group’s inherent top-left reference point.

http://docs.coronalabs.com/api/library/graphics/newMask.html
http://docs.coronalabs.com/api/type/DisplayObject/setMask.html

Also, your mask should have a black border around it of 4 pixels or so. This is documented above. Finally, as of Daily Build 1025, alpha now works on masked images.

Hope this helps,
Brent [import]uid: 200026 topic_id: 36144 reply_id: 143621[/import]

Gotcha. That’s good news that the alphas for masked objects are fixed. And thanks for the info and links to documentation on using masks, Brent! [import]uid: 213270 topic_id: 36144 reply_id: 143677[/import]