Package com.alibaba.simpleimage.render

Examples of com.alibaba.simpleimage.render.DrawTextParameter


    static final Color FONT_COLOR        = new Color(255, 255, 255, 115);
    static final Color FONT_SHADOW_COLOR = new Color(170, 170, 170, 77);
    static final Font  FONT              = new Font("黑体", Font.PLAIN, 10);

    protected DrawTextParameter getParam() {
        DrawTextParameter param = new DrawTextParameter();
        param.addTextInfo(new FixDrawTextItem("这是测试中文好不好用"));

        return param;
    }
View Full Code Here


        try {
            in = new FileInputStream(new File(path, imageName));
            ImageRender rr = new ReadRender(in);

            DrawTextParameter dp = new DrawTextParameter();
            if (items != null) {
                for (DrawTextItem itm : items) {
                    dp.addTextInfo(itm);
                }
            }
            DrawTextRender dtr = new DrawTextRender(rr, dp);

            fr = new WriteRender(dtr, new File(rpath, "DRAWTEXT_" + desc + imageName.substring(0, imageName.lastIndexOf("."))
View Full Code Here

        try {
            File f = new File(dir, sourceName);
            in = new FileInputStream(f);
            ReadRender rr = new ReadRender(in);

            DrawTextParameter dp = new DrawTextParameter();
            dp.addTextInfo(new FixDrawTextItem("1234554321"));
            DrawTextRender dtr = new DrawTextRender(rr, dp);
            // scale
            ScaleParameter param = new ScaleParameter(1024, 1024,
                    ScaleParameter.Algorithm.AUTO);
            ImageRender sr = new ScaleRender(dtr, param);
View Full Code Here

                inputStream = new FileInputStream(img);
                memoryStream = ImageUtils.createMemoryStream(inputStream);
                if (ImageUtils.isGIF(memoryStream)) {
                    suffix = ".gif";
                }
                DrawTextParameter dtp = createDrawTextParameter("阿里巴巴测试", true, true);
                inputToStore = ((ByteArrayOutputStream) processor.process(memoryStream, dtp, DEFAULT_SCALE_PARAM.getMaxWidth(), DEFAULT_SCALE_PARAM.getMaxHeight())).toInputStream();
                String outputName = img.getName().substring(0, img.getName().indexOf("."));
                outputFile = new File(rpath, "COMPOSITETEST_" + outputName + suffix);
                outputStream = new FileOutputStream(outputFile);
                IOUtils.copy(inputToStore, outputStream);
View Full Code Here

        if (drawFootTxt) {
            DrawTextItem footTextItem = new FootnoteDrawTextItem(mainTxt, "www.alibaba.com.cn");
            textItems.add(footTextItem);
        }

        DrawTextParameter dtp = new DrawTextParameter(textItems);

        return dtp;
    }
View Full Code Here

        assertNull(NodeUtils.getChild(imageMetadata, "LocalColorTable"));
        assertNotNull(NodeUtils.getChild(newImg.getMetadata(0), "LocalColorTable"));
    }

    public void testCloneJPEGOutput() throws Exception {
        DrawTextParameter dparam = new DrawTextParameter();
        dparam.addTextInfo(new FixDrawTextItem("alibaba"));

        File[] files = jpgDir.listFiles();
 

        for (File file : files) {
View Full Code Here

            }
        }
    }

    public void testCloneGIFOutput() throws Exception {
        DrawTextParameter dparam = new DrawTextParameter();
        dparam.addTextInfo(new FixDrawTextItem("alibaba"));
       
        File[] files2 = gifDir.listFiles();
        for (File file : files2) {
            String fileName = file.getName().toLowerCase();
            if (fileName.endsWith("gif")) {
View Full Code Here

            if (drawFootTxt) {
                DrawTextItem footTextItem = new FootnoteDrawTextItem(mainTxt, "www.alibaba.com.cn");
                textItems.add(footTextItem);
            }

            DrawTextParameter dtp = new DrawTextParameter(textItems);

            return dtp;
        }
View Full Code Here

TOP

Related Classes of com.alibaba.simpleimage.render.DrawTextParameter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.