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.
[code]
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
[/code] [import]uid: 616 topic_id: 19252 reply_id: 319252[/import]