由于在RIA开发中需要对有水的地图场景做一些特效处理比如说倒影,如下图的效果:至于RIA:请访问 q.uen.cn/ria/ria.html 因此,分享一下倒影算法的心得,首先观察倒影的特点如下1,是上下反转的图像2,从上到下透明度越来越大那么我来完成这2步操作:function createRef(p_source:DisplayObject):void{ //对源显示对象做上下反转处理 var bd:BitmapData=new BitmapData(p_source.width,p_source.height,true,0); var mtx:Matrix=new Matrix(); mtx.d=-1;mtx.ty=bd.height; bd.draw(p_source,mtx);//生成一个渐变遮罩 var width:int=bd.width; var height:int=bd.height; mtx=new Matrix(); mtx.createGradientBox(width,height,0.5 * Math.PI); var shape:Shape = new Shape(); shape.graphics.beginGradientFill(GradientType.LINEAR,[0,0],[0.9,0.2],[0,0xFF],mtx) shape.graphics.drawRect(0,0,width,height); shape.graphics.endFill(); var mask_bd:BitmapData=new BitmapData(width,height,true,0); mask_bd.draw(shape);//生成最终效果 bd.copyPixels(bd,bd.rect,new Point(0,0),mask_bd,……