资源描述:
《understanding as3 colormatrixfilter class》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、UnderstandingAS3ColorMatrixFilterclass DoyouagesintoyourFlashmoviesonthefly? ThenColorMatrixFilteristheclassyouneed. TheColorMatrixFilterclassletsyouapplya4x5matrixtransformationontheRGBAcolorandalphavaluesofeverypixelintheinputimagetoproducearesultatrixfilterseparateseachsourcepixelint
2、oitsred,green,blue,andalphaponentsassrcR,srcG,srcB,srcA. Tocalculatetheresultofeachofthefourchannels,thevalueofeachpixelintheimageismultipliedbythevaluesinthetransformationmatrix. Italloinancetoalpha,andvariousothereffects. FormoreinformationvisittheofficialAdobespage. Aroundtheplesofp
3、hotosloadedacodingpointofvieakesomeexperimentonthisphotoIfoundonFlickr ThefirstthingiscreatingaMovieClipageinside.Icalleditcats,soplecodeIdisplaythecatsonthestage: package { import flash.display.Sprite; public class cmf extends Sprite { var cats_image:cats=nef() { addChild(cats_image
4、); } }} nothingneetoaddthefilter. Noport flash.display.Sprite; import flash.filters.ColorMatrixFilter; public class cmf extends Sprite { var cats_image:cats=nef() { addChild(cats_image); var matrix:Array = neatrix=matrix.concat([0.5,0.5,0.5,0,0]);// red matrix=matrix.concat([0.5,
5、0.5,0.5,0,0]);// green matrix=matrix.concat([0.5,0.5,0.5,0,0]);// blue matrix=matrix.concat([0,0,0,1,0]);// alpha var my_filter:ColorMatrixFilter=neatrix); cats_image.filters=[my_filter]; } }} multiplyingallvaluesby0.5,port flash.display.Sprite; import flash.filters.ColorMatrixFi
6、lter; public class cmf extends Sprite { var cats_image:cats=nef() { addChild(cats_image); var matrix:Ar123下一页[感谢阅读这篇文章,..,]ray = neatrix=matrix.concat([1,0,0,0,0]);// red matrix=matrix.concat([0,1,0,0,0]);// green matrix=matrix.concat([0,0,1,0,0]);// blue matrix=matrix.concat([0
7、,0,0,1,0]);// alpha var my_filter:ColorMatrixFilter=neatrix); cats_image.filters=[my_filter]; } }} atrixisanidentitymatrix. Anidentitymatrixorunitmatrixofsizenisthen-by-nsquarematrixaindiagonalandzeroselseage,simplyboostredponentonredchannel,greenponent