0 Replies Latest reply on Mar 14, 2011 5:39 AM by diginature42

    BitmapData.colorTransform glitch

    diginature42

      Hi!

       

      I encounter this problem (white stripe) in every win32 flash players with version 10.2+. Is it a bug?

       

       

      http://i.imgur.com/vPMwK.png

      package 
      {
          import flash.display.Bitmap;
          import flash.display.BitmapData;
          import flash.display.Sprite;
          import flash.events.Event;
          import flash.geom.ColorTransform;
          
          [SWF(backgroundColor = "0x777777", frameRate = "30", width = "200", height = "128")]
          public class Main extends Sprite 
          {
              public function Main():void 
              {
                  if (stage) init();
                  else addEventListener(Event.ADDED_TO_STAGE, init);
              }
              
              private function init(e:Event = null):void 
              {
                  removeEventListener(Event.ADDED_TO_STAGE, init);
                  // entry point
                  
                  var ct:ColorTransform = new ColorTransform();
                  ct.color = 0xFF0000; // RED
                  
                  
                  // PROBLEM: 1-pixel white stripe on the right side of the red square.
                  var bd1:BitmapData = new BitmapData(64, 64, false, 0xFFFFFF);
                  bd1.colorTransform(bd1.rect, ct); // <-- Problem here!
                  var bm1:Bitmap = new Bitmap(bd1);
                  bm1.x = 32;
                  bm1.y = 32;
                  addChild(bm1);
                  
                  // ALL OK: perfect red square.
                  var bd2:BitmapData = new BitmapData(64, 64, false, 0xFFFFFF);
                  var bm2:Bitmap = new Bitmap(bd1);
                  bm2.transform.colorTransform = ct;
                  bm2.x = 32 + 64 + 8;
                  bm2.y = 32;
                  addChild(bm2);
              }
              
          }
          
      }