Hi everyone,
I decided to do a little experiment in Flash 8 using the BitmapData class.
What I want to do is render accurate RGB color models and do so in a variety
of useful ways. I'm ultimately creating my own color-picker/color palette
system. So, I decided to start by using the BitmapData class:
myColorModel = new BitmapData(510,255,false,0xFFFFFFFF);
this.createEmptyMovieClip("holder",1);
function ARGBtoHex(a:Number, r:Number, g:Number, b:Number){
return (a<<24 | r<<16 | g<<8 | b);
}
for(var i=0; i<256; i++){
for(var j=0; j<256; j++){
for(var k=0; k<256; k++){
var thisX = i+k;
var thisY = j;
thisColor = ARGBtoHex(255,i,j,k);
myColorModel.setPixel(thisX,thisY,thisColor);
}
}
}
holder.attachBitmap(myColorModel,1);
Naturally, the nested for loops are a huge performance hit: we're talking
16581375 iterations. This results in a very nice rendering of a color
model: after you hit "no" about 15 times on the "script running slowly:
abort?" dialog. Does anyone have any ideas on how I could speed up the
rendering process?
Thanks,
-tom
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders