Would be great if you could expose the width and height of the loaded mask image, so we could access the mask's source images dimensions.
The reason is that I need to move and scale the mask relative to the object it is masking. Without the width/height I can't set the ratios properly to do the calculations needed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | local containerW = 200 local containerH = 400 local group = display.newGroup() local bkgd = display.newRect( 0, 0, containerW, containerH ) local image = display.newImage("something.jpg") local mask = graphics.newMask( imgMask ) -- Would like to set the scaling dynamically based on the container dimensions: local maskW = mask.width local maskH = mask.height local myMaskScaleX = containerW/maskW local myMaskScaleY = containerH/maskH group:insert(bkgd) group:insert(image) group:setMask(mask) -- Would automatically scale the mask to match the container dimensions: group.maskScaleX = myMaskScaleX group.maskScaleX = myMaskScaleY -- OR perhaps to keep the existing mask property conventions: local maskW = group.maskWidth local maskH = group.maskHeight local myMaskScaleX = containerW/maskW local myMaskScaleY = containerH/maskH group.maskScaleX = myMaskScaleX group.maskScaleY = myMaskScaleY |