as3.0 Flex 图像处理
已知的一些图像处理,主要是得到颜色过滤矩阵,不完整,大家一起来补充。
//颜色转换数组,所有的0都是可调值
public var colorArray:Array = [1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0];
1.处理图像为灰度:
//取值范围0~3
colorArray[0] = (1-0)*0.3086+0;
colorArray[1] = (1-0)*0.6094;
colorArray[2] = (1-0)*0.0820;
colorArray[5] = (1-0)*0.3086;
colorArray[6] = (1-0)*0.6094+0;
colorArray[7] = (1-0)*0.0820;
colorArray[10] = (1-0)*0.3086;
colorArray[11] = (1-0)*0.6094;
colorArray[12] = (1-0)*0.0820+0;
colorArray[18] = 1;
image.filters = [new ColorMatrixFilter(colorArray)];
2.亮度调节:
var brightness:Number;//取值范围0~5
colorArray[0] = brightness;
colorArray[6] = brightness;
colorArray[12] = brightness;
colorArray[18] = 1;
img.filters = [new ColorMatrixFilter(colorArray)];
3.饱和度调节:
var saturation:Number;//取值范围0~3
colorArray[0] = (1-saturation)*0.3086+saturation;
colorArray[1] = (1-saturation)*0.6094;
colorArray[2] = (1-saturation)*0.0820;
colorArray[5] = (1-saturation)*0.3086;
colorArray[6] = (1-saturation)*0.6094+saturation;
colorArray[7] = (1-saturation)*0.0820;
colorArray[10] = (1-saturation)*0.3086;
colorArray[11] = (1-saturation)*0.6094;
colorArray[12] = (1-saturation)*0.0820+saturation;
colorArray[18] = 1;
img.filters = [new ColorMatrixFilter(colorArray)];
4.对比度调节:
var contrast:Number;//取值范围0~1
var a:Number = contrast*11;
var b:Number = 63.5-(contrast*698.5);
colorArray[0] = a;
colorArray[4] = b;
colorArray[6] = a;
colorArray[9] = b;
colorArray[12] = a;
colorArray[14] = b;
colorArray[18] = 1;
img.filters = [new ColorMatrixFilter(colorArray)];
5.水平翻转:
var planeBitmapData:BitmapData = new BitmapData( img.width, img.height );
var planeMatrix : Matrix = new Matrix(-1, 0, 0, 1, img.contentWidth, 0 );
planeBitmapData.draw( img, planeMatrix );
var planeBitmap:Bitmap = new Bitmap(planeBitmapData);
img.source = planeBitmap;
6.垂直翻转:
var apeakBitmapData:BitmapData = new BitmapData( img.width, img.height );
var apeakMatrix : Matrix = new Matrix(1, 0, 0, -1, 0, img.contentHeight );
var apeakBitmap:Bitmap = new Bitmap(apeakBitmapData);
apeakBitmapData.draw( img, apeakMatrix );
img.source = apeakBitmap;
7.浮雕效果:
img.filters = [new ConvolutionFilter(3,3,[-10,-1,0,-1,1,1,0,1,10])];
 
转自: http://blog.sina.com.cn/s/blog_4c73b2c70100mfux.html

