Package org.apache.batik.bridge

Examples of org.apache.batik.bridge.IllegalAttributeValueException


        } else if (VALUE_GAMMA.equals(value)) {
            type = ComponentTransferFunction.GAMMA;
        } else if (VALUE_IDENTITY.equals(value)) {
            type = ComponentTransferFunction.IDENTITY;
        } else {
            throw new IllegalAttributeValueException(
                Messages.formatMessage("feComponentTransfer.type.invalid",
                                       new Object[] { value }));
        }
        return type;
    }
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 (radiusX < 0) {
            // A negative value is an error
            throw new IllegalAttributeValueException(
                Messages.formatMessage("feMorphology.radiusX.invalid", null));
        }

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

        String operatorStr = filterElement.getAttributeNS(null, ATTR_OPERATOR);
        boolean doDilation;
        if (operatorStr.length() == 0) {
            doDilation = false; // default is erode
        } else if (VALUE_DILATE.equals(operatorStr)) {
            doDilation = true;
        } else if (VALUE_ERODE.equals(operatorStr)) {
            doDilation = false;
        } else {
            throw new IllegalAttributeValueException(
                Messages.formatMessage("feMorphology.operator.invalid",
                                       new Object[] { operatorStr }));
        }

        // Get source
View Full Code Here

        } else if (VALUE_STITCH.equals(stitchTilesAttr)) {
            stitchTiles = true;
        } else if (VALUE_NO_STITCH.equals(stitchTilesAttr)) {
            stitchTiles = false;
        } else {
            throw new IllegalAttributeValueException(
                Messages.formatMessage("feTurbulence.stitchTiles.invalid",
                                       new Object[] { stitchTilesAttr }));
        }

        // parse the type attribute
        String feTurbulenceTypeAttr =
            filterElement.getAttributeNS(null, ATTR_TYPE);

        boolean feTurbulenceType;
        if (feTurbulenceTypeAttr.length() == 0) {
            feTurbulenceType = false; // default is turbulence
        } else if(VALUE_FRACTAL_NOISE.equals(feTurbulenceTypeAttr)){
            feTurbulenceType = true;
        } else if(VALUE_TURBULENCE.equals(feTurbulenceTypeAttr)){
            feTurbulenceType = false;
        } else {
            throw new IllegalAttributeValueException(
                Messages.formatMessage("feTurbulence.type.invalid",
                                       new Object[] { feTurbulenceTypeAttr }));
        }

        //
View Full Code Here

        } else if (VALUE_LIGHTEN.equals(ruleStr)) {
            rule = CompositeRule.LIGHTEN;

        } else {
            throw new IllegalAttributeValueException(
                Messages.formatMessage("feBlen.mode.invalid",
                                       new Object[] { ruleStr }));
        }
        return rule;
    }
View Full Code Here

    public static GradientStop convertGradientStop(Element stop,
                                                   BridgeContext ctx) {
        // parse the offset attribute, (required and must between [0-1])
        String offsetStr = stop.getAttributeNS(null, ATTR_OFFSET);
        if (offsetStr.length() == 0) {
            throw new IllegalAttributeValueException(
                Messages.formatMessage("stop.offset.required", null));
        }
        float ratio = CSSUtilities.convertRatio(offsetStr);
        // parse the stop-color CSS properties
        CSSStyleDeclaration decl =
View Full Code Here

        } else if (VALUE_REPEAT.equals(spreadMethod)) {
            return LinearGradientPaint.REPEAT;
        } else if (VALUE_PAD.equals(spreadMethod)) {
            return LinearGradientPaint.NO_CYCLE;
        }
        throw new IllegalAttributeValueException(
            Messages.formatMessage("gradient.spreadMethod.invalid",
                                   new Object[] {spreadMethod}));
    }
View Full Code Here

            throw new MissingAttributeException(
                Messages.formatMessage("image.xlinkHref.required", null));
        }
        // bad URL type
        if (uriStr.indexOf('#') != -1) {
            throw new IllegalAttributeValueException(
                Messages.formatMessage("image.xlinkHref.invalid", null));
        }

        GraphicsNode node = null;
        try {
            if (uriStr.startsWith(PROTOCOL_DATA)) {
                // load the image as a base 64 encoded image
                node = createBase64ImageNode(ctx, svgElement, uriStr);
            } else {
                SVGDocument svgDoc = (SVGDocument)element.getOwnerDocument();
                URL baseURL = ((SVGOMDocument)svgDoc).getURLObject();
                URL url = new URL(baseURL, uriStr);
                // try to load an SVG document
                DocumentLoader loader = ctx.getDocumentLoader();
                URIResolver resolver = new URIResolver(svgDoc, loader);
                try {
                    Node n = resolver.getNode(url.toString());
                    if (n.getNodeType() == n.DOCUMENT_NODE) {
                        SVGDocument imgDocument = (SVGDocument)n;
                        node=createSVGImageNode(ctx, svgElement, imgDocument);
                    }
                } catch (Exception ex) { /* Nothing to do */ }
                if (node == null) {
                    // try to load the image as a raster image (JPG or PNG)
                    node = createRasterImageNode(ctx, svgElement, url);
                }
            }
        } catch(MalformedURLException ex) {
            throw new IllegalAttributeValueException(
                Messages.formatMessage("image.xlinkHref.badURL", null));
        }
        if (node == null) {
            throw new IllegalAttributeValueException(
                Messages.formatMessage("image.xlinkHref.badImageType", null));
        }
        ImageNode imgNode = ctx.getGVTFactory().createImageNode();
        imgNode.setImage(node);
        // initialize the transform
View Full Code Here

            w = SVGUtilities.svgToUserSpace(svgElement,
                                            ATTR_WIDTH, s,
                                            uctx,
                                            UnitProcessor.HORIZONTAL_LENGTH);
            if (w < 0) {
                throw new IllegalAttributeValueException(
                    Messages.formatMessage("image.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("image.height.required", null));
        } else {
            h = SVGUtilities.svgToUserSpace(svgElement,
                                            ATTR_HEIGHT, s,
                                            uctx,
                                            UnitProcessor.VERTICAL_LENGTH);
            if (h < 0) {
                throw new IllegalAttributeValueException(
                    Messages.formatMessage("image.height.negative", null));
            }
        }

        return new Rectangle2D.Float(x, y, w, h);
View Full Code Here

            if (namespaceURI == null ||
                    !namespaceURI.equals(SVG_NAMESPACE_URI)) {
                continue; // skip element in the wrong namespace
            }
            if (!elt.getLocalName().equals(TAG_FE_MERGE_NODE)) {
                throw new IllegalAttributeValueException(
                    Messages.formatMessage("feMerge.subelement.invalid",
                                           new Object[] {elt.getLocalName()}));
            }

            String inAttr = elt.getAttributeNS(null, ATTR_IN);
View Full Code Here

        } else if (VALUE_G.equals(value)) {
            channelSelector = ARGBChannel.G;
        } else if (VALUE_B.equals(value)) {
            channelSelector = ARGBChannel.B;
        } else {
            throw new IllegalAttributeValueException(
                Messages.formatMessage(
                    "feDisplacementMap.channelSelector.invalid",
                    new Object[] { value }));

        }
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.