• 灰度图


    //灰度图
            function greyEffect(imageData) {
                pixelData = imageData.data;
                for (var i = 0; i < canvas.width * canvas.height; i++) {
                    var r = pixelData[i * 4 + 0],
                        g = pixelData[i * 4 + 1],
                        b = pixelData[i * 4 + 2];
                    var grey = 0.3 * r + 0.59 * g + 0.11 * b;
                    pixelData[i * 4 + 0] = grey;
                    pixelData[i * 4 + 1] = grey;
                    pixelData[i * 4 + 2] = grey;
                }
                imageData.data = pixelData;
                return imageData;
            }
    

      

     .

    //去色滤镜
            function removeColor(imageData) {
                pixelData = imageData.data;
                for (var i = 0; i < canvas.width * canvas.height; i++) {
                    var r = pixelData[i * 4 + 0],
                        g = pixelData[i * 4 + 1],
                        b = pixelData[i * 4 + 2];
                    var c = Math.floor((Math.min(r, g, b) + Math.max(r, g, b)) / 2);
                    pixelData[i * 4 + 0] = c;
                    pixelData[i * 4 + 1] = c;
                    pixelData[i * 4 + 2] = c;
                }
                imageData.data = pixelData;
                return imageData;
            }
    

      

  • 相关阅读:
    ConcurrentHashMap源码阅读
    java中Scanner类nextLine()和next()的区别和使用方法
    setuid
    lsattr
    设置umask
    touch
    od
    vi 搜索
    nl
    cat 参数
  • 原文地址:https://www.cnblogs.com/ckAng/p/10912036.html
Copyright © 2020-2023  润新知