写在前面的话:滤镜的参数不同,显示的效果不同。基于篇幅,我只能列举一种效果做比对,感兴趣的朋友可以自己多做尝试,多体会。
(1)斜角滤镜(BevelFilter)
对应滤镜面板:
对应AS代码:
var bevel:BevelFilter = new BevelFilter();
bevel.blurX = 15;
bevel.blurY = 15;
bevel.strength = 2;
bevel.quality = BitmapFilterQuality.LOW;
bevel.shadowColor = 0x000000;
bevel.shadowAlpha = 1;
bevel.highlightColor = 0xFFFFFF;
bevel.highlightAlpha = 1;
bevel.angle = 45;
bevel.distance = 5;
bevel.knockout = false;
bevel.type = BitmapFilterType.INNER;
var filtersArray:Array = new Array(bevel);
tt.filters = filtersArray;
(2)模糊滤镜(BlurFilter)
对应滤镜面板:
对应AS代码:
var blur:BlurFilter = new BlurFilter();
blur.blurX = 2;
blur.blurY = 2;
blur.quality = BitmapFilterQuality.LOW;
var filtersArray:Array = new Array(blur);
tt.filters = filtersArray;
(3)投影滤镜(DropShadowFilter)
对应滤镜面板:
对应AS代码:
var shadow:DropShadowFilter = new DropShadowFilter();
shadow.blurX = 10;
shadow.blurY = 10;
shadow.strength = 1.5;
shadow.quality = BitmapFilterQuality.MEDIUM;
shadow.color = 0x000000;
shadow.alpha = 1;
shadow.angle = 45;
shadow.distance = 5;
shadow.knockout = false;
shadow.inner = false;
shadow.hideObject = false;
var filtersArray:Array = new Array(shadow);
tt.filters = filtersArray;
(4)发光滤镜(GlowFilter)
对应滤镜面板:
对应AS代码:
var glow:GlowFilter = new GlowFilter();
glow.blurX = 20;
glow.blurY = 20;
glow.strength = 1.5;
glow.quality = BitmapFilterQuality.MEDIUM;
glow.color = 0x00ff00;
glow.alpha = 1;
glow.knockout = false;
glow.inner = true;
var filtersArray:Array = new Array(glow);
tt.filters = filtersArray;
(5)渐变斜角滤镜(GradientBevelFilter)
对应滤镜面板:
渐变斜角滤镜和斜角滤镜相比,只是把阴影区域和加亮区域用渐变来完成,从而实现更丰富的色彩。AS代码我就不举例了。
(6)渐变发光滤镜(GradientGlowFilter)
对应滤镜面板:
渐变发光滤镜相比发光滤镜,多了可以渐变的发光区域,以及相应的距离和角度调整。
AS代码我也不举例了。
以上六种滤镜是基本滤镜,也是平时应用的比较多的滤镜。大家只需要知道有这么个东西就行了,至于具体的代码不用记,到时候查一下文档就可以了。