as3.0 Flex 图像处理的更多相关文章

  1. [转]Flash、Flex、AS3.0框架及类库资源收集之十全大补

    原文地址:http://www.d5power.com/portal.php?mod=view&aid=27 APIs.Libs.Components1.as3ebaylibhttp://co ...

  2. “AS3.0高级动画编程”学习:第一章高级碰撞检测

    AdvancED ActionScript 3.0 Animation 是Keith Peters大师继"Make Things Move"之后的又一力作,网上已经有中文翻译版本了 ...

  3. “AS3.0高级动画编程”学习:第二章转向行为(下)

    在上一篇里,我们学习了“自主角色”的一些基本行为:寻找(seek).避开(flee).到达(arrive).追捕(pursue).躲避(evade).漫游(wander).这一篇将继续学习其它更复杂, ...

  4. “AS3.0高级动画编程”学习:第二章转向行为(上)

    因为这一章的内容基本上都是涉及向量的,先来一个2D向量类:Vector2D.as (再次强烈建议不熟悉向量运算的童鞋,先回去恶补一下高等数学-07章空间解释几何与向量代数.pdf) 原作者:菩提树下的 ...

  5. “AS3.0高级动画编程”学习:第三章等角投影(上)

    什么是等角投影(isometric)? 原作者:菩提树下的杨过出处:http://yjmyzz.cnblogs.com 刚接触这个概念时,我也很茫然,百度+google了N天后,找到了一些文章: [转 ...

  6. “AS3.0高级动画编程”学习:第四章 寻路(AStar/A星/A*)算法 (下)

    在前一部分的最后,我们给出了一个寻路的示例,在大多数情况下,运行还算良好,但是有一个小问题,如下图: 很明显,障碍物已经把路堵死了,但是小球仍然穿过对角线跑了出来! 问题在哪里:我们先回顾一下ASta ...

  7. as3.0中如何阻止事件冒泡

    原作者:菩提树下的杨过转载出处:http://yjmyzz.cnblogs.com 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究 ...

  8. Actionscript,AS3,MXML,Flex,Flex Builder,Flash Builder,Flash,AIR,Flash Player之关系

    转自zrong's blog:http://zengrong.net/post/1295.htm ActionScript ActionScript通常简称为AS,它是Flash平台的语言.AS编写的 ...

  9. [ActionScript 3.0] AS3.0和AS2.0的相互通信

    AS3和AS2之间的通信,最好的方式可能就是LocalConnection了. AS2向AS3发送数据,即AS2调用AS3的函数: as2.0代码(按钮上写的发送信息代码): on (release) ...

随机推荐

  1. 用户添加到sudoer列表## Allow root to run any commands anywhere root ALL=(ALL) ALL Iron ALL=(ALL) ALL

    将用户添加到sudoer列表 李序锴关注 2017.12.20 15:03:25字数 605阅读 4,067 默认情况下,linux没有将当前用户列入到sudoer列表中(在redhat系列的linu ...

  2. 攻防世界(六)supersqli

    攻防世界系列:supersqli 方法一: 用逗号包裹回显正常,说明存在注入 1';--+(注释符也可用 -- 或 # 发现均未被过滤!) 有order by 语句可知表由2个字段,使用联合查询 (想 ...

  3. 攻防世界(十三)unserialize3

    攻防世界系列 :unserialize3 1.打开题目,反序列化 2.代码审计 类xctf被调用时_weakeup()函数会被自动执行,但当序列化字符串中属性值个数大于属性个数,就会导致反序列化异常, ...

  4. 如何像如何像 NASA 顶级程序员一样编程 — 10 条重要原则

    https://www.oschina.net/news/90499/nasa-programmer-rule?from=20171112#0-qzone-1-7898-d020d2d2a4e8d1a ...

  5. 为何不选择lunix AIO

    对于块设备而言,linux可以使用同步IO.POSIX IO.linux AIO.io-uring,前俩者是linux的同步IO接口,后者是linux内核提供的异步io接口,linux AIO只支持直 ...

  6. 入坑java工程师那些事

    最近在知乎上看到好多关于转行做java的朋友,有的在担心学历,有的在想着如何学习java,有的在纠结如何面试.作为一个工作了近10年的java程序员来聊聊我的一些想法,主要从学历.个人能力.工作环境等 ...

  7. Python+Selenium学习笔记16 - unittest单元测试框架

    unittest单元测试框架包括 Test Case,  Test Suite, Test Runner, Test Fixture Test Cases 组成Test Suite, Test Run ...

  8. JVM学习心得—JVM内存模型(个人整理,请勿转载)

    一.运行时数据区域 线程私有的:程序计数器+虚拟机栈+本地方法栈 线程共享的:堆+方法区(运行时常量池)+直接内存(非运行时数据区的一部分) *JDK1.8后将方法区废除,新增元空间. 1.1 程序计 ...

  9. 手把手教你实现三种绑定方式(call、apply、bind)

    关于绑定首先要说下this的指向问题. 我们都知道: 函数调用时this指向window 对象调用函数时this指向对象本身 看下面得例子: // 1 function test(){ const n ...

  10. 无监督域对抗算法:ICCV2019论文解析

    无监督域对抗算法:ICCV2019论文解析 Drop to Adapt: Learning Discriminative Features for Unsupervised Domain Adapta ...