Atitit 动态按钮图片背景颜色与文字组合解决方案
转换背景颜色,setFont("cywe_img",fontScale,50,5)
设置文字大小与坐标
文字分拆,使用字根组合,也就256个字根就够了。
publicstaticvoidmain(String[]args)throwsFileNotFoundException{
longstartTime=System.currentTimeMillis();// 获取开始时间
Stringout="C:\\0workspace\\AtiPlatf_cms\\WebRoot\\btn\\"+filex.getUUidName()+".png";
doublefontScale=0.6;
newSvsBtnFilter().setBg("bush_blu",300,60,"210,0.1,0.1").setFont("cywe_img",fontScale,50,5).setFont("din_img",fontScale,90,5).toOutStream(newFileOutputStream(newFile(out)));
System.out.println("--f");
longendTime=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(AFontaFont:li){
Runnablec=()->{
BufferedImageimg1=imgx.toImg(aFont.fontPic);
try{
img1=Thumbnails.of(img1).scale(aFont.fontScale).asBufferedImage();
Coordinatecoordinate1=newCoordinate(aFont.point.x,aFont.point.y);
bldr.watermark(coordinate1,img1,1f);
}catch(IOExceptione){
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(IOExceptione1){
ExUtil.throwExV2(e1);
}
作者::绰号:老哇的爪子(全名::AttilaxAkbarAlRapanui阿提拉克斯阿克巴阿尔拉帕努伊)
汉字名:艾提拉(艾龙),EMAIL:1466519819@
转载请注明来源:/attilax/
Atiend