Package watermarker.model

Examples of watermarker.model.WatermarkerSettings


                String errMsg = "Please enter Text.";
                request.setAttribute("_ERROR_MESSAGE_", errMsg);
                return "error";
            }
           
            WatermarkerSettings watermarkerSettings = WatermarkerSettings.DEFAULT;
           
            if (UtilValidate.isNotEmpty(fontColor)) {
                Color graphicsColor = setFontColor(fontColor);
                watermarkerSettings.setGraphicsColor(graphicsColor);
            } else {
                String errMsg = "Please select Text Color.";
                request.setAttribute("_ERROR_MESSAGE_", errMsg);
                return "error";
            }
           
            DecimalFormat decimalFormat = new DecimalFormat();
            decimalFormat.applyPattern("0.00");
            if (UtilValidate.isNotEmpty(fontSize)) {
                BigDecimal widthBase = new BigDecimal(600.00);
                BigDecimal picWidth = new BigDecimal(decimalFormat.format(Float.parseFloat(width)));
                Font graphicsFont = setFontSize(fontSize, picWidth.divide(widthBase, 2));
                watermarkerSettings.setGraphicsFont(graphicsFont);
            } else {
                String errMsg = "Please select Text Size.";
                request.setAttribute("_ERROR_MESSAGE_", errMsg);
                return "error";
            }
           
            WatermarkSettings position = new WatermarkSettings();
            if (UtilValidate.isNotEmpty(x) && UtilValidate.isNotEmpty(y)) {
                BigDecimal positionX = new BigDecimal(decimalFormat.format(Float.parseFloat(x)));
                BigDecimal positionY = new BigDecimal(decimalFormat.format(Float.parseFloat(y)));
                position.setX(positionX.floatValue());
                position.setY(positionY.floatValue());
                watermarkerSettings.setWatermarkSettings(position);
            } else {
                String errMsg = "Please select Text Position.";
                request.setAttribute("_ERROR_MESSAGE_", errMsg);
                return "error";
            }
           
            AlphaComposite alphaComposite = null;
            if (UtilValidate.isNotEmpty(opacity)) {
                BigDecimal opa = new BigDecimal(opacity);
                alphaComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opa.floatValue());
                watermarkerSettings.setAlphaComposite(alphaComposite);
            }
           
            if (UtilValidate.isNotEmpty(imageUrl)) {
               
                Map<String, Object> contentCtx = FastMap.newInstance();
View Full Code Here


        WatermarkSettings position = new WatermarkSettings();
        position.setX(positionX.floatValue());
        position.setY(positionY.floatValue());
        Color graphicsColor = setFontColor(fontColor);
        Font graphicsFont = setFontSize(fontSize, picWidth.divide(widthBase, 2));
        WatermarkerSettings watermarkerSettings = WatermarkerSettings.DEFAULT;
        watermarkerSettings.setGraphicsColor(graphicsColor);
        watermarkerSettings.setGraphicsFont(graphicsFont);
        watermarkerSettings.setWatermarkSettings(position);
        watermarkerSettings.setAlphaComposite(alphaComposite);
        try {
           URL imageUrl = new URL("file:" + imageServerPath + "/" + productId + "/" + imageName);
           File outputImageFile = new File(imageServerPath + "/preview/" + "/previewImage" + nextPic + ".jpg");
           OutputStream outputStream = new FileOutputStream(outputImageFile);
          
View Full Code Here

TOP

Related Classes of watermarker.model.WatermarkerSettings

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.