Examples of FilterChainRable


Examples of org.apache.batik.ext.awt.image.renderable.FilterChainRable

        // Pad out to filterRegion
        sourceGraphic = new PadRable8Bit(sourceGraphic, filterRegion,
                                         PadMode.ZERO_PAD);

        // build a FilterChainRable8Bit
        FilterChainRable filterChain
            = new FilterChainRable8Bit(sourceGraphic, filterRegion);

        // 'filterRes' attribute - default is implementation specific
        float [] filterRes = SVGUtilities.convertFilterRes(filterElement, ctx);
        filterChain.setFilterResolutionX((int)filterRes[0]);
        filterChain.setFilterResolutionY((int)filterRes[1]);

        // Create a map for filter nodes to advertise themselves as
        // named source
        Map filterNodeMap = new HashMap(11);
        filterNodeMap.put(SVG_SOURCE_GRAPHIC_VALUE, sourceGraphic);


        Filter in = buildFilterPrimitives(filterElement,
                                          filterRegion,
                                          filteredElement,
                                          filteredNode,
                                          sourceGraphic,
                                          filterNodeMap,
                                          ctx);
        if (in == null) {
            // error in one of the primitives, disable the filter
            return null;
        } else if (in == sourceGraphic) {
            // no filter primitive found, so output transparent black
            in = createEmptyFilter(filterElement, filterRegion, filteredElement,
                                   filteredNode, ctx);
        }
        filterChain.setSource(in);
        return filterChain;
    }
View Full Code Here

Examples of org.apache.batik.gvt.filter.FilterChainRable

                                                             filteredElement,
                                                             filteredNode,
                                                             uctx);

        // Build a ConcreteFilterChainRable
        FilterChainRable filterChain
            = new ConcreteFilterChainRable(sourceGraphic, filterRegion);

        // parse the filter resolution attribute
        String resStr = filterElement.getAttributeNS(null, ATTR_FILTER_RES);
        Float [] filterResolution = SVGUtilities.buildFloatPair(resStr);
        float filterResolutionX = -1; // -1 means undefined
        if (filterResolution[0] != null) {
            filterResolutionX = filterResolution[0].floatValue();
            if (filterResolutionX == 0) {
                return null; // zero value disable rendering of the filter
            }
            if (filterResolutionX < 0) {
                // A negative value is an error
                throw new IllegalAttributeValueException(
                    Messages.formatMessage("filter.filterResX.invalid", null));
            }
        }
        float filterResolutionY = filterResolutionX; // default is filterResX
        if (filterResolution[1] != null) {
            filterResolutionY = filterResolution[1].floatValue();
            if (filterResolutionY == 0) {
                return null; // zero value disable rendering of the filter
            }
            if (filterResolutionY < 0) {
                // A negative value is an error
                throw new IllegalAttributeValueException(
                    Messages.formatMessage("filter.filterResY.invalid", null));
            }
        }

        // Set resolution in filterChain
        filterChain.setFilterResolutionX((int)filterResolutionX);
        filterChain.setFilterResolutionY((int)filterResolutionY);

        // Now build the filter chain. Create a map for filter nodes
        // to advertise themselves as named sources.
        Map filterNodeMap = new HashMap();
        if (in == null) {
            // For the filter element, the in parameter is overridden
            in = sourceGraphic;
            filterNodeMap.put(VALUE_SOURCE_GRAPHIC, sourceGraphic);
        }

        for (Node child=filterElement.getFirstChild();
                 child != null;
                 child = child.getNextSibling()) {

            if (child.getNodeType() != Node.ELEMENT_NODE) {
                continue; // skip node that is not an Element
            }
            Element elt = (Element)child;
            Bridge bridge = bridgeContext.getBridge(elt);
            if (bridge == null || !(bridge instanceof FilterPrimitiveBridge)) {
                continue;
                /*
                throw new IllegalAttributeValueException(
                    Messages.formatMessage("filter.subelement.illegal",
                                           new Object[] {elt.getLocalName()}));*/
            }
            FilterPrimitiveBridge filterBridge =
                (FilterPrimitiveBridge)bridge;
            Filter filterNode = filterBridge.create(filteredNode,
                                                    bridgeContext,
                                                    elt,
                                                    filteredElement,
                                                    in,
                                                    filterRegion,
                                                    filterNodeMap);
            if (filterNode == null) {
                throw new IllegalAttributeValueException(
                    Messages.formatMessage("filter.subelement.invalid",
                                           new Object[] {elt.getLocalName()}));
            }
            in = filterNode;
        }

        // Set the source on the filter node
        if(in != sourceGraphic){
            filterChain.setSource(in);
        } else {
            // No child filter node. Disable filter
            //filterChain.setSource(null);
            return null;
        }
