Issue with button mask

Hi everyone. Started to learn Corona SDK recently, so I have strange issue:
I used mask for button to make round shape and make touch area round.

Code looks like this:
 

local startMask = graphics.newMask( “start-btn-mask.gif”, 315, 315 )

startBtn = widget.newButton{

label="",

labelColor = { default={255}, over={128} },

defaultFile=“start-btn0.jpg”,

overFile=“start-btn1.jpg”,

width=315, height=315,

fontSize=24,

onRelease = onStartBtnRelease – event listener function

}

startBtn:setMask (startMask)

startBtn.x = menuX

startBtn.y = menuY

startBtn.maskX = 157.5

startBtn.maskY = 157.5

On emulator all looks allright, but on real device (SG Note 3 9005 and on SGS 4) button images looks like mask cropping did not apply.

52375-clip-43kb.jpg

Try using a png file instead of a gif.

with png it looks like this…
I tried 8bit and 24bit png, tried to change size of mask (with 5 extra pixels on each side or not) - effect slightly changes but not much difference…

fb959-clip-20kb.jpg

I had similar issues long ago (pre graphics 2.0 era) and it was related to the pixel dimensions of the image files.
I solved it by resizing the mask png files to Power Of Two (POT) values for width and height. You could try rescaling to 256 pixels and see if it works.
Maybe using width and height sizes as multiple of 4 could be enough but I’m only guessing…,

Hi @bentrizen,

You must follow the mask guidelines listed in the guide and documentation. The dimensions and border are extremely important:

https://docs.coronalabs.com/guide/media/imageMask/index.html

Hope this helps,

Brent

Try using a png file instead of a gif.

with png it looks like this…
I tried 8bit and 24bit png, tried to change size of mask (with 5 extra pixels on each side or not) - effect slightly changes but not much difference…

fb959-clip-20kb.jpg

I had similar issues long ago (pre graphics 2.0 era) and it was related to the pixel dimensions of the image files.
I solved it by resizing the mask png files to Power Of Two (POT) values for width and height. You could try rescaling to 256 pixels and see if it works.
Maybe using width and height sizes as multiple of 4 could be enough but I’m only guessing…,

Hi @bentrizen,

You must follow the mask guidelines listed in the guide and documentation. The dimensions and border are extremely important:

https://docs.coronalabs.com/guide/media/imageMask/index.html

Hope this helps,

Brent