[render] tankz colors

This commit is contained in:
2018-02-08 23:12:10 +03:00
parent dd1014e230
commit a7effef412
26 changed files with 66 additions and 61 deletions

View File

@@ -8,8 +8,9 @@ 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(1, 1, 1, 1, color.red, color.green, color.blue, color.alpha);
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;
}