I’m using a Bitmap cache that stores down a few Bitmaps. I called scaleX/scaleY on some of them, but the next time I retrieve from the cache, the Bitmap is screwed up. How does scaleX/scaleY work with Bitmap?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is really going to depend on your “cache” and how it’s implemented, BUT it sounds like it is reusing Bitmap objects, and sharing BitmapData across them. Assuming that, I can tell you the following:
Bitmap is just a wrapper for BitmapData, so if you apply transformations to the Bitmap, those transformations will still apply if you attach a new BitmapData object to it. It sounds like the “cache” is not resetting the Bitmap objects before returning them to you (as a new object, but really its a recycled object)
SO it’s not that scaleX and scaleY work any different on Bitmaps, it’s that the “cache” is recycling them and not resetting them. Sounds like you will have to manually reset them, you could just set the scaleX/y to 1 for each “new” Bitmap you get.
To reiterate, I’m making assumptions about the cache, but this seems probable.