zoukankan      html  css  js  c++  java
  • [ActionScript 3.0] 亮度、对比度、饱和度、色相的调整

    import fl.motion.ColorMatrix;
    
    import flash.filters.ColorMatrixFilter;
    
     
    
    //**调整亮度**//
    
    var ld_Matrix:ColorMatrix=new ColorMatrix();
    
    var ld_Filter:ColorMatrixFilter=new ColorMatrixFilter();
    
    ld_Matrix.SetBrightnessMatrix(100);  //设置亮度值,值的大小是 -255--255   0为中间值,向右为亮向左为暗。
    
    ld_Filter.matrix = ld_Matrix.GetFlatArray();
    
    ld_MC.filters = [ld_Filter];
    
    //ld_MC.filters = [];//去除滤镜
    
     
    
    //**调整对比度**//
    
    var db_Matrix:ColorMatrix=new ColorMatrix();
    
    var db_Filter:ColorMatrixFilter=new ColorMatrixFilter();
    
    db_Matrix.SetContrastMatrix(255);  //设置对比度值,值的大小是 -255--255  127.5为中间值,向右对比鲜明向左对比偏暗。
    
    db_Filter.matrix = db_Matrix.GetFlatArray();
    
    db_MC.filters = [db_Filter];
    
    //db_MC.filters = [];//去除滤镜
    
     
    
    //**调整饱和度**//
    
    var bh_Matrix:ColorMatrix=new ColorMatrix();
    
    var bh_Filter:ColorMatrixFilter=new ColorMatrixFilter();
    
    bh_Matrix.SetSaturationMatrix(0);  //设置饱和度值,值的大小是 -255--255   1为中间值,0为灰度值(即黑白相片)。
    
    bh_Filter.matrix = bh_Matrix.GetFlatArray();
    
    bh_MC.filters = [bh_Filter];
    
    //bh_MC.filters = [];//去除滤镜
    
     
    
    //**调整色相**//
    
    var sx_Matrix:ColorMatrix=new ColorMatrix();
    
    var sx_Filter:ColorMatrixFilter=new ColorMatrixFilter();
    
    sx_Matrix.SetHueMatrix(1);  //设置色相值,值的大小是 -255--255  0为中间值,向右向左一试便知。
    
    sx_Filter.matrix = sx_Matrix.GetFlatArray();
    
    sx_MC.filters = [sx_Filter];
    
    //sx_MC.filters = [];//去除滤镜
  • 相关阅读:
    程序员创业必读的几本书
    Linux系统下word转pdf,xls转pdf,ppt转pdf
    Linux系统下word转pdf,xls转pdf,ppt转pdf
    文件流演示案例(一)
    记事本程序
    Struts2入门(二)
    MyEclipse6.5注册方法
    使用ASP.NET上传图片汇总
    sql server 2005 (select查询语句用法)
    千万级分页存储过程
  • 原文地址:https://www.cnblogs.com/frost-yen/p/4519500.html
Copyright © 2011-2022 走看看