Atitit 动态按钮图片背景颜色与文字组合解决方案
转换背景颜色,setFont("cywe_img", fontScale, 50, 5)
设置文字大小与坐标
文字分拆,使用字根组合,也就256个字根就够了。
public static void main(String[] args) throws FileNotFoundException {
long startTime = System.currentTimeMillis(); // 获取开始时间
String out = "C:\\0workspace\\AtiPlatf_cms\\WebRoot\\btn\\" + filex.getUUidName() + ".png";
double fontScale = 0.6;
new SvsBtnFilter().setBg("bush_blu", 300, 60, "210,0.1,0.1").setFont("cywe_img", fontScale, 50, 5).setFont("din_img", fontScale, 90, 5).toOutStream(new FileOutputStream(new File(out)));
System.out.println("--f");
long endTime = System.currentTimeMillis(); // 获取结束时间
System.out.println("程序运行时间: " + (endTime - startTime) + "ms");
System.out.println("--0f");
}
/AtiPlatf_cms/src/com/attilax/img/SvsBtnFilter.java
Builder<BufferedImage> bldr = Thumbnails.of(bg);
Builder<BufferedImage> bldr = Thumbnails.of(bg);
//of(new File(this.bg));
for (AFont aFont : li) {
Runnable c = () -> {
BufferedImage img1 = imgx.toImg(aFont.fontPic);
try {
img1 = Thumbnails.of(img1).scale(aFont.fontScale).asBufferedImage();
Coordinate coordinate1 = new Coordinate(aFont.point.x, aFont.point.y);
bldr.watermark(coordinate1, img1, 1f);
} catch (IOException e) {
System.out.println("----wan::" + e.getMessage() + aFont);
e.printStackTrace();
}
};
c.run();
// urlPool.execute(c);
}
try {
bldr.size(300, 60).keepAspectRatio(true).outputFormat("png").toOutputStream(fileOutputStream);
} catch (IOException e1) {
ExUtil.throwExV2(e1);
}
作者:: 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 )
汉字名:艾提拉(艾龙), EMAIL:1466519819@qq.com
转载请注明来源: http://www.cnblogs.com/attilax/
Atiend