1

I'm gonna force a BitmapData smooth.

but I can't do BitmapData.draw() because the performance of application.

If I draw Bitmap, the application slow down to next step. (this is on flex mobile)

so I need how to force bitmapData smooth without redraw bitmapData.

(also, I can't use Bitmap(bitmapData).smoothing)

what can I do for this?

Joe Taras
  • 15,166
  • 7
  • 42
  • 55
  • try using texture and gpu rendering, look for [starling framework](https://www.google.com/search?q=as3+starling+smooth+texture) – payam_sbr Dec 16 '16 at 07:14

1 Answers1

1

You're assuming the only way to smooth the pixels in a bitmapData is by re-drawing the bitmap container with the smoothing boolean set to true in BitmapData.Draw().

Solution is to set smoothing on the container Bitmap object itself, not the internal bitmapData. Later you can always update the bitmapData but the Bitmap object will always be smoothed.

Logic is something like below :

var myBMPData : BitmapData = new BitmapData(320, 240);
myBMPData.draw( someThing ); //just draw, no smoothing here for BitmapData

var myBMP : Bitmap = new Bitmap( myBitmapData );
myBMP.smoothing = true; //use smoothing on Bitmap that holds bitmapData

addChild(myBMP);
VC.One
  • 14,790
  • 4
  • 25
  • 57
  • No you said you can't use (quote) `Bitmap(bitmapData).smoothing` which is still targeting the bitmapData itself. If BMPdata is 100w x 100h then you force CPU to handle 10 000 items (pixels). I suggest `Bitmap.smoothing` which targets only 1 item for CPU effort and no `draw`ing is involved. Seems strange but that's how it is... I see it even in 3D graphics software (1 million polys selected for moving = slow VS 1 group object containing same millions of polys = fast). So **smooth the container** not the individual pixels (bitmapdata). The visual effect result is same. – VC.One Dec 20 '16 at 06:57
  • Show example code of **how to re-create your issue**... Is there a technical reason or limitation why you can't use `Bitmap.smoothing` at all? Otherwise you gotta write your own bi-linear filter for smoothing. Try using some gpu-based [**Pixel Bender smoother**](http://www.smart-page.net/blog/2010/02/21/smartaa-reconstruct-anti-aliasing-with-pixel-bender/) code in your AS3 project. Check online tutorials how to import PBJ to use as `=new shader()` object within AS3 code. That's just one example anyways. – VC.One Dec 20 '16 at 07:07