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;
}
ImageHelper.java 文件源码
java
阅读 36
收藏 0
点赞 0
评论 0
项目:android-study
作者:
评论列表
文章目录