filterElement = (Element) parentNode; return convertFilterPrimitiveRegion(filterPrimitiveElement, filterElement, filteredElement,
/** * Converts on the specified filter primitive element, the specified * attribute that represents an integer and with the specified * default value. * * @param filterElement the filter primitive element * @param attrName the name of the attribute * @param defaultValue the default value of the attribute * @param ctx the BridgeContext to use for error information */ protected static int convertInteger(Element filterElement, String attrName, int defaultValue, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, attrName); if (s.length() == 0) { return defaultValue; } else { try { return SVGUtilities.convertSVGInteger(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); } } }
/** * Converts the 'values' attribute of the specified feColorMatrix * filter primitive element for the 'saturate' type. * * @param filterElement the filter element * @param ctx the BridgeContext to use for error information */ protected static float convertValuesToSaturate(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_VALUES_ATTRIBUTE); if (s.length() == 0) return 1; // default is 1 try { return SVGUtilities.convertSVGNumber(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_VALUES_ATTRIBUTE, s}); } }
String cxStr = SVGUtilities.getChainableAttributeNS (paintElement, null, SVG_CX_ATTRIBUTE, ctx); if (cxStr.length() == 0) { String cyStr = SVGUtilities.getChainableAttributeNS (paintElement, null, SVG_CY_ATTRIBUTE, ctx); if (cyStr.length() == 0) { String rStr = SVGUtilities.getChainableAttributeNS (paintElement, null, SVG_R_ATTRIBUTE, ctx); if (rStr.length() == 0) { String fxStr = SVGUtilities.getChainableAttributeNS (paintElement, null, SVG_FX_ATTRIBUTE, ctx); if (fxStr.length() == 0) { String fyStr = SVGUtilities.getChainableAttributeNS (paintElement, null, SVG_FY_ATTRIBUTE, ctx); if (fyStr.length() == 0) { String s = SVGUtilities.getChainableAttributeNS (paintElement, null, SVG_GRADIENT_UNITS_ATTRIBUTE, ctx); if (s.length() == 0) { coordSystemType = SVGUtilities.OBJECT_BOUNDING_BOX; } else { coordSystemType = SVGUtilities.parseCoordinateSystem (paintElement, SVG_GRADIENT_UNITS_ATTRIBUTE, s, ctx); transform = SVGUtilities.toObjectBBox(transform,
/** * Creates a <code>GraphicsNode</code> according to the specified parameters. * * @param ctx the bridge context to use * @param e the element that describes the graphics node to build * @return a graphics node that represents the specified element */ public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) { // 'requiredFeatures', 'requiredExtensions' and 'systemLanguage' if (!SVGUtilities.matchUserAgent(e, ctx.getUserAgent())) { return null; } CompositeGraphicsNode gn = buildCompositeGraphicsNode(ctx, e, null); return gn; }
Rectangle2D maskRegion = SVGUtilities.convertMaskRegion (maskElement, maskedElement, maskedNode, ctx); s = maskElement.getAttributeNS(null, SVG_TRANSFORM_ATTRIBUTE); if (s.length() != 0) { Tx = SVGUtilities.convertTransform (maskElement, SVG_TRANSFORM_ATTRIBUTE, s, ctx); } else { coordSystemType = SVGUtilities.USER_SPACE_ON_USE; } else { coordSystemType = SVGUtilities.parseCoordinateSystem (maskElement, SVG_MASK_CONTENT_UNITS_ATTRIBUTE, s, ctx); Tx = SVGUtilities.toObjectBBox(Tx, maskedNode);
Rectangle2D patternRegion = SVGUtilities.convertPatternRegion (patternElement, paintedElement, paintedNode, ctx); s = SVGUtilities.getChainableAttributeNS (patternElement, null, SVG_PATTERN_TRANSFORM_ATTRIBUTE, ctx); if (s.length() != 0) { patternTransform = SVGUtilities.convertTransform (patternElement, SVG_PATTERN_TRANSFORM_ATTRIBUTE, s, ctx); } else { s = SVGUtilities.getChainableAttributeNS (patternElement, null, SVG_PATTERN_CONTENT_UNITS_ATTRIBUTE, ctx); if (s.length() == 0) { contentCoordSystem = SVGUtilities.USER_SPACE_ON_USE; } else { contentCoordSystem = SVGUtilities.parseCoordinateSystem (patternElement, SVG_PATTERN_CONTENT_UNITS_ATTRIBUTE, s, ctx); String viewBoxStr = SVGUtilities.getChainableAttributeNS (patternElement, null, SVG_VIEW_BOX_ATTRIBUTE, ctx); String aspectRatioStr = SVGUtilities.getChainableAttributeNS (patternElement, null, SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, ctx); float w = (float)patternRegion.getWidth();
Rectangle2D filterRegion = SVGUtilities.convertFilterChainRegion (filterElement, filteredElement, filteredNode, ctx); if (filterRegion == null) { float [] filterRes = SVGUtilities.convertFilterRes(filterElement, ctx); filterChain.setFilterResolutionX((int)filterRes[0]); filterChain.setFilterResolutionY((int)filterRes[1]);
String cxStr = SVGUtilities.getChainableAttributeNS (paintElement, null, SVG_CX_ATTRIBUTE, ctx); if (cxStr.length() == 0) { String cyStr = SVGUtilities.getChainableAttributeNS (paintElement, null, SVG_CY_ATTRIBUTE, ctx); if (cyStr.length() == 0) { String rStr = SVGUtilities.getChainableAttributeNS (paintElement, null, SVG_R_ATTRIBUTE, ctx); if (rStr.length() == 0) { String fxStr = SVGUtilities.getChainableAttributeNS (paintElement, null, SVG_FX_ATTRIBUTE, ctx); if (fxStr.length() == 0) { String fyStr = SVGUtilities.getChainableAttributeNS (paintElement, null, SVG_FY_ATTRIBUTE, ctx); if (fyStr.length() == 0) { String s = SVGUtilities.getChainableAttributeNS (paintElement, null, SVG_GRADIENT_UNITS_ATTRIBUTE, ctx); if (s.length() == 0) { coordSystemType = SVGUtilities.OBJECT_BOUNDING_BOX; } else { coordSystemType = SVGUtilities.parseCoordinateSystem (paintElement, SVG_GRADIENT_UNITS_ATTRIBUTE, s, ctx); transform = SVGUtilities.toObjectBBox(transform,
/** * Creates a <code>GraphicsNode</code> according to the specified parameters. * * @param ctx the bridge context to use * @param e the element that describes the graphics node to build * @return a graphics node that represents the specified element */ public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) { // 'requiredFeatures', 'requiredExtensions' and 'systemLanguage' if (!SVGUtilities.matchUserAgent(e, ctx.getUserAgent())) { return null; } CompositeGraphicsNode gn = buildCompositeGraphicsNode(ctx, e, null); return gn; }
Rectangle2D maskRegion = SVGUtilities.convertMaskRegion (maskElement, maskedElement, maskedNode, ctx); s = maskElement.getAttributeNS(null, SVG_TRANSFORM_ATTRIBUTE); if (s.length() != 0) { Tx = SVGUtilities.convertTransform (maskElement, SVG_TRANSFORM_ATTRIBUTE, s, ctx); } else { coordSystemType = SVGUtilities.USER_SPACE_ON_USE; } else { coordSystemType = SVGUtilities.parseCoordinateSystem (maskElement, SVG_MASK_CONTENT_UNITS_ATTRIBUTE, s, ctx); Tx = SVGUtilities.toObjectBBox(Tx, maskedNode);
Rectangle2D patternRegion = SVGUtilities.convertPatternRegion (patternElement, paintedElement, paintedNode, ctx); s = SVGUtilities.getChainableAttributeNS (patternElement, null, SVG_PATTERN_TRANSFORM_ATTRIBUTE, ctx); if (s.length() != 0) { patternTransform = SVGUtilities.convertTransform (patternElement, SVG_PATTERN_TRANSFORM_ATTRIBUTE, s, ctx); } else { s = SVGUtilities.getChainableAttributeNS (patternElement, null, SVG_PATTERN_CONTENT_UNITS_ATTRIBUTE, ctx); if (s.length() == 0) { contentCoordSystem = SVGUtilities.USER_SPACE_ON_USE; } else { contentCoordSystem = SVGUtilities.parseCoordinateSystem (patternElement, SVG_PATTERN_CONTENT_UNITS_ATTRIBUTE, s, ctx); String viewBoxStr = SVGUtilities.getChainableAttributeNS (patternElement, null, SVG_VIEW_BOX_ATTRIBUTE, ctx); String aspectRatioStr = SVGUtilities.getChainableAttributeNS (patternElement, null, SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, ctx); float w = (float)patternRegion.getWidth();
Rectangle2D filterRegion = SVGUtilities.convertFilterChainRegion (filterElement, filteredElement, filteredNode, ctx); if (filterRegion == null) { float [] filterRes = SVGUtilities.convertFilterRes(filterElement, ctx); filterChain.setFilterResolutionX((int)filterRes[0]); filterChain.setFilterResolutionY((int)filterRes[1]);
String cxStr = SVGUtilities.getChainableAttributeNS (paintElement, null, SVG_CX_ATTRIBUTE, ctx); if (cxStr.length() == 0) { String cyStr = SVGUtilities.getChainableAttributeNS (paintElement, null, SVG_CY_ATTRIBUTE, ctx); if (cyStr.length() == 0) { String rStr = SVGUtilities.getChainableAttributeNS (paintElement, null, SVG_R_ATTRIBUTE, ctx); if (rStr.length() == 0) { String fxStr = SVGUtilities.getChainableAttributeNS (paintElement, null, SVG_FX_ATTRIBUTE, ctx); if (fxStr.length() == 0) { String fyStr = SVGUtilities.getChainableAttributeNS (paintElement, null, SVG_FY_ATTRIBUTE, ctx); if (fyStr.length() == 0) { String s = SVGUtilities.getChainableAttributeNS (paintElement, null, SVG_GRADIENT_UNITS_ATTRIBUTE, ctx); if (s.length() == 0) { coordSystemType = SVGUtilities.OBJECT_BOUNDING_BOX; } else { coordSystemType = SVGUtilities.parseCoordinateSystem (paintElement, SVG_GRADIENT_UNITS_ATTRIBUTE, s, ctx); transform = SVGUtilities.toObjectBBox(transform,
filterElement = (Element) parentNode; return convertFilterPrimitiveRegion(filterPrimitiveElement, filterElement, filteredElement,
/** * Creates a <code>GraphicsNode</code> according to the specified parameters. * * @param ctx the bridge context to use * @param e the element that describes the graphics node to build * @return a graphics node that represents the specified element */ public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) { // 'requiredFeatures', 'requiredExtensions' and 'systemLanguage' if (!SVGUtilities.matchUserAgent(e, ctx.getUserAgent())) { return null; } CompositeGraphicsNode gn = buildCompositeGraphicsNode(ctx, e, null); return gn; }
/** * Converts the 'values' attribute of the specified feColorMatrix * filter primitive element for the 'hueRotate' type. * * @param filterElement the filter element * @param ctx the BridgeContext to use for error information */ protected static float convertValuesToHueRotate(Element filterElement, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, SVG_VALUES_ATTRIBUTE); if (s.length() == 0) return 0; // default is 0 try { return (float) Math.toRadians( SVGUtilities.convertSVGNumber(s) ); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object [] {SVG_VALUES_ATTRIBUTE, s}); } }
Rectangle2D maskRegion = SVGUtilities.convertMaskRegion (maskElement, maskedElement, maskedNode, ctx); s = maskElement.getAttributeNS(null, SVG_TRANSFORM_ATTRIBUTE); if (s.length() != 0) { Tx = SVGUtilities.convertTransform (maskElement, SVG_TRANSFORM_ATTRIBUTE, s, ctx); } else { coordSystemType = SVGUtilities.USER_SPACE_ON_USE; } else { coordSystemType = SVGUtilities.parseCoordinateSystem (maskElement, SVG_MASK_CONTENT_UNITS_ATTRIBUTE, s, ctx); Tx = SVGUtilities.toObjectBBox(Tx, maskedNode);
Rectangle2D patternRegion = SVGUtilities.convertPatternRegion (patternElement, paintedElement, paintedNode, ctx); s = SVGUtilities.getChainableAttributeNS (patternElement, null, SVG_PATTERN_TRANSFORM_ATTRIBUTE, ctx); if (s.length() != 0) { patternTransform = SVGUtilities.convertTransform (patternElement, SVG_PATTERN_TRANSFORM_ATTRIBUTE, s, ctx); } else { s = SVGUtilities.getChainableAttributeNS (patternElement, null, SVG_PATTERN_CONTENT_UNITS_ATTRIBUTE, ctx); if (s.length() == 0) { contentCoordSystem = SVGUtilities.USER_SPACE_ON_USE; } else { contentCoordSystem = SVGUtilities.parseCoordinateSystem (patternElement, SVG_PATTERN_CONTENT_UNITS_ATTRIBUTE, s, ctx); String viewBoxStr = SVGUtilities.getChainableAttributeNS (patternElement, null, SVG_VIEW_BOX_ATTRIBUTE, ctx); String aspectRatioStr = SVGUtilities.getChainableAttributeNS (patternElement, null, SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, ctx); float w = (float)patternRegion.getWidth();
/** * Converts on the specified filter primitive element, the specified * attribute that represents an integer and with the specified * default value. * * @param filterElement the filter primitive element * @param attrName the name of the attribute * @param defaultValue the default value of the attribute * @param ctx the BridgeContext to use for error information */ protected static int convertInteger(Element filterElement, String attrName, int defaultValue, BridgeContext ctx) { String s = filterElement.getAttributeNS(null, attrName); if (s.length() == 0) { return defaultValue; } else { try { return SVGUtilities.convertSVGInteger(s); } catch (NumberFormatException nfEx ) { throw new BridgeException (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {attrName, s}); } } }