拍摄您的照片,保存您的图像。然后在一个ImageView
你可以应用你想要使用的所有类型的效果Bitmap
和ColorMatrix
。这里我给出一个小样本来制作图像灰度
public void toGrayscale() {
ColorMatrix matrix = new ColorMatrix();
matrix.setSaturation(0);
ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrix);
imageView.setColorFilter(filter);
}
应用效果后,只需将可绘制对象保存到图像文件,如下所示:
public void saveDrawable(ImageView imageView) throws FileNotFoundException {
Bitmap bitmap = getBitmapFromImageView(imageView);
OutputStream fOut = null;
try {
fOut = new FileOutputStream(absolutePath);
bitmap.compress(Bitmap.CompressFormat.JPEG, 95, fOut);
} finally {
if (fOut != null) {
try {
fOut.close();
} catch (IOException e) {
//report error
}
}
}
}
@NonNull
private Bitmap getBitmapFromImageView(ImageView imageView) {
Drawable drawable = imageView.getDrawable();
Rect bounds = drawable.getBounds();
Bitmap bitmap = Bitmap.createBitmap(bounds.width(), bounds.height(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
drawable.draw(canvas);
return bitmap;
}
有一个很好的图书馆可以帮助你https://github.com/chrisbanes/PhotoView
用手指画这个问题如何在imageview上画线以及android中的手指应该可以帮助你
希望它有帮助!