Package org.apache.batik.bridge

Examples of org.apache.batik.bridge.IllegalAttributeValueException


     */
    private static float[][] convertValuesToMatrix(String value){
        StringTokenizer st = new StringTokenizer(value, " ,");
        float matrix[][] = new float[4][5];
        if(st.countTokens() != 20){
            throw new IllegalAttributeValueException(
                Messages.formatMessage("feColorMatrix.values.invalid",
                                       new Object[] { value }));
        }
        int i = 0;
        String v = "";
        try {
            while(st.hasMoreTokens()){
                v = st.nextToken();
                matrix[i/5][i%5] = Float.parseFloat(v);
                i++;
            }
        } catch (NumberFormatException ex) {
            throw new IllegalAttributeValueException(
                Messages.formatMessage("feColorMatrix.value.invalid",
                                       new Object[] { v }));

        }

View Full Code Here


        } else if (VALUE_MATRIX.equals(typeStr)) {
            type = ColorMatrixRable.TYPE_MATRIX;

        } else {
            throw new IllegalAttributeValueException(
                Messages.formatMessage("feColorMatrix.type.invalid",
                                       new Object[] { typeStr }));
        }
        return type;
    }
View Full Code Here

        ph.setWindingRule(wr);
        p.setPointsHandler(ph);
        try {
            p.parse(new StringReader(pts));
        } catch (ParseException ex) {
            throw new IllegalAttributeValueException(
                Messages.formatMessage("polygon.points.invalid",
                                       new Object[] {ex.getMessage()}),
                node);
        } finally {
            node.setShape(ph.getShape());
View Full Code Here

        ph.setWindingRule(wr);
        p.setPathHandler(ph);
        try {
            p.parse(new StringReader(d));
        } catch (ParseException ex) {
            throw new IllegalAttributeValueException(
                Messages.formatMessage("path.d.invalid",
                                       new Object[] {ex.getMessage()}),
                node);
        } finally {
            node.setShape(ph.getShape());
View Full Code Here

        }
        int unitsType;
        try {
            unitsType = SVGUtilities.parseCoordinateSystem(units);
        } catch (IllegalArgumentException ex) {
            throw new IllegalAttributeValueException(
                Messages.formatMessage("clipPath.units.invalid",
                                       new Object[] {units,
                                                     ATTR_CLIP_PATH_UNITS}));
        }
        if (unitsType == SVGUtilities.OBJECT_BOUNDING_BOX) {
            // units are resolved using objectBoundingBox
            ctx.setCurrentViewport(new ObjectBoundingBoxViewport());
        }
        // compute an additional transform related the clipPathUnits
        Tx = SVGUtilities.convertAffineTransform(Tx, gn, unitsType);

        // build the clipPath according to the clipPath's children
        boolean hasChildren = false;
        for(Node node=clipElement.getFirstChild();
                node != null;
                node = node.getNextSibling()){

            // check if the node is a valid Element
            if (node.getNodeType() != node.ELEMENT_NODE) {
                continue;
            }
            Element child = (Element)node;
            GraphicsNode clipNode = builder.build(ctx, child) ;
            // check if a GVT node has been created
            if (clipNode == null) {
                throw new IllegalAttributeValueException(
                    Messages.formatMessage("clipPath.subelement.illegal",
                                        new Object[] {node.getLocalName()}));
            }
            hasChildren = true;
            // compute the outline of the current Element
View Full Code Here

            // <!> FIXME :  the result is a fully transparent image
            // A value of zero disables the effect of the filter primitive
            return null;
        } else if (stdDeviationX < 0) {
            // A negative value is an error
            throw new IllegalAttributeValueException(
                Messages.formatMessage("feGaussianBlur.stdDeviationX.invalid",
                                       null));
        }

        // parse the stdDeviationY
        float stdDeviationY = stdDeviationX; // default is the stdDeviationX
        if (deviationPair[1] != null) {
            stdDeviationY = deviationPair[1].floatValue();
        }
        if (stdDeviationY == 0) {
            // <!> FIXME :  the result is a fully transparent image
            // A value of zero disables the effect of the filter primitive
            return null;
        } else if (stdDeviationY < 0) {
            // A negative value is an error
            throw new IllegalAttributeValueException(
                Messages.formatMessage("feGaussianBlur.stdDeviationY.invalid",
                                       null));
        }

        // Get source
View Full Code Here

            w = SVGUtilities.svgToUserSpace(svgElement,
                                            ATTR_WIDTH, s,
                                            uctx,
                                            UnitProcessor.HORIZONTAL_LENGTH);
            if (w < 0) {
                throw new IllegalAttributeValueException(
                    Messages.formatMessage("rect.width.negative", null));
            }
        }

        // parse the height attribute (required and must be positive)
        s = svgElement.getAttributeNS(null, ATTR_HEIGHT);
        float h;
        if (s.length() == 0) {
            throw new MissingAttributeException(
                Messages.formatMessage("rect.height.required", null));
        } else {
            h = SVGUtilities.svgToUserSpace(svgElement,
                                            ATTR_HEIGHT, s,
                                            uctx,
                                            UnitProcessor.VERTICAL_LENGTH);
            if (h < 0) {
                throw new IllegalAttributeValueException(
                    Messages.formatMessage("rect.height.negative", null));
            }
        }

        // parse the rx attribute (must be positive if any)
        s = svgElement.getAttributeNS(null, ATTR_RX);
        boolean rxs = s.length() != 0;
        float rx = 0;
        if (s.length() != 0) {
            rx = SVGUtilities.svgToUserSpace(svgElement,
                                             ATTR_RX, s,
                                             uctx,
                                             UnitProcessor.HORIZONTAL_LENGTH);
            if (rx < 0) {
                throw new IllegalAttributeValueException(
                    Messages.formatMessage("rect.rx.negative", null));
            }
        }
        rx = (rx > w / 2) ? w / 2 : rx;

        // parse the ry attribute (must be positive if any)
        s = svgElement.getAttributeNS(null, ATTR_RY);
        boolean rys = s.length() != 0;
        float ry = 0;
        if (s.length() != 0) {
            ry = SVGUtilities.svgToUserSpace(svgElement,
                                             ATTR_RY, s,
                                             uctx,
                                             UnitProcessor.VERTICAL_LENGTH);
            if (ry < 0) {
                throw new IllegalAttributeValueException(
                    Messages.formatMessage("rect.ry.negative", null));
            }
        }
        ry = (ry > h / 2) ? h / 2 : ry;
        Shape shape = null;
