θυοιβ

ActionScript3
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

翻轉bitmap圖

Posted on 2011-03-04 04:43  ichow  阅读(410)  评论(0)    收藏  举报
package {
    import flash.display.Bitmap;
    import flash.display.BitmapData;
	
    public class Bitmapchange {

        public static function upanddown(bt:BitmapData):BitmapData {
            var bmd:BitmapData = new BitmapData(bt.width, bt.height, true, 0x00000000);
            for (var xx=0; xx<bt.width; xx++) {
                for (var yy=0; yy<bt.height; yy++) {
                    bmd.setPixel32(xx, bt.height-yy-1, bt.getPixel32(xx,yy));
                }
            }
            return bmd;
        }

        public static function rightandleft(bt:BitmapData):BitmapData {
            var bmd:BitmapData = new BitmapData(bt.width, bt.height, true, 0x00000000);
            for (var yy=0; yy<bt.height; yy++) {
                for (var xx=0; xx<bt.width; xx++) {
                    bmd.setPixel32(bt.width-xx-1, yy, bt.getPixel32(xx,yy));
                }
            }
            return bmd;
        }
    }
}
胆大心细脸皮厚