Mask images not working...

Even if I grab the circlemask.png from the flashlight sample and put it in my app, the mask is the size of the file and not the size of the circle.

Has anyone else experienced this and/or anyone have a direction to point me in to solve it?   I’m actually just trying to update an older app that was previously created with Corona, but under the graphics 1.  It DID work fine and it’s in the app store from 2 years ago. :wink:

(And even if I flip it back to graphic 1 compatibility, I still have the same problem.)

Getting a bit frustrated with this one so I thought I’d drop a post and see if anyone else has been through this…  I feel like I’m missing something obvious, but alas…  I dunno.

Thanks,

~~Kenn

Does the flashlight sample work?

Yes, it sure does.  Which is part of my stumpedness… :wink:

Without seeing your code, I can’t even begin to speculate.  I would suggest looking at how you’re loading the image you’re masking and how you’re loading the mask and see what the differences are.

Rob

Right, it’s tough code to share, of course.  

Are there any “new” requirements for the image being masked – not the mask image?  As noted, it worked OK in Corona a couple years ago.  Opening the same code and images and running them in the current Corona just fails.  

(Thought it would be easy to update and add some space for iPhone 5.  Ha ha on that. ;-))

Anyway … I figured it was a shot in the dark posting.  Had hoped maybe someone else ran into something similar updating an app. :slight_smile:

(And when I say fails, I mean the entire mask image shape is masked – so like using the flashlight mask – instead of the circle being masked, it’s just the whole square image showing through in my code.)

We changed the graphics engine last summer.  One of the thing that changed was positioning items.  Before, when you passed an X, Y to a function to create an object, it could be the top left corner or it could be the center.  The API was inconsistent.   Now all X, Y’s are the center of the object.

It’s possible that if you’re using older code, you could be positioning things using a top left scheme when it should be centered.

Rob

Yeah, I figured out the positioning thing early on in the update.  

But I have no problem positioning it … it’s just a square the dimensions of the file … rather than an mask as intended in the file.  IE;  the flashlight ciclemask.png doesn’t mask a circle, it masks the full square of the mask image.

I’ll keep at it. :slight_smile:

Ah…  Ok, the issue that it doesn’t change the mask file …

I’m using different masks and previously you could set a new mask and it would pick that up.

I will look more into the changing mask thing.  Apparently I’m doing something not kosher with that.

Keep in mind the mask rules:  evenly divisible by 4 on each dimension and at least 3 black pixels on all borders.

Rob

Yes… Bingo.

You used to be able to just “setMask” to a new mask file and it would flip to that mask.

Now you have to put a “setMask(nil)” between sets.

So old way used to work:

newScreen.touchBkgd:setMask( "someMask.png" ) ... some code here ... newScreen.touchBkgd:setMask( "someOtherMask.png" )

And now you have to…

newScreen.touchBkgd:setMask( "someMask.png" ) ... some code here... newScreen.touchBkgd:setMask( nil ) newScreen.touchBkgd:setMask( "someOtherMask.png" )

Anyway – wanted to document that here incase anyone else runs into it. :wink:

Yeah –  I knew the mask file was OK because I was using the flashlight mask file to test. :wink:

The culprit posted above … you must setMask (nil) between mask changes.  That’s a “newer thang”. :wink:

Does the flashlight sample work?

Yes, it sure does.  Which is part of my stumpedness… :wink:

Without seeing your code, I can’t even begin to speculate.  I would suggest looking at how you’re loading the image you’re masking and how you’re loading the mask and see what the differences are.

Rob

Right, it’s tough code to share, of course.  

Are there any “new” requirements for the image being masked – not the mask image?  As noted, it worked OK in Corona a couple years ago.  Opening the same code and images and running them in the current Corona just fails.  

(Thought it would be easy to update and add some space for iPhone 5.  Ha ha on that. ;-))

Anyway … I figured it was a shot in the dark posting.  Had hoped maybe someone else ran into something similar updating an app. :slight_smile:

(And when I say fails, I mean the entire mask image shape is masked – so like using the flashlight mask – instead of the circle being masked, it’s just the whole square image showing through in my code.)

We changed the graphics engine last summer.  One of the thing that changed was positioning items.  Before, when you passed an X, Y to a function to create an object, it could be the top left corner or it could be the center.  The API was inconsistent.   Now all X, Y’s are the center of the object.

It’s possible that if you’re using older code, you could be positioning things using a top left scheme when it should be centered.

Rob

Yeah, I figured out the positioning thing early on in the update.  

But I have no problem positioning it … it’s just a square the dimensions of the file … rather than an mask as intended in the file.  IE;  the flashlight ciclemask.png doesn’t mask a circle, it masks the full square of the mask image.

I’ll keep at it. :slight_smile:

Ah…  Ok, the issue that it doesn’t change the mask file …

I’m using different masks and previously you could set a new mask and it would pick that up.

I will look more into the changing mask thing.  Apparently I’m doing something not kosher with that.