AS2.0 advanced filter code and summary

Source: Internet
Author: User

AS2.0 advanced filter code and summary

// Subject sentence

Import fl. awt. img. filter .*;

Import flash. display. BitmapData;

// Filter writing method:

/* Style of relief filter, ReliefFilter (relief direction, relief strength)

Var lvjing = new ReliefFilter (1, 10 );

Var filterArray: Array = new Array ();

FilterArray. push (lvjing );

Pic. filters = filterArray */

/* The channel selects the filter method. ChannelChangeFilter (1 red | 2 green | 4 blue, whether to split the channel) 8 represents channel alpha

Var lvjing = new ChannelChangeFilter (1 | 2 | 8, false );

Var filterArray: Array = new Array ();

FilterArray. push (lvjing );

Pic. filters = filterArray ;*/

/*

// Write the pattern filter, new ClothFilter (myBitmapData, pattern intensity );

// Condition: you need to create BitmapData, preferably equal to or greater than the image.

Stop ()

Var n = 0;

OnEnterFrame = function (){

N ++;

Var myBitmapData: BitmapData = new BitmapData (460,150, true, 0 xCCCCCCCC );

Var lvjing = new ClothFilter (myBitmapData, n );

Var filterArray: Array = new Array ();

FilterArray. push (lvjing );

Pic. filters = filterArray;

If (n & gt; 100 ){

Delete this. onEnterFrame;

};

*/

/*

// Invert the color filter ReversesFilter (); no parameter

Var lvjing = new ReversesFilter ();

Pic. filters = [lvjing] */

/*

// Search edge filter method new SearchEdgeFilter (search direction, search intensity)

Var lvjing = new SearchEdgeFilter (2, 8 );

Pic. filters = [lvjing]; */

/*

// Sharpen filter new SharpenFilter (sharpen intensity)

Var lvjing = new SharpenFilter (200 );

Pic. filters = [lvjing]; */

/*

// Diffusion filter. BitmapData, new SplattersFilter (myBitmapData, diffusion width, and diffusion height) is required)

Stop ();

Scalex = 50;

Scaley = 50;

OnEnterFrame = function (){

Scalex --;

Scaley --;

Var myBitmapData: BitmapData = new BitmapData (460,150, true, 0 xCCCCCCCC );

Var lvjing = new SplattersFilter (myBitmapData, scalex, scaley );

Var filterArray: Array = new Array ();

FilterArray. push (lvjing );

Pic. filters = filterArray;

If (scalex = 0 ){

Delete this. onEnterFrame;

};

*/

/*

// Watercolor filter new WaterColorFilter (myBitmapData, watercolor width, watercolor height)

Stop ();

Scalex = 50;

Scaley = 50;

OnEnterFrame = function (){

Scalex --;

Scaley --;

Var myBitmapData: BitmapData = new BitmapData (460,150, true, 0 xCCCCCCCC );

Var lvjing = new WaterColorFilter (myBitmapData, scalex, scaley );

Var filterArray: Array = new Array ();

FilterArray. push (lvjing );

Pic. filters = filterArray;

If (scalex = 0 ){

Delete this. onEnterFrame;

};*/

/*

// New WaveFilter (myBitmapData, water wave width, water wave height)

Stop ();

Scalex = 50;

Scaley = 50;

OnEnterFrame = function (){

Scalex --;

Scaley --;

Var myBitmapData: BitmapData = new BitmapData (460,150, true, 0 xCCCCCCCC );

Var lvjing = new WaveFilter (myBitmapData, scalex, scaley );

Var filterArray: Array = new Array ();

FilterArray. push (lvjing );

Pic. filters = filterArray;

If (scalex = 0 ){

Delete this. onEnterFrame;

};*/

/*

// New WindFilter (myBitmapData, wind speed, or horizontal );

Stop ();

Var speed: Number = 50;

Var shuiping = false;

OnEnterFrame = function (){

Speed --;

Var myBitmapData: BitmapData = new BitmapData (460,150, true, 0 xCCCCCCCC );

Var lvjing = new WindFilter (myBitmapData, speed, shuiping );

Var filterArray: Array = new Array ();

FilterArray. push (lvjing );

Pic. filters = filterArray;

If (speed = 0 ){

Delete this. onEnterFrame;

};*/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.