[AS3]as3做取色器源代码参考(as3取色器教程)
[AS3]as3做取色器源代码参考(as3取色器教程)
[AS3]as3做取色器源代码参考(as3取色器教程)
- public static function rgbTouint(rgbarr:Array):uint//ok uintTorgb
- {
- return rgbarr[0]*Math.pow(256,2)+rgbarr[1]*Math.pow(256,1)+rgbarr[2]
- }
- public static function computeXTC(c:uint,x:Number,y:Number):uint
- {
- var rgbArr:Array = new Array();
- rgbArr = uintTorgb(c);
- //trace(rgbTouint(rgbArr).toString(16))
- if(rgbArr[0] == 255)//red system
- {
- //trace(rgbArr[1])
- rgbArr[0] = -y+255; //R
- rgbArr[1] = Math.round(-(((rgbArr[1]-255)/Math.pow(255,2)*x)+1)*y+(rgbArr[1]-255)/255*x+255);//G
- rgbArr[2] = Math.round(-(((rgbArr[2]-255)/Math.pow(255,2)*x)+1)*y+(rgbArr[2]-255)/255*x+255);
- trace("X="+x+"Y="+y+" "+
- rgbArr[0].toString(16)+" "+
- rgbArr[1].toString(16)+" "+
- rgbArr[2].toString(16)+" "+
- " AAAAAAAAAA")
- return rgbTouint(rgbArr);
- }
- if(rgbArr[1] == 255)//green system
- {
- rgbArr[1] = -y+255;
- rgbArr[0] = Math.round(-(((rgbArr[0]-255)/Math.pow(255,2)*x)+1)*y+(rgbArr[0]-255)/255*x+255);//G
- rgbArr[2] = Math.round(-(((rgbArr[2]-255)/Math.pow(255,2)*x)+1)*y+(rgbArr[2]-255)/255*x+255);
- //trace(rgbTouint(rgbArr).toString(16)+" BBBBBBBBBBBB")
- return rgbTouint(rgbArr);
- }
- if(rgbArr[2] == 255)// blue system
- {
- rgbArr[2] = -y+255;
- rgbArr[0] = Math.round(-(((rgbArr[0]-255)/Math.pow(255,2)*x)+1)*y+(rgbArr[0]-255)/255*x+255);//G
- rgbArr[1] = Math.round(-(((rgbArr[1]-255)/Math.pow(255,2)*x)+1)*y+(rgbArr[1]-255)/255*x+255);
- //trace(rgbTouint(rgbArr).toString(16)+" CCCCCCCCCC")
- return rgbTouint(rgbArr);
- }
- return rgbTouint(rgbArr);
- }
来源http://chaimzane.iteye.com/blog/1584375
热门文章推荐
- [SRS流媒体]SRS rtmp http-flv流低延时设置、测试
- [SRS流媒体]RTMP部署的步骤
- [SRS流媒体]RTMP/HLS 直播服务器simple-rtmp-server安装
- [SRS]srs流媒体RTMP环境配置(RTMP配置教程)
- [SRS流媒体]Simple Rtmp Server的安装与简单使用
- [SRS流媒体]SRS集群边缘节点配置
- [SRS流媒体服务器]捕捉摄像头的图像后发送到SRS流媒体服务器
- [srs流媒体技术]Simple-RTMP-Server流媒体
请稍候...