package ru.m.draw; import flash.geom.ColorTransform; import flash.geom.Rectangle; import flash.display.BitmapData; class BitmapUtil { public static function colorize(data: BitmapData, color: Color):BitmapData { if (color.zero) return data; var result = data.clone(); var transform = new ColorTransform(color.red / 255, color.green / 255, color.blue / 255, 1, 0, 0, 0, 0); result.colorTransform(new Rectangle(0, 0, result.width, result.height), transform); return result; } }