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 = [];//去除滤镜
  • 相关阅读:
    文件分段后,进行分片上传逻辑
    总结几个最近处理问题中使用http协议的代码
    openresty(nginx)中使用lua脚本获取请求IP地址的代码
    线上Storm的worker,executor,task参数调优篇
    async/await
    DataTables.Queryable Sample
    关闭 XXXXX 前你必须关闭所有会话框
    关于P/Invoke的闲话
    Windows 2008 Scheduled tasks result codes
    MySQL 8.0.13的使用心得
  • 原文地址:https://www.cnblogs.com/frost-yen/p/4519500.html
Copyright © 2011-2022 走看看