import flash.display.Bitmap;
import flash.display.BitmapData; var picWidth:Number = 450; var picHeight:Number = 450; var endColor:uint = 0xff8080;//红色 var startColor:uint = 0x008080;//蓝色 var middleColor:uint = 0x808080;//中间色(灰色) var myBitmapData:BitmapData = new BitmapData(picWidth,picHeight); function drawMapBitmap(targetData:BitmapData,width:Number,height:Number):BitmapData { var colorDistH = (middleColor - startColor)/picHeight; for (var h=0; h<height; h++) { var thisStartColor:uint = startColor + h*colorDistH; var thisEndColor:uint = endColor - h*colorDistH; var thisColorDistW = (thisEndColor - thisStartColor)/picWidth; for (var w=0; w<width; w++) { var pixelColor:uint = thisStartColor + w*thisColorDistW; targetData.setPixel(w,h,pixelColor); } } return targetData; } var myBitmap:Bitmap = new Bitmap(drawMapBitmap(myBitmapData,picWidth,picHeight)); addChild(myBitmap); |
Word教程网 | Excel教程网 | Dreamweaver教程网 | Fireworks教程网 | PPT教程网 | FLASH教程网 | PS教程网 |
HTML教程网 | DIV CSS教程网 | FLASH AS教程网 | ACCESS教程网 | SQL SERVER教程网 | C语言教程网 | JAVASCRIPT教程网 |
ASP教程网 | ASP.NET教程网 | CorelDraw教程网 |