Chinaunix首页 | 论坛 | 博客
  • 博客访问: 734641
  • 博文数量: 769
  • 博客积分: 6000
  • 博客等级: 准将
  • 技术积分: 4985
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-15 16:37
文章分类

全部博文(769)

文章存档

2011年(1)

2008年(768)

我的朋友

分类:

2008-10-15 16:46:04

function cutLayer_doubleClick_handler(me:MouseEvent)

cutBtn.mouseEnabled=true;
isCut=false 
itf.actionExit(); //缩放编辑对象退出动作

//temp_bmd主要用于copyPixels ()时候alphaBitmapData的获得,简单理解就是遮照层不规则图象获得
var temp_bmd:BitmapData=new BitmapData(org_sprite.width,org_sprite.height,true,0)
//compare_bmd主要是从源bitmapData在遮照层(不规则图象)上复制的象素图象
var compare_bmd:BitmapData=new BitmapData(org_sprite.width,org_sprite.height,true,0)

//画遮照层对图象的位移,缩放,旋转设置
var temp_matrix:Matrix=new Matrix();

temp_matrix.scale(cut_layer.scaleX,cut_layer.scaleY); 
temp_matrix.rotate(cut_layer.rotation/180*Math.PI);
temp_matrix.translate(cut_layer.x,cut_layer.y); 

//因为遮照层采用了一个遮照Mc和一个透明图象,如果copyPixels时不将alphaBitmapData的透明度为最大.那么copy的图象和alphaBitmapData的透明度是一样的
var temp_ctf:ColorTransform=new ColorTransform()
temp_ctf.alphaOffset=255

//画不规则遮照层
temp_bmd.draw(cut_layer,temp_matrix,temp_ctf);

//复制象素
compare_bmd.copyPixels(org_bmd,
org_sprite.getBounds(this),
new Point(0,0),
temp_bmd,
new Point(0,0),
false);

//显现复制图象
compare_bm.bitmapData=compare_bmd;
}
--------------------next---------------------

阅读(464) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~