我在imageview中有图像,如何在该图像上添加图像/徽标水印。 我使用以下代码添加文本水印
String watermark ="Sari collage";
int x =1500;
int y =1200;
int color = Color.parseColor("#ff720b");
int alpha=80;
int size = 70;
boolean underline= false;
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);
答案 0 :(得分:1)
我想:
String watermark ="Sari collage";
int x =1500;
int y =1200;
int color = Color.parseColor("#ff720b");
int alpha=80;
int size = 70;
boolean underline= false;
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);
canvas.drawBitmap(src, w/2, h/2, 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);