Revision: 25109
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 19, 2010 15:47 by allnatural
Initial Code
// Create the bitmap var imgData:BitmapData = new BitmapData(500, 500, true, 0x00000000); var bmp:Bitmap = new Bitmap(imgData); // Invoke lock( ) imgData.lock( ); // Set pixel color-values var color:uint; for (var i:int = 0; i < imgData.height ; i++) { for (var j:int = 0; j < imgData.width; j++) { color = Math.floor(Math.random( )*0xFFFFFFFF); imgData.setPixel32(j, i, color); } } // Invoke unlock( ) imgData.lock( );
Initial URL
Initial Description
Using lock() and unLock() saves about 20% when doing bulk pixel updates.
Initial Title
BitmapData Set Each Pixel To Random Color
Initial Tags
Initial Language
ActionScript 3