import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.Date;
public class FontImage {
public static BufferedImage createBufferedImage(String name, Font font, int i, int i1, boolean b) {
Watermark watermark = new Watermark();
watermark.setEnable(b);
watermark.setDateFormat("yyyy-MM-dd HH:mm");
watermark.setText(name);
watermark.setColor("#C5CBCF");
return createWatermarkImage(watermark);
}
public static BufferedImage createBufferedImage(String name, Font font, int width, int height, String color, String dateFormat, boolean enable) {
Watermark watermark = new Watermark();
watermark.setEnable(enable);
watermark.setDateFormat(dateFormat);
watermark.setText(name);
watermark.setWidth(width);
watermark.setHeight(height);
watermark.setColor(color);
watermark.setFont(font);
return createWatermarkImage(watermark);
}
@Data
public static class Watermark {
private Boolean enable;
private String text;
private String dateFormat;
private int width;
private int height;
private Font font;
private String color;
}
public static BufferedImage createWatermarkImage(Watermark watermark) {
if (watermark =