dop2000
dop2000

Reputation: 597

Flex mobile: How to disable scale smoothing for sprite/bitmap

In my Flex mobile project I need to draw a sprite with a couple of lines and rectangles and then rotate/scale it without edges smoothing. The problem is - when the sprite is drawn the first time, there is no smoothing, but once it get rotated/scaled, lines and rectangles edges become smoothed (or anti-aliased?). And they remain smoothed even when rotation is set back to 0 and scaleX scaleY are set back to 1.

I tried converting my sprite to bitmap like this:

stage.quality=StageQuality.LOW; // for performance reasons
.......
var tempSprite:Sprite=new Sprite();
// draw stuff on tempSprite

var b:BitmapData = new BitmapData(w, h, true, 0x0);
b.draw(tempSprite,null,null,null,null,false); // smoothing=false
var bitmap:Bitmap = new Bitmap(b,"auto",false); // smoothing=false
bitmap.smoothing=false; 
myUIComponent.addChild(bitmap);

But it didn't help - still the bitmap becomes smoothed when it is rotated/scaled.

So, my question: is it possible to disable smoothing completely or at least return sprite to an unsmoothed state when rotation and scale values are reset?

Upvotes: 2

Views: 973

Answers (1)

GrizzlyMrDan
GrizzlyMrDan

Reputation: 11

If you're using AIR for mobile and enabling GPU mode then your bitmaps will always be smoothed. All you can really do is hide the smoothing by not scaling/rotating your bitmaps and making sure that none of the containers in the draw list hierarchy are either. I had a similar problem to yours and my only fix would've meant rewriting my display scaling code so I just lived with the blurriness until my next project.

Upvotes: 1

Related Questions