Commit 472acef9 authored by 赵啸非's avatar 赵啸非

添加水印图片

parent bda2d878
......@@ -22,7 +22,7 @@ public class WatermarkImgUtils {
* @return void
*/
public static void addWatermark(String sourceImgPath, String tarImgPath, String waterMarkContent,String fileExt){
Font font = new Font("宋体", Font.BOLD, 36);//水印字体,大小
Font font = new Font("宋体", Font.BOLD, 100);//水印字体,大小
Color markContentColor = Color.red;//水印颜色
Integer degree = 45;//设置水印文字的旋转角度
float alpha = 0.5f;//设置水印透明度
......@@ -54,11 +54,18 @@ public class WatermarkImgUtils {
if(columnsNumber < 1){
columnsNumber = 1;
}
for(int j=0;j<rowsNumber;j++){
g.drawString(waterMarkContent, width + width/2, width- width/2);
/* for(int j=0;j<rowsNumber;j++){
boolean bool=false;
for(int i=0;i<columnsNumber;i++){
g.drawString(waterMarkContent, i*width + j*width, -i*width + j*width);//画出水印,并设置水印位置
bool=true;
break;
}
}
if (bool) break;
}*/
g.dispose();// 释放资源
// 输出图片
outImgStream = new FileOutputStream(tarImgPath);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment