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://blog.csdn.net/attilax

    Atiend

     

  • 相关阅读:
    奥赛-欧几里得算法-最大公约数
    dbForge Studio for MySQL 中文乱码问题
    【C++】纯C++实现http打开网页下载内容的功能
    【C++】C++string类总结
    【C++】C++中的string类的用法总结
    【网络编程/C++】修改本机ip地址
    MFC控件的SubclassDlgItem
    MFC 不让程序显示在任务栏上
    MFC中无边框窗口的拖动
    MFC 获取图像的大小
  • 原文地址:https://www.cnblogs.com/attilax/p/15198286.html
Copyright © 2011-2022 走看看