Problem with Setting a Mask to an Image

Hello all,

Was wondering if I could get some help on this… I have two images, one is the icon and one is the mask.  The mask seems to follow the rules specified in http://docs.coronalabs.com/guide/media/imageMask/index.html

Code:

local icon = display.newImageRect("assets/images/HUD/Heart\_1.png", 64, 64); icon.x = \_w; icon.y = \_h; local mask = graphics.newMask("assets/images/HUD/Heart\_2.png"); icon:setMask(mask); icon.maskX = \_w; icon.maskY = \_h;

The image and mask are the same size as well.  However, the icon completely disappears once the mask is applied.  I’ve tried repositioning the mask different ways, as maybe it was being offset in an odd way, but it doesn’t seem to help.  I tried scaling the mask to make it huge, and maybe determine how it was being offset (if it was) but this still did not help (I also did the opposite, scaled the image huge to see where the mask might be, but nothing showed).  The image displays fine when the mask isn’t applied.  What could be wrong?  I’ve even tried doing this in graphics version 1 and still nothing.

The mask coordinates doesn’t look right. The mask coordinates is relative to the image (not the screen).

try setting “icon.maskX = 0” & y, and play around with those values.

Strangely, just using a bigger image seemed to do the trick… I guess the mask I had (64x64) was too small to work, even though it followed the guidelines?  And I don’t know that the coordinates are linked to the image… not only did this same exact code work perfectly for a different sized mask, but every example I’ve seen of masks has the mask’s position being set to the same as the object it’s applied to (whether a group or image).  

Thanks anyway, though.  At least it’s fixed.

The mask coordinates doesn’t look right. The mask coordinates is relative to the image (not the screen).

try setting “icon.maskX = 0” & y, and play around with those values.

Strangely, just using a bigger image seemed to do the trick… I guess the mask I had (64x64) was too small to work, even though it followed the guidelines?  And I don’t know that the coordinates are linked to the image… not only did this same exact code work perfectly for a different sized mask, but every example I’ve seen of masks has the mask’s position being set to the same as the object it’s applied to (whether a group or image).  

Thanks anyway, though.  At least it’s fixed.