直接丢代码了
效果:
/**
* 左下角添加水印(多行,图标 + 文字)
* 参考资料:
* Android 对Canvas的translate方法总结 https://blog.csdn.net/u013681739/article/details/49588549
* @param photo
*/
public static Bitmap addWaterMark(Context context,Bitmap photo, List<String> textList,List<Integer> iconIdList,boolean isShowIcon) {
Bitmap newBitmap = photo;
try {
if (null == photo) {
return null;
}
int srcWidth = photo.getWidth();
int srcHeight = photo.getHeight();
//Resources resources = context.getResources();
//float scale = resources.getDisplayMetrics().density;
int unitHeight = srcHeight > srcWidth ? srcWidth/30 : srcHeight / 25;
int padding = unitHeight;
int marginLeft = padding;
int marginBottom = padding;
int textSize = unitHeight;
//创建一个bitmap
if (!newBitmap.isMutable()) {
newBitmap = copy(photo);
}
//将该图片作为画布
Canvas canvas = new Canvas(newBitmap);
// 设置画笔
TextPaint textPaint = new