ImageHelper.java 文件源码

java
阅读 36 收藏 0 点赞 0 评论 0

项目:android-study 作者:
public static Bitmap handleImageGrayEffect(Bitmap bitmap) {
  Bitmap bmp =
      Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
  float[] colorMatrixValue = new float[] {
      0.33f, 0.59f, 0.11f, 0, 0, 0.33f, 0.59f, 0.11f, 0, 0, 0.33f, 0.59f, 0.11f, 0, 0, 0, 0, 0, 1,
      0
  };
  ColorMatrix colorMatrix = new ColorMatrix();
  colorMatrix.set(colorMatrixValue);

  Canvas canvas = new Canvas(bmp);
  Paint paint = new Paint();
  paint.setColorFilter(new ColorMatrixColorFilter(colorMatrix));
  canvas.drawBitmap(bitmap, 0, 0, paint);
  return bmp;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号