我想使用水印在拍摄的图像上添加经度和纬度值,为此我在Google中搜索了很多,但是我没有找到任何解决方案可以帮助我,这是显示经度和纬度值的最佳方法捕获的图像上
private void takePhotoFromCamera() {
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, CAMERA);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
imageView.setImageBitmap(mark(thumbnail, "Water mark text", 200, 200, Color.GREEN, 80, 24, false));
}
public static Bitmap mark(Bitmap src, String watermark, int x,int y, int color, int alpha, int size, boolean underline) {
int w = src.getWidth();
int h = src.getHeight();
Bitmap result = Bitmap.createBitmap(w, h, src.getConfig());
Canvas canvas = new Canvas(result);
canvas.drawBitmap(src, 0, 0, null);
Paint paint = new Paint();
paint.setColor(color);
paint.setAlpha(alpha);
paint.setTextSize(size);
paint.setAntiAlias(true);
paint.setUnderlineText(underline);
canvas.drawText(watermark, x, y, paint);
return result;
}