View Full Code Here

        int maskContentUnitsType;
        try {
            maskContentUnitsType =
                SVGUtilities.parseCoordinateSystem(maskContentUnits);
        } catch (IllegalArgumentException ex) {
            throw new IllegalAttributeValueException(
                Messages.formatMessage("mask.maskContentUnits.invalid",
                                       new Object[] {maskContentUnits,
                                                     ATTR_CLIP_PATH_UNITS}));
        }
View Full Code Here

        int unitsType;
        try {
            unitsType = SVGUtilities.parseCoordinateSystem(units);
        } catch (IllegalArgumentException ex) {
            throw new IllegalAttributeValueException(
                Messages.formatMessage("radialGradient.units.invalid",
                                       new Object[] {units,
                                                     ATTR_GRADIENT_UNITS}));
        }
View Full Code Here

            while(st.hasMoreTokens()){
                v = st.nextToken();
                tableValues[i++] = Float.parseFloat(v);
            }
        } catch(NumberFormatException ex) {
            throw new IllegalAttributeValueException(
                Messages.formatMessage("feComponentTransfer.value.invalid",
                                       new Object[] { v }));
        }
        return tableValues;
    }
View Full Code Here

TOP

Related Classes of org.apache.batik.bridge.IllegalAttributeValueException

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.