3 Replies Latest reply on Jul 14, 2011 1:31 PM by cannyshammy

    Very Strange Filter + BitmapData Issue

    cannyshammy

      Hi Guys,

       

      Im having a really odd issue with the rendering of my game and I was wondering if anyone could help.

       

      What im seeing is an odd white outlining around the edge of my sprite:

       

      Shot_06.png

       

      Its really odd, the outline only becomes visible after applying my ColorMatrixFilter. There is no outline on the asset itself.

       

      The important bits of my code are as follows:

       

       

      // Constructing the filter

      var a:Array = new Array();

      a=a.concat([1,0,0,-0.38,0]);// red

      a=a.concat([0,1,0,-0.38,0]);// green

      a=a.concat([0,0,1,0,0]);// blue

      a=a.concat([0,0,0,1,0]);// alpha

      var f : ColorMatrixFilter = new ColorMatrixFilter(a);

       

      // Extract out the tile asset

      var s : Sprite = new TILE1();

      var b : Rectangle = s.getBounds(s);

      var m : Matrix = new Matrix();

      m.translate(Math.round(1 - b.x), Math.round(1 - b.y));

       

       

      // Convert it to BMD while applying filter

      _tile = new BitmapData( 2 + b.width, 2 + b.height, true, 0);

      _tile.draw(s, m);

      _tile.applyFilter(_tile, _tile.rect, new Point(), f);

       

      // Render

      _target.copyPixels(_tile, _tile.rect, new Point(100, 100));

       

       

      I have uploaded a small sample project here: http://mikecann.co.uk/DumpingGround/TEST.zip

       

       

      Anyone have a clue whats doing on here?

       

      Cheers,

      Mike