Im converting a image into a linear 1 bit array is this the fastest way to it?
btw Sprite.sensibleResult is a threeshold number. Like 0x505050
Code:public function imgToArray() { var c:int; var rx:int; var ry:int; aimage=new Array(imageSize); for (rx=0; rx<imageWidth; rx++) { bitmap.lock(); for (ry=0; ry<imageHeight; ry++) { //aimage[(ry*imageWidth)+rx]= if (bitmap.getPixel(rx,ry)>sprite.sensibleResult) { aimage[(ry*imageWidth)+rx]=true; //bitmap.setPixel(rx,ry,0xFFFFFF); } else { aimage[(ry*imageWidth)+rx]=false; //bitmap.setPixel(rx,ry,0x000000); } //trace(aimage[(ry*imageWidth)+rx]); } bitmap.unlock(); } }




Reply With Quote