flash.geom.ColorTransform 类可以实现将图片中RGB格式的内容转变:
ColorTransform(redMultiplier, greenMultiplier, blueMultiplier, alphaMultiplier,
redOffset, greenOffset, blueOffset, alphaOffset);
计算公式:newRed = oldRed * redMultiplier + redOffset;
可以拿一张图片来试验下:
package {
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.geom.ColorTransform;
public class TransformColor extends Sprite {
[Embed(source="assets/images/image1.jpg")]
public var Picture:Class;
public function TransformColor() {
init();
}
private function init():void {
var pic:Bitmap = new Picture();
addChild(pic);
pic.transform.colorTransform = new ColorTransform(0.5, 0.4, 0.12, 0.4, 244, 112, 90, 70);
}
}
}