View Full Code Here

Examples of org.apache.batik.gvt.filter.FilterChainRable

                }
                // Primitive Paint did the work...
                return;
            }
            else if (filter instanceof FilterChainRable) {
                FilterChainRable fcr = (FilterChainRable)filter;
                PadRable pad = (PadRable)fcr.getSource();
                drawImage(g2d, pad);
                return;
            }
        }
View Full Code Here

Examples of org.apache.flex.forks.batik.ext.awt.image.renderable.FilterChainRable

        // Pad out to filterRegion
        sourceGraphic = new PadRable8Bit(sourceGraphic, filterRegion,
                                         PadMode.ZERO_PAD);

        // build a FilterChainRable8Bit
        FilterChainRable filterChain
            = new FilterChainRable8Bit(sourceGraphic, filterRegion);

        // 'filterRes' attribute - default is implementation specific
        float [] filterRes = SVGUtilities.convertFilterRes(filterElement, ctx);
        filterChain.setFilterResolutionX((int)filterRes[0]);
        filterChain.setFilterResolutionY((int)filterRes[1]);

        // Create a map for filter nodes to advertise themselves as
        // named source
        Map filterNodeMap = new HashMap(11);
        filterNodeMap.put(SVG_SOURCE_GRAPHIC_VALUE, sourceGraphic);


        Filter in = buildFilterPrimitives(filterElement,
                                          filterRegion,
                                          filteredElement,
                                          filteredNode,
                                          sourceGraphic,
                                          filterNodeMap,
                                          ctx);
        if ((in == null) || (in == sourceGraphic)) {
            return null; // no filter primitives found, disable the filter.
        } else {
            filterChain.setSource(in);
            return filterChain;
        }
    }
View Full Code Here

Examples of org.apache.flex.forks.batik.ext.awt.image.renderable.FilterChainRable

        // Pad out to filterRegion
        sourceGraphic = new PadRable8Bit(sourceGraphic, filterRegion,
                                         PadMode.ZERO_PAD);

        // build a FilterChainRable8Bit
        FilterChainRable filterChain
            = new FilterChainRable8Bit(sourceGraphic, filterRegion);

        // 'filterRes' attribute - default is implementation specific
        float [] filterRes = SVGUtilities.convertFilterRes(filterElement, ctx);
        filterChain.setFilterResolutionX((int)filterRes[0]);
        filterChain.setFilterResolutionY((int)filterRes[1]);

        // Create a map for filter nodes to advertise themselves as
        // named source
        Map filterNodeMap = new HashMap(11);
        filterNodeMap.put(SVG_SOURCE_GRAPHIC_VALUE, sourceGraphic);


        Filter in = buildFilterPrimitives(filterElement,
                                          filterRegion,
                                          filteredElement,
                                          filteredNode,
                                          sourceGraphic,
                                          filterNodeMap,
                                          ctx);
        if (in == null) {
            // error in one of the primitives, disable the filter
            return null;
        } else if (in == sourceGraphic) {
            // no filter primitive found, so output transparent black
            in = createEmptyFilter(filterElement, filterRegion, filteredElement,
                                   filteredNode, ctx);
        }
        filterChain.setSource(in);
        return filterChain;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.