改变彩色图像的阴影。线程中的示例。 [闪; AS3] [英] Changing the shade of color images. Example in thread. [Flash; as3]

查看:231
本文介绍了改变彩色图像的阴影。线程中的示例。 [闪; AS3]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着用ColorTransform来做到这一点,但它改变了透明像素: http://savepic.su/2068100建议如何快速改变图像中色彩的色调并保存透明像素。

您可以使用 ColorMatrixFilter ,它对每个像素的 [R,G,B,A]执行矩阵变换。 / code> vector。



例如,添加 25 。每个像素的绿色成分乘以 0.8

  var filter:* = new ColorMatrixFilter([
1.2,0,0,0,25,
0,0.8,0,0,0,
0,0,0,0,0
0,0,0,1,0
]);

如果您想要执行实际的色相转换构造一个矩阵,围绕 [1,1,1] 旋转 [R,G,B] >矢量。但是我猜测这比你之后的更多。


I try to do this with ColorTransform, but it changes the transparent pixels: http://savepic.su/2068100.png

Advise how to quickly change the hue of colors in the image and save the transparent pixels.

解决方案

You can use ColorMatrixFilter instead, which performs a matrix transform on each pixel's [R, G, B, A] vector.

For example, the following filter multiplies each pixel's red component by 1.2 and adds 25. Each pixel's green component is multiplied by 0.8.

var filter:* = new ColorMatrixFilter( [
    1.2, 0  , 0  , 0, 25,
    0  , 0.8, 0  , 0,  0,
    0  , 0  , 1  , 0,  0,
    0  , 0  , 0  , 1,  0
] );

If you want to do an actual hue shift, you'll have to construct a matrix that rotates the [R, G, B] 3D vector around the [1, 1, 1] vector. But I'm guessing that's more involved than what you're after.

这篇关于改变彩色图像的阴影。线程中的示例。 [闪; AS3]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