3 Replies Latest reply on Nov 10, 2010 10:17 AM by fpMonster

    pixelbander "eats" memory

    Ed Ryzhov

      I tried to just mix the two images, using your crossfade shader example.

       

      Images size 640*480 each.

       

      as3 source here.

       

      public class shaders extends Sprite
      {
      [Embed(source="i1.jpg")]
      private var k_i1:Class;
      private var b_i1:Bitmap = new k_i1();

       

      [Embed(source="i2.jpg")]
      private var k_i2:Class;
      private var b_i2:Bitmap = new k_i2();

       

      [Embed("../pbj/crossfade.pbj", mimeType="application/octet-stream")]
      private var shad:Class;

      private var dstBd:BitmapData = new BitmapData(640, 480, false, 0xFF00FF00);
      private var bmp:Bitmap = new Bitmap(dstBd);

      private var shader:Shader = new Shader(new shad() as ByteArray);

      public function shaders()
      {
      addChild(bmp);

      addChild(new Stats());
      addEventListener(Event.ENTER_FRAME, onFrame);
      shader.data.frontImage.input = b_i1.bitmapData;
      shader.data.backImage.input = b_i2.bitmapData;
      shader.data.intensity.value = [0.5];
      }



      public function onFrame(e:Event):void
      {
      dstBd.lock();
      var shJob:ShaderJob = new ShaderJob(shader, dstBd, 256, 256);
      shJob.start(true);
      dstBd.unlock();
      }

      }

       

      Memory jumps from 6 to 170 megabytes, and vice versa.

       

      What am I doing wrong?

       

      Examples from the internet is working fine.

      FlashBuilder4, FP10.1, SDK from 3.5 to the last Hero.