zoukankan      html  css  js  c++  java
  • 冰冻效果

    //冰冻效果
    public static Bitmap changeToIce(Bitmap bitmap){
    int width = bitmap.getWidth();
    int height = bitmap.getHeight();
    int dst[] = new int[width*height];
    bitmap.getPixels(dst, 0, width, 0, 0, width, height);
    Log.i("IceStyle", "width="+width + "; height="+height);
    int R, G, B, pixel;
    int pos, pixColor;
    for(int y=0; y<height; y++){
    for(int x=0; x<width; x++){
    pos = y*width + x;
    pixColor = dst[pos];
    R = Color.red(pixColor);
    G = Color.green(pixColor);
    B = Color.blue(pixColor);

    pixel = R-G-B;
    pixel = pixel*3/2;
    if(pixel < 0)
    pixel = -pixel;
    if(pixel > 255)
    pixel = 255;
    R = pixel;

    pixel = G - B - R;
    pixel = pixel * 3 / 2;
    if (pixel < 0)
    pixel = -pixel;
    if (pixel > 255)
    pixel = 255;
    G = pixel;

    pixel = B - R - G;
    pixel = pixel * 3 / 2;
    if (pixel < 0)
    pixel = -pixel;
    if (pixel > 255)
    pixel = 255;
    B = pixel;

    dst[pos] = Color.rgb(R, G, B);
    }
    }
    Bitmap iceBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
    iceBitmap.setPixels(dst, 0, width, 0, 0, width, height);
    return iceBitmap;
    }

  • 相关阅读:
    在Js或者cess后加版本号 防止浏览器缓存
    svn操作
    Hash表
    网站js埋点
    c#优秀文章
    CentOS修改默认yum源为国内yum镜像源
    mysql开启远程连接
    安装jdk环境
    Eclipse的一下设置
    好用的在线HTML、CSS工具
  • 原文地址:https://www.cnblogs.com/clarence/p/3837429.html
Copyright © 2011-2022 走看看