public class WatermarkerUtil
extends java.lang.Object
| 限定符和类型 | 字段和说明 |
|---|---|
private float |
alpha
默认的透明度
|
private java.awt.Color |
fontColor
默认的字体颜色
|
private java.lang.String |
fontFamily
默认的字体
|
private int |
fontSize
默认的文字大小
|
private int |
fontStyle
默认的字体样式
|
private int |
x
默认的水印左侧距离原图最左边的距离
|
private int |
y
默认的水印的下侧距离原图下侧的距离
|
| 构造器和说明 |
|---|
WatermarkerUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
float |
getAlpha() |
java.awt.Color |
getFontColor() |
java.lang.String |
getFontFamily() |
int |
getFontSize() |
int |
getFontStyle() |
int |
getTextLength(java.lang.String text)
计算文本的长度 返回值是向上取整后的数值
一个英文的宽度等于0.5*fontSize 英文字符的字节码小于1
一个中为跨度等于1*fontSize 中文字符的字节码大于1
|
int |
getX() |
int |
getY() |
java.io.File |
markerWord(java.lang.String text,
java.io.File inputImage,
java.lang.String filePath)
为图片添加文字水印
|
void |
setAlpha(float alpha) |
void |
setFontColor(java.awt.Color fontColor) |
void |
setFontFamily(java.lang.String fontFamily) |
void |
setFontSize(int fontSize) |
void |
setFontStyle(int fontStyle) |
void |
setX(int x) |
void |
setY(int y) |
private java.lang.String fontFamily
private int fontStyle
private int fontSize
private java.awt.Color fontColor
private int x
private int y
private float alpha
public java.io.File markerWord(java.lang.String text,
java.io.File inputImage,
java.lang.String filePath)
text - 要添加的水印的文字内容inputImage - 输入的图片文件filePath - 生成图片的输出路径public int getTextLength(java.lang.String text)
text - 要输入的文本public java.lang.String getFontFamily()
public void setFontFamily(java.lang.String fontFamily)
public int getFontStyle()
public void setFontStyle(int fontStyle)
public int getFontSize()
public void setFontSize(int fontSize)
public java.awt.Color getFontColor()
public void setFontColor(java.awt.Color fontColor)
public int getX()
public void setX(int x)
public int getY()
public void setY(int y)
public float getAlpha()
public void setAlpha(float alpha)