我怎么可能水印效果添加到Android中的形象? [英] How might I add a watermark effect to an image in Android?
本文介绍了我怎么可能水印效果添加到Android中的形象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个帧的图像,我需要添加水印的效果。我怎么可以这样做?
I have an image with frames and I need to add a watermark effect. How might I do this?
推荐答案
我发现在Android上的图像伟大的教程处理<一href="http://xjaphx.word$p$pss.com/2011/06/23/image-processing-watermarking-on-the-fly/">here.
I found great tutorial on Android Image Processing here.
public static Bitmap mark(Bitmap src, String watermark, Point location, Color 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, location.x, location.y, paint);
return result;
}
感谢皮特休斯顿谁共享基本图像处理等实用教程。
Thanks to Pete Houston who shares such useful tutorial on basic image processing.
这篇关于我怎么可能水印效果添加到Android中的形象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文