zoukankan      html  css  js  c++  java
  • Atitit 动态按钮图片背景颜色与文字组合解决方案

    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

     

  • 相关阅读:
    How to configure security of ActiveMQ ?
    CentOS 搭建 nginx + tomcat
    25个 Git 进阶技巧
    写给Git初学者的7个建议
    my links
    Shell scripts to Create a local dir base on the time.
    81For全栈技术网
    一款可视化的在线制作H5
    在线制作h5
    在线制作h5——上帝的礼物
  • 原文地址:https://www.cnblogs.com/attilax/p/6076126.html
Copyright © 2011-2022 走看看