[Solved] Bitmap masks on android?

So, in the game I’m working on we use bitmap masks in several locations (for input, scrollView widgets, and visuals) and they all work fine on iOS devices. On android devices (tested on three different devices) none of the bitmap masks worked at all. I’ve looked for similar cases, but have not seen any. Thoughts?
Solution found! I was using .bmp files for the masks rather than .png files. Once I changed over to using .png files everything worked just as intended. [import]uid: 143007 topic_id: 29910 reply_id: 329910[/import]

All I can say is I am using bitmasks in several places and it works in iOS and android both…

Did you try one of the sample apps that uses bitmask (flashlight?). If that works, try substituting your bitmask in there and try again. If THAT works, then it’s your code that’s at fault. If that doesn’t work, your bitmask is hinky. [import]uid: 160496 topic_id: 29910 reply_id: 119913[/import]

Thanks for the suggestions, will try it shortly. [import]uid: 143007 topic_id: 29910 reply_id: 119915[/import]

Just wanted to check with you since you have mentioned that you have been using bitmasks …

  1. Have you used bitmasks on images that has been scaled down from original sizes?

  2. If yes, what are your suggestions or settings for getting bitmasks to work properly?

Thanks,
Rajesh. [import]uid: 48484 topic_id: 29910 reply_id: 119966[/import]

Actually I am using bit masks on display groups to limit what is displayed to only what is inside some rectangle (like for my own wheel picker). There are no images, and the bitmask is stretched into the area using the mask scales. Works everywhere as far as I can tell…

If it doesn’t work on image itself, try putting it into a display group and applying the bit mask to it. [import]uid: 160496 topic_id: 29910 reply_id: 119968[/import]

sps3,

  1. Please let us know when you’ve tried the demo (flashlight or x-ray) on your device(s). It will be useful to know if they worked for you.

  2. What image format and color depth are you saving your mask as? I’ve sometimes made the mistake of saving images in a non-standard color depth. This would cause them to work on some devices and not others. (e.g. PNG saves as RGBA8888 [8 bits per channel] would work fine, but RGBA4444 might not.) [import]uid: 110228 topic_id: 29910 reply_id: 119971[/import]

Thanks Mike, applying the mask on the group (rather than on a scaled image) works!

And, it works only if I don’t set any values on maskScaleX and maskScaleY.

Looks like, its a defect/bug that it doesn’t work on images that’s scaled. [import]uid: 48484 topic_id: 29910 reply_id: 120175[/import]

  1. I tried Flashlight example, it works. The issue is only when you scale down an image and apply the mask on the image.

  2. Workaround seems to be what Mike has suggested - apply the mask on a group that contains the image than on the image itself.

Thanks. [import]uid: 48484 topic_id: 29910 reply_id: 120176[/import]

Sorry for not responding to this post, soon after I posted this I was assigned a higher priority task and had to switch off.

I tried the flashlight app, and it works fine on the android, so something with the way we’re using them specifically is what is messing it up. I’ll look into other suggestions tomorrow to try and hunt this bug down. [import]uid: 143007 topic_id: 29910 reply_id: 120408[/import]

Solution found! I was using .bmp files for the masks rather than .png files. Once I changed over to using .png files everything worked just as intended. [import]uid: 143007 topic_id: 29910 reply_id: 120511[/import]

All I can say is I am using bitmasks in several places and it works in iOS and android both…

Did you try one of the sample apps that uses bitmask (flashlight?). If that works, try substituting your bitmask in there and try again. If THAT works, then it’s your code that’s at fault. If that doesn’t work, your bitmask is hinky. [import]uid: 160496 topic_id: 29910 reply_id: 119913[/import]

Thanks for the suggestions, will try it shortly. [import]uid: 143007 topic_id: 29910 reply_id: 119915[/import]

Just wanted to check with you since you have mentioned that you have been using bitmasks …

  1. Have you used bitmasks on images that has been scaled down from original sizes?

  2. If yes, what are your suggestions or settings for getting bitmasks to work properly?

Thanks,
Rajesh. [import]uid: 48484 topic_id: 29910 reply_id: 119966[/import]

Actually I am using bit masks on display groups to limit what is displayed to only what is inside some rectangle (like for my own wheel picker). There are no images, and the bitmask is stretched into the area using the mask scales. Works everywhere as far as I can tell…

If it doesn’t work on image itself, try putting it into a display group and applying the bit mask to it. [import]uid: 160496 topic_id: 29910 reply_id: 119968[/import]

sps3,

  1. Please let us know when you’ve tried the demo (flashlight or x-ray) on your device(s). It will be useful to know if they worked for you.

  2. What image format and color depth are you saving your mask as? I’ve sometimes made the mistake of saving images in a non-standard color depth. This would cause them to work on some devices and not others. (e.g. PNG saves as RGBA8888 [8 bits per channel] would work fine, but RGBA4444 might not.) [import]uid: 110228 topic_id: 29910 reply_id: 119971[/import]

Thanks Mike, applying the mask on the group (rather than on a scaled image) works!

And, it works only if I don’t set any values on maskScaleX and maskScaleY.

Looks like, its a defect/bug that it doesn’t work on images that’s scaled. [import]uid: 48484 topic_id: 29910 reply_id: 120175[/import]

  1. I tried Flashlight example, it works. The issue is only when you scale down an image and apply the mask on the image.

  2. Workaround seems to be what Mike has suggested - apply the mask on a group that contains the image than on the image itself.

Thanks. [import]uid: 48484 topic_id: 29910 reply_id: 120176[/import]

Sorry for not responding to this post, soon after I posted this I was assigned a higher priority task and had to switch off.

I tried the flashlight app, and it works fine on the android, so something with the way we’re using them specifically is what is messing it up. I’ll look into other suggestions tomorrow to try and hunt this bug down. [import]uid: 143007 topic_id: 29910 reply_id: 120408[/import]

Solution found! I was using .bmp files for the masks rather than .png files. Once I changed over to using .png files everything worked just as intended. [import]uid: 143007 topic_id: 29910 reply_id: 120511[/import]