dynamic scaling doesn't support mask images?

Hi,

I have a problem with masking - I prepared standard 3 size assets - @x1, @x2 and @x4, all divisible by 4, but no matter the device, corona always uses the smallest mask file which looks blurry on retina devices :frowning:

Any ideas how to fix it?

Thanks!

Whammy,

Hi.  I ran into the same problem recently with my new game (Reflexivity).  I hope that someone answers back with a better answer, but for now, my answer is, “Add code to dynamically select the right mask for the currently selected suffix”. 

This is how I dealt with it:

--print( display.imageSuffix ) if( display.imageSuffix == "@4x" ) then --print( "using 4X" ) mask = graphics.newMask( "images/dialMask4.png" ) hud:setMask( mask ) hud.maskScaleX = 0.23 hud.maskScaleY = 0.23 elseif( display.imageSuffix == "@2x" ) then --print( "using 2X" ) mask = graphics.newMask( "images/dialMask2.png" ) hud:setMask( mask ) hud.maskScaleX = 0.46 hud.maskScaleY = 0.46 else --print( "using 1X" ) mask = graphics.newMask( "images/dialMask.png" ) hud:setMask( mask ) end

Note: I used odd scaling sizes in this case, but you’d probably go with 0.25, 0.5, and 1.0 for 4x, 2x, and 1x.

-Ed

Hey Ed,

Thanks for the solution! Works like a charm now :slight_smile:

Cheers!

Whammy,

Hi.  I ran into the same problem recently with my new game (Reflexivity).  I hope that someone answers back with a better answer, but for now, my answer is, “Add code to dynamically select the right mask for the currently selected suffix”. 

This is how I dealt with it:

--print( display.imageSuffix ) if( display.imageSuffix == "@4x" ) then --print( "using 4X" ) mask = graphics.newMask( "images/dialMask4.png" ) hud:setMask( mask ) hud.maskScaleX = 0.23 hud.maskScaleY = 0.23 elseif( display.imageSuffix == "@2x" ) then --print( "using 2X" ) mask = graphics.newMask( "images/dialMask2.png" ) hud:setMask( mask ) hud.maskScaleX = 0.46 hud.maskScaleY = 0.46 else --print( "using 1X" ) mask = graphics.newMask( "images/dialMask.png" ) hud:setMask( mask ) end

Note: I used odd scaling sizes in this case, but you’d probably go with 0.25, 0.5, and 1.0 for 4x, 2x, and 1x.

-Ed

Hey Ed,

Thanks for the solution! Works like a charm now :slight_smile:

Cheers!

is this now considered the standard way for handling masking with Retina devices?

Hi @jflowers45,

Yes, this is the recommended way of having different masks selected/used based on the device suffix.

Brent

is this now considered the standard way for handling masking with Retina devices?

Hi @jflowers45,

Yes, this is the recommended way of having different masks selected/used based on the device suffix.

Brent