Guest User

Untitled

a guest
Jul 18th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private function __doProcessBitmaps(bitmapData:BitmapData, backgroundColor:uint):void
  2. {
  3.     var maxFramesX:int = (bitmapData.width / __mBlockWidth);
  4.     var maxFramesY:int = (bitmapData.width / __mBlockWidth);
  5.    
  6.     var bitmapDataBuffer:BitmapData = new BitmapData(__mBlockWidth, __mBlockHeight);
  7.     var pointBuffer:Point = new Point;
  8.     var rectangleBuffer:Rectangle = new Rectangle(0, 0, __mBlockWidth, __mBlockHeight);
  9.    
  10.     for (var i:int = 0; i < maxFramesY; i++)
  11.     {
  12.         __mBitmaps.push(new Array);
  13.        
  14.         for (var j:int = 0; j < maxFramesX; j++)
  15.         {
  16.             rectangleBuffer.x = (__mBlockWidth * j) + (j > 0 ? j : 0);
  17.             bitmapDataBuffer.copyPixels(bitmapData, rectangleBuffer, pointBuffer);
  18.            
  19.             var rect:Rectangle = bitmapDataBuffer.getColorBoundsRect(backgroundColor, backgroundColor, false);
  20.            
  21.             if (rect.width && rect.height)
  22.             {
  23.                 var data:BitmapData = new BitmapData(rect.width, rect.height);
  24.                
  25.                 data.copyPixels(bitmapDataBuffer, rect, pointBuffer);
  26.                 data.threshold(data, data.rect, pointBuffer, "==", backgroundColor);
  27.                
  28.                 __mBitmaps[i].push(data);
  29.             }
  30.             else
  31.             {
  32.                 break;
  33.             }
  34.         }
  35.        
  36.         rectangleBuffer.y += (__mBlockHeight + 1);
  37.     }
  38. }
Add Comment
Please, Sign In to add comment