E-mail Comment Del.icio.us Digg Reddit Technorati Furl

两个翻转BitmapData的函数

这几天一直在烦恼图片的旋转啦,切割啦,对座标啦,等等等……

贴几个函数.

//向右旋转90度
public function scaleRight(bmp:BitmapData):BitmapData{
var m:Matrix = new Matrix();
m.rotate(Math.PI/2);
m.translate(bmp.height,0);
var bd:BitmapData = new BitmapData(bmp.height, bmp.width,false);
bd.draw(bmp,m);
return bd;
}
//向左旋转90度
public function scaleLeft(bmp:BitmapData):BitmapData{
var m:Matrix = new Matrix();
m.rotate(-Math.PI/2);
m.translate(0,bmp.width);
var bd:BitmapData = new BitmapData(bmp.height, bmp.width,false);
bd.draw(bmp,m);
return bd;
}

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">