Выкладываю функцию которая помогает при растеризации векторной графики. Особенность в том что учитиваются смещения и скейл.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | // Help Rasterizing static private function getBitmap(originClip:DisplayObject):BitmapData { if (originClip.width > 0 && originClip.height > 0) { var m:Matrix = new Matrix(); var r:Rectangle = originClip.getRect(originClip); r = normlizeRect(r); m.translate(-r.x, -r.y); m.scale(originClip.scaleX, originClip.scaleY); var tmpBD:BitmapData = new BitmapData(r.width, r.height, true, 0x000000); tmpBD.draw(originClip, m, null, null, null, true); return tmpBD; } else return null; } // static private function normlizeRect(rLoc:Rectangle):Rectangle { rLoc.x = Math.ceil(rLoc.x); rLoc.y = Math.ceil(rLoc.y); rLoc.width = Math.ceil(rLoc.width); rLoc.height = Math.ceil(rLoc.height); return rLoc; } |
1 комментарий для поста Растеризация мувиков с помощью as3
Patrick | 18.04.2012 в 10:18


Спасибо!