这其中最重要的还是对AS3颜色矩阵滤镜(ColorMatrixFilter)的使用。 上面实例核心的代码为changeImgGray函数,示例使用flex + sdk3.6编写: 1: <? 139: { 140: return new ColorMatrixFilter([n, 0, 0, 0, 128 * (1 - n), 151: { 152: return new ColorMatrixFilter([1, 0, 0, 0, n, 0, 1, 0, 0, 162: { 163: return new ColorMatrixFilter([-1, 0, 0, 0, 255, 0, -1, 0 --颜色矩阵滤镜 AS3的工具类库—ColorMatrixFilterProxy.as Understanding AS3 ColorMatrixFilter class
(GradientBevelFilter 类) 可使用多种颜色渐变实现斜角效果 渐变发光滤镜(GradientGlowFilter 类) 可使用多种颜色渐变实现发光效果 颜色矩阵滤镜(ColorMatrixFilter 2 颜色矩阵滤镜ColorMatrixFilter 上边的几个滤镜都会在元件周围或者里边做一些额外的显示,如果要只修改图片本身的色彩,例如黑白化,还是需要ColorMatrixFilter出马了 使用ColorMatrixFilter很简单,但如果设置好里边每一个数值就非常有考究。 对象(matrix作为参数) var myfilter:ColorMatrixFilter=new ColorMatrixFilter(matrix); 那么,使用ColorMatrixFilter除了上述这些基本的照片处理功能外,有没有办法做出现成一点,比较有实际意义的滤镜效果呢? 答案是当然可以。例如上边说的黑白化就是了。
但你得具备一些ColorMatrixFilter的知识… 1 var matrix:Array = new Array();2 matrix = matrix.concat([1, 0, 0, 0, 0 matrix.concat([0, 0, 0, 0, 0]); // blue5 matrix = matrix.concat([0, 0, 0, 1, 0]); // alpha6 var filter:ColorMatrixFilter = new ColorMatrixFilter(matrix);7 var m:ColorMatrixMethod = new ColorMatrixMethod();8 m.colorMatrixFilter
ColorMatrixFilter ColorMatrixFilter 类允许你对 显示对象(displayObject) 上每个像素的 RGBA 颜色和 alpha 值应用5x4矩阵变换,以生成一组具有新的
DropShadowFilter(阴影滤镜) Ø BevelFilter(斜角滤镜) Ø GradientGlowFilter(彩色发光滤镜) Ø GradientBevelFilter(彩色斜角滤镜) Ø ColorMatrixFilter --将红色的 Simon_006 变为黑白--> <s:ColorMatrixFilter matrix="{myMatrix}"/>
过渡模式: Xfermode,AvoidXfermode,PixelXorXfermode,PorterDuffXfermode PorterDuff 过滤 1、rgb过滤 ColorFilter ,ColorMatrixFilter