You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jm...@apache.org on 2013/10/08 16:03:28 UTC
[13/62] [abbrv] [partial] Merged Apache Flex 4.9.0 release branch
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeImageElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeImageElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeImageElementBridge.java
index 46cdc4f..b85d789 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeImageElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeImageElementBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001-2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -18,12 +19,10 @@
package org.apache.flex.forks.batik.bridge;
import java.awt.geom.AffineTransform;
-import java.awt.geom.NoninvertibleTransformException;
import java.awt.geom.Rectangle2D;
import java.util.Map;
import org.apache.flex.forks.batik.dom.util.XLinkSupport;
-import org.apache.flex.forks.batik.util.XMLConstants;
import org.apache.flex.forks.batik.ext.awt.image.PadMode;
import org.apache.flex.forks.batik.ext.awt.image.renderable.AffineRable8Bit;
import org.apache.flex.forks.batik.ext.awt.image.renderable.Filter;
@@ -38,7 +37,7 @@ import org.w3c.dom.Element;
* Bridge class for the <feImage> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFeImageElementBridge.java,v 1.23 2005/03/27 08:58:30 cam Exp $
+ * @version $Id: SVGFeImageElementBridge.java 501922 2007-01-31 17:47:47Z dvholten $
*/
public class SVGFeImageElementBridge
extends AbstractSVGFilterPrimitiveElementBridge {
@@ -84,7 +83,7 @@ public class SVGFeImageElementBridge
// 'xlink:href' attribute
String uriStr = XLinkSupport.getXLinkHref(filterElement);
if (uriStr.length() == 0) {
- throw new BridgeException(filterElement, ERR_ATTRIBUTE_MISSING,
+ throw new BridgeException(ctx, filterElement, ERR_ATTRIBUTE_MISSING,
new Object[] {"xlink:href"});
}
@@ -94,30 +93,30 @@ public class SVGFeImageElementBridge
// and it behaves like a <use> if it references a document
// fragment.
//
- // To provide this behavior, depending on whether the uri
- // contains a fragment identifier, we create either an
+ // To provide this behavior, depending on whether the uri
+ // contains a fragment identifier, we create either an
// <image> or a <use> element and request the corresponding
// bridges to build the corresponding GraphicsNode for us.
- //
- // Then, we take care of the possible transformation needed
+ //
+ // Then, we take care of the possible transformation needed
// from objectBoundingBox space to user space.
//
-
+
Document document = filterElement.getOwnerDocument();
- boolean isUse = (uriStr.indexOf("#") != -1);
+ boolean isUse = uriStr.indexOf('#') != -1;
Element contentElement = null;
if (isUse) {
contentElement = document.createElementNS(SVG_NAMESPACE_URI,
- SVG_USE_TAG);
+ SVG_USE_TAG);
} else {
contentElement = document.createElementNS(SVG_NAMESPACE_URI,
- SVG_IMAGE_TAG);
+ SVG_IMAGE_TAG);
}
-
- contentElement.setAttributeNS(XLinkSupport.XLINK_NAMESPACE_URI, XMLConstants.XLINK_PREFIX +
- ":" + SVG_HREF_ATTRIBUTE,
- uriStr);
+
+ contentElement.setAttributeNS(XLINK_NAMESPACE_URI,
+ XLINK_HREF_QNAME,
+ uriStr);
Element proxyElement = document.createElementNS(SVG_NAMESPACE_URI,
SVG_G_TAG);
@@ -125,29 +124,48 @@ public class SVGFeImageElementBridge
// feImage's default region is that of the filter chain.
Rectangle2D defaultRegion = filterRegion;
+ Element filterDefElement = (Element)(filterElement.getParentNode());
- // Compute the transform from object bounding box to user
- // space if needed.
- AffineTransform at = new AffineTransform();
+ Rectangle2D primitiveRegion =
+ SVGUtilities.getBaseFilterPrimitiveRegion(filterElement,
+ filteredElement,
+ filteredNode,
+ defaultRegion,
+ ctx);
+
+ // System.err.println(">>>>>>>> primitiveRegion : " + primitiveRegion);
+
+ contentElement.setAttributeNS(null, SVG_X_ATTRIBUTE, String.valueOf( primitiveRegion.getX() ) );
+ contentElement.setAttributeNS(null, SVG_Y_ATTRIBUTE, String.valueOf( primitiveRegion.getY() ) );
+ contentElement.setAttributeNS(null, SVG_WIDTH_ATTRIBUTE, String.valueOf( primitiveRegion.getWidth() ) );
+ contentElement.setAttributeNS(null, SVG_HEIGHT_ATTRIBUTE, String.valueOf( primitiveRegion.getHeight() ) );
+
+
+ GraphicsNode node = ctx.getGVTBuilder().build(ctx, proxyElement);
+ Filter filter = node.getGraphicsNodeRable(true);
// 'primitiveUnits' attribute - default is userSpaceOnUse
short coordSystemType;
- Element filterDefElement = (Element)(filterElement.getParentNode());
- boolean isBBox = false;
String s = SVGUtilities.getChainableAttributeNS
(filterDefElement, null, SVG_PRIMITIVE_UNITS_ATTRIBUTE, ctx);
if (s.length() == 0) {
coordSystemType = SVGUtilities.USER_SPACE_ON_USE;
} else {
- coordSystemType = SVGUtilities.parseCoordinateSystem
- (filterDefElement, SVG_PRIMITIVE_UNITS_ATTRIBUTE, s);
+ coordSystemType = SVGUtilities.parseCoordinateSystem
+ (filterDefElement, SVG_PRIMITIVE_UNITS_ATTRIBUTE, s, ctx);
}
-
+
+ // Compute the transform from object bounding box to user
+ // space if needed.
+ AffineTransform at = new AffineTransform();
if (coordSystemType == SVGUtilities.OBJECT_BOUNDING_BOX) {
- isBBox = true;
at = SVGUtilities.toObjectBBox(at, filteredNode);
}
-
+ filter = new AffineRable8Bit(filter, at);
+
+ // handle the 'color-interpolation-filters' property
+ handleColorInterpolationFilters(filter, filterElement);
+
// get filter primitive chain region
Rectangle2D primitiveRegionUserSpace
= SVGUtilities.convertFilterPrimitiveRegion(filterElement,
@@ -156,35 +174,8 @@ public class SVGFeImageElementBridge
defaultRegion,
filterRegion,
ctx);
- Rectangle2D primitiveRegion = primitiveRegionUserSpace;
-
- if (isBBox) {
- try {
- AffineTransform ati = at.createInverse();
- primitiveRegion = ati.createTransformedShape(primitiveRegion).getBounds2D();
- } catch (NoninvertibleTransformException nite) {
- // Should never happen, seem above
- throw new Error();
- }
- }
-
- contentElement.setAttributeNS(null, SVG_X_ATTRIBUTE, "" + primitiveRegion.getX());
- contentElement.setAttributeNS(null, SVG_Y_ATTRIBUTE, "" + primitiveRegion.getY());
- contentElement.setAttributeNS(null, SVG_WIDTH_ATTRIBUTE, "" + primitiveRegion.getWidth());
- contentElement.setAttributeNS(null, SVG_HEIGHT_ATTRIBUTE, "" + primitiveRegion.getHeight());
-
- // System.err.println(">>>>>>>>>>>> primitiveRegion : " + primitiveRegion);
- // System.err.println(">>>>>>>>>>>> at : " + at);
-
- GraphicsNode node = ctx.getGVTBuilder().build(ctx, proxyElement);
- Filter filter = node.getGraphicsNodeRable(true);
-
- filter = new AffineRable8Bit(filter, at);
-
- // handle the 'color-interpolation-filters' property
- handleColorInterpolationFilters(filter, filterElement);
-
- filter = new PadRable8Bit(filter, primitiveRegionUserSpace, PadMode.ZERO_PAD);
+ filter = new PadRable8Bit(filter, primitiveRegionUserSpace,
+ PadMode.ZERO_PAD);
// update the filter Map
updateFilterMap(filterElement, filter, filterMap);
@@ -233,20 +224,20 @@ public class SVGFeImageElementBridge
coordSystemType = SVGUtilities.USER_SPACE_ON_USE;
} else {
coordSystemType = SVGUtilities.parseCoordinateSystem
- (filterDefElement, SVG_PRIMITIVE_UNITS_ATTRIBUTE, s);
+ (filterDefElement, SVG_PRIMITIVE_UNITS_ATTRIBUTE, s, ctx);
}
-
+
if (coordSystemType == SVGUtilities.OBJECT_BOUNDING_BOX) {
at = SVGUtilities.toObjectBBox(at, filteredNode);
}
Rectangle2D bounds = filteredNode.getGeometryBounds();
at.preConcatenate(AffineTransform.getTranslateInstance
- (primitiveRegion.getX() - bounds.getX(),
+ (primitiveRegion.getX() - bounds.getX(),
primitiveRegion.getY() - bounds.getY()));
-
+
} else {
-
+
// Need to translate the image to the x, y coordinate to
// have the same behavior as the <use> element
at.translate(primitiveRegion.getX(), primitiveRegion.getY());
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeMergeElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeMergeElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeMergeElementBridge.java
index a735f50..1a300de 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeMergeElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeMergeElementBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001-2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -36,7 +37,7 @@ import org.w3c.dom.Node;
* Bridge class for the <feMerge> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFeMergeElementBridge.java,v 1.18 2004/08/18 07:12:33 vhardy Exp $
+ * @version $Id: SVGFeMergeElementBridge.java 475477 2006-11-15 22:44:28Z cam $
*/
public class SVGFeMergeElementBridge
extends AbstractSVGFilterPrimitiveElementBridge {
@@ -179,7 +180,8 @@ public class SVGFeMergeElementBridge
/**
* Bridge class for the <feMergeNode> element.
*/
- public static class SVGFeMergeNodeElementBridge extends AbstractSVGBridge {
+ public static class SVGFeMergeNodeElementBridge
+ extends AnimatableGenericSVGBridge {
/**
* Constructs a new bridge for the <feMergeNode> element.
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeMorphologyElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeMorphologyElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeMorphologyElementBridge.java
index 87b8474..12826ec 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeMorphologyElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeMorphologyElementBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001-2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -33,7 +34,7 @@ import org.w3c.dom.Element;
* Bridge class for the <feMorphology> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFeMorphologyElementBridge.java,v 1.15 2004/08/18 07:12:34 vhardy Exp $
+ * @version $Id: SVGFeMorphologyElementBridge.java 501922 2007-01-31 17:47:47Z dvholten $
*/
public class SVGFeMorphologyElementBridge
extends AbstractSVGFilterPrimitiveElementBridge {
@@ -78,13 +79,13 @@ public class SVGFeMorphologyElementBridge
Map filterMap) {
// 'radius' attribute - default is [0, 0]
- float [] radii = convertRadius(filterElement);
+ float[] radii = convertRadius(filterElement, ctx);
if (radii[0] == 0 || radii[1] == 0) {
return null; // disable the filter
}
// 'operator' attribute - default is 'erode'
- boolean isDilate = convertOperator(filterElement);
+ boolean isDilate = convertOperator(filterElement, ctx);
// 'in' attribute
Filter in = getIn(filterElement,
@@ -134,8 +135,10 @@ public class SVGFeMorphologyElementBridge
* filter primitive.
*
* @param filterElement the feMorphology filter primitive
+ * @param ctx the BridgeContext to use for error information
*/
- protected static float [] convertRadius(Element filterElement) {
+ protected static float[] convertRadius(Element filterElement,
+ BridgeContext ctx) {
String s = filterElement.getAttributeNS(null, SVG_RADIUS_ATTRIBUTE);
if (s.length() == 0) {
return new float[] {0, 0};
@@ -149,14 +152,14 @@ public class SVGFeMorphologyElementBridge
} else {
radii[1] = radii[0];
}
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException nfEx ) {
throw new BridgeException
- (filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
- new Object[] {SVG_RADIUS_ATTRIBUTE, s, ex});
+ (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object[] {SVG_RADIUS_ATTRIBUTE, s, nfEx });
}
if (tokens.hasMoreTokens() || radii[0] < 0 || radii[1] < 0) {
throw new BridgeException
- (filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object[] {SVG_RADIUS_ATTRIBUTE, s});
}
return radii;
@@ -167,8 +170,10 @@ public class SVGFeMorphologyElementBridge
* primitive.
*
* @param filterElement the feMorphology filter primitive
+ * @param ctx the BridgeContext to use for error information
*/
- protected static boolean convertOperator(Element filterElement) {
+ protected static boolean convertOperator(Element filterElement,
+ BridgeContext ctx) {
String s = filterElement.getAttributeNS(null, SVG_OPERATOR_ATTRIBUTE);
if (s.length() == 0) {
return false;
@@ -179,8 +184,8 @@ public class SVGFeMorphologyElementBridge
if (SVG_DILATE_VALUE.equals(s)) {
return true;
}
- throw new BridgeException(filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
- new Object[] {SVG_OPERATOR_ATTRIBUTE, s});
+ throw new BridgeException
+ (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object[] {SVG_OPERATOR_ATTRIBUTE, s});
}
-
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeOffsetElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeOffsetElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeOffsetElementBridge.java
index 987d7c3..24b2e99 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeOffsetElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeOffsetElementBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001-2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -33,7 +34,7 @@ import org.w3c.dom.Element;
* Bridge class for the <feOffset> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFeOffsetElementBridge.java,v 1.15 2004/08/18 07:12:34 vhardy Exp $
+ * @version $Id: SVGFeOffsetElementBridge.java 475477 2006-11-15 22:44:28Z cam $
*/
public class SVGFeOffsetElementBridge
extends AbstractSVGFilterPrimitiveElementBridge {
@@ -100,8 +101,8 @@ public class SVGFeOffsetElementBridge
filterRegion,
ctx);
- float dx = convertNumber(filterElement, SVG_DX_ATTRIBUTE, 0);
- float dy = convertNumber(filterElement, SVG_DY_ATTRIBUTE, 0);
+ float dx = convertNumber(filterElement, SVG_DX_ATTRIBUTE, 0, ctx);
+ float dy = convertNumber(filterElement, SVG_DY_ATTRIBUTE, 0, ctx);
AffineTransform at = AffineTransform.getTranslateInstance(dx, dy);
// feOffset is a point operation. Therefore, to take the
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeSpecularLightingElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeSpecularLightingElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeSpecularLightingElementBridge.java
index 46bf88f..fc5686d 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeSpecularLightingElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeSpecularLightingElementBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001-2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -30,7 +31,7 @@ import org.w3c.dom.Element;
* Bridge class for the <feSpecularLighting> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFeSpecularLightingElementBridge.java,v 1.16 2004/08/18 07:12:34 vhardy Exp $
+ * @version $Id: SVGFeSpecularLightingElementBridge.java 501922 2007-01-31 17:47:47Z dvholten $
*/
public class SVGFeSpecularLightingElementBridge
extends AbstractSVGLightingElementBridge {
@@ -76,21 +77,21 @@ public class SVGFeSpecularLightingElementBridge
// 'surfaceScale' attribute - default is 1
- float surfaceScale
- = convertNumber(filterElement, SVG_SURFACE_SCALE_ATTRIBUTE, 1);
+ float surfaceScale = convertNumber(filterElement,
+ SVG_SURFACE_SCALE_ATTRIBUTE, 1, ctx);
// 'specularConstant' attribute - default is 1
- float specularConstant
- = convertNumber(filterElement, SVG_SPECULAR_CONSTANT_ATTRIBUTE, 1);
+ float specularConstant = convertNumber
+ (filterElement, SVG_SPECULAR_CONSTANT_ATTRIBUTE, 1, ctx);
// 'specularExponent' attribute - default is 1
- float specularExponent = convertSpecularExponent(filterElement);
+ float specularExponent = convertSpecularExponent(filterElement, ctx);
// extract the light definition from the filterElement's children list
Light light = extractLight(filterElement, ctx);
// 'kernelUnitLength' attribute
- double [] kernelUnitLength = convertKernelUnitLength(filterElement);
+ double[] kernelUnitLength = convertKernelUnitLength(filterElement, ctx);
// 'in' attribute
Filter in = getIn(filterElement,
@@ -138,8 +139,10 @@ public class SVGFeSpecularLightingElementBridge
* filter primitive element.
*
* @param filterElement the feSpecularLighting filter primitive element
+ * @param ctx the BridgeContext to use for error information
*/
- protected static float convertSpecularExponent(Element filterElement) {
+ protected static float convertSpecularExponent(Element filterElement,
+ BridgeContext ctx) {
String s = filterElement.getAttributeNS
(null, SVG_SPECULAR_EXPONENT_ATTRIBUTE);
if (s.length() == 0) {
@@ -149,14 +152,14 @@ public class SVGFeSpecularLightingElementBridge
float v = SVGUtilities.convertSVGNumber(s);
if (v < 1 || v > 128) {
throw new BridgeException
- (filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ (ctx, filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object[] {SVG_SPECULAR_CONSTANT_ATTRIBUTE, s});
}
return v;
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException nfEx ) {
throw new BridgeException
- (filterElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
- new Object[] {SVG_SPECULAR_CONSTANT_ATTRIBUTE, s, ex});
+ (ctx, filterElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object[] {SVG_SPECULAR_CONSTANT_ATTRIBUTE, s, nfEx });
}
}
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeTileElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeTileElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeTileElementBridge.java
index bae0ee8..fe4f95e 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeTileElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeTileElementBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001-2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -29,7 +30,7 @@ import org.w3c.dom.Element;
* Bridge class for the <feTile> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFeTileElementBridge.java,v 1.13 2004/08/18 07:12:34 vhardy Exp $
+ * @version $Id: SVGFeTileElementBridge.java 475477 2006-11-15 22:44:28Z cam $
*/
public class SVGFeTileElementBridge
extends AbstractSVGFilterPrimitiveElementBridge {
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeTurbulenceElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeTurbulenceElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeTurbulenceElementBridge.java
index cacb7c5..5955852 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeTurbulenceElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFeTurbulenceElementBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001,2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -31,7 +32,7 @@ import org.w3c.dom.Element;
* Bridge class for the <feTurbulence> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFeTurbulenceElementBridge.java,v 1.11 2004/08/18 07:12:34 vhardy Exp $
+ * @version $Id: SVGFeTurbulenceElementBridge.java 501922 2007-01-31 17:47:47Z dvholten $
*/
public class SVGFeTurbulenceElementBridge
extends AbstractSVGFilterPrimitiveElementBridge {
@@ -97,23 +98,23 @@ public class SVGFeTurbulenceElementBridge
// 'baseFrequency' attribute - default is [0, 0]
float [] baseFrequency
- = convertBaseFrenquency(filterElement);
+ = convertBaseFrenquency(filterElement, ctx);
// 'numOctaves' attribute - default is 1
int numOctaves
- = convertInteger(filterElement, SVG_NUM_OCTAVES_ATTRIBUTE, 1);
+ = convertInteger(filterElement, SVG_NUM_OCTAVES_ATTRIBUTE, 1, ctx);
// 'seed' attribute - default is 0
int seed
- = convertInteger(filterElement, SVG_SEED_ATTRIBUTE, 0);
+ = convertInteger(filterElement, SVG_SEED_ATTRIBUTE, 0, ctx);
// 'stitchTiles' attribute - default is 'noStitch'
boolean stitchTiles
- = convertStitchTiles(filterElement);
+ = convertStitchTiles(filterElement, ctx);
// 'fractalNoise' attribute - default is 'turbulence'
boolean isFractalNoise
- = convertType(filterElement);
+ = convertType(filterElement, ctx);
// create the filter primitive
TurbulenceRable turbulenceRable
@@ -140,8 +141,10 @@ public class SVGFeTurbulenceElementBridge
* feTurbulence element.
*
* @param e the feTurbulence element
+ * @param ctx the BridgeContext to use for error information
*/
- protected static float [] convertBaseFrenquency(Element e) {
+ protected static float[] convertBaseFrenquency(Element e,
+ BridgeContext ctx) {
String s = e.getAttributeNS(null, SVG_BASE_FREQUENCY_ATTRIBUTE);
if (s.length() == 0) {
return new float[] {0.001f, 0.001f};
@@ -157,17 +160,17 @@ public class SVGFeTurbulenceElementBridge
}
if (tokens.hasMoreTokens()) {
throw new BridgeException
- (e, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ (ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object[] {SVG_BASE_FREQUENCY_ATTRIBUTE, s});
}
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException nfEx ) {
throw new BridgeException
- (e, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ (ctx, e, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object[] {SVG_BASE_FREQUENCY_ATTRIBUTE, s});
}
if (v[0] < 0 || v[1] < 0) {
throw new BridgeException
- (e, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ (ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object[] {SVG_BASE_FREQUENCY_ATTRIBUTE, s});
}
return v;
@@ -178,9 +181,10 @@ public class SVGFeTurbulenceElementBridge
* feTurbulence element.
*
* @param e the feTurbulence element
+ * @param ctx the BridgeContext to use for error information
* @return true if stitchTiles attribute is 'stitch', false otherwise
*/
- protected static boolean convertStitchTiles(Element e) {
+ protected static boolean convertStitchTiles(Element e, BridgeContext ctx) {
String s = e.getAttributeNS(null, SVG_STITCH_TILES_ATTRIBUTE);
if (s.length() == 0) {
return false;
@@ -191,7 +195,7 @@ public class SVGFeTurbulenceElementBridge
if (SVG_NO_STITCH_VALUE.equals(s)) {
return false;
}
- throw new BridgeException(e, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ throw new BridgeException(ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object[] {SVG_STITCH_TILES_ATTRIBUTE, s});
}
@@ -199,9 +203,10 @@ public class SVGFeTurbulenceElementBridge
* Converts the 'type' attribute of the specified feTurbulence element.
*
* @param e the feTurbulence element
+ * @param ctx the BridgeContext to use for error information
* @return true if type attribute value is 'fractalNoise', false otherwise
*/
- protected static boolean convertType(Element e) {
+ protected static boolean convertType(Element e, BridgeContext ctx) {
String s = e.getAttributeNS(null, SVG_TYPE_ATTRIBUTE);
if (s.length() == 0) {
return false;
@@ -212,7 +217,7 @@ public class SVGFeTurbulenceElementBridge
if (SVG_TURBULENCE_VALUE.equals(s)) {
return false;
}
- throw new BridgeException(e, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ throw new BridgeException(ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object[] {SVG_TYPE_ATTRIBUTE, s});
}
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFilterElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFilterElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFilterElementBridge.java
index 517c73b..6b3bb21 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFilterElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFilterElementBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001-2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -17,11 +18,9 @@
*/
package org.apache.flex.forks.batik.bridge;
+import java.awt.Color;
import java.awt.geom.Rectangle2D;
-import java.net.MalformedURLException;
-import java.net.URL;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -32,8 +31,10 @@ import org.apache.flex.forks.batik.ext.awt.image.PadMode;
import org.apache.flex.forks.batik.ext.awt.image.renderable.Filter;
import org.apache.flex.forks.batik.ext.awt.image.renderable.FilterChainRable;
import org.apache.flex.forks.batik.ext.awt.image.renderable.FilterChainRable8Bit;
+import org.apache.flex.forks.batik.ext.awt.image.renderable.FloodRable8Bit;
import org.apache.flex.forks.batik.ext.awt.image.renderable.PadRable8Bit;
import org.apache.flex.forks.batik.gvt.GraphicsNode;
+import org.apache.flex.forks.batik.util.ParsedURL;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -41,10 +42,15 @@ import org.w3c.dom.Node;
* Bridge class for the <filter> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFilterElementBridge.java,v 1.20 2004/11/18 01:46:53 deweese Exp $
+ * @version $Id: SVGFilterElementBridge.java 579230 2007-09-25 12:52:48Z cam $
*/
-public class SVGFilterElementBridge extends AbstractSVGBridge
- implements FilterBridge, ErrorConstants {
+public class SVGFilterElementBridge extends AnimatableGenericSVGBridge
+ implements FilterBridge, ErrorConstants {
+
+ /**
+ * Transparent black color.
+ */
+ protected static final Color TRANSPARENT_BLACK = new Color(0, true);
/**
* Constructs a new bridge for the <filter> element.
@@ -74,11 +80,14 @@ public class SVGFilterElementBridge extends AbstractSVGBridge
// get filter chain region
Rectangle2D filterRegion = SVGUtilities.convertFilterChainRegion
(filterElement, filteredElement, filteredNode, ctx);
+ if (filterRegion == null) {
+ return null;
+ }
// make the initial source as a RenderableImage
Filter sourceGraphic = filteredNode.getGraphicsNodeRable(true);
// Pad out to filterRegion
- sourceGraphic = new PadRable8Bit(sourceGraphic, filterRegion,
+ sourceGraphic = new PadRable8Bit(sourceGraphic, filterRegion,
PadMode.ZERO_PAD);
// build a FilterChainRable8Bit
@@ -103,12 +112,37 @@ public class SVGFilterElementBridge extends AbstractSVGBridge
sourceGraphic,
filterNodeMap,
ctx);
- if ((in == null) || (in == sourceGraphic)) {
- return null; // no filter primitives found, disable the filter.
- } else {
- filterChain.setSource(in);
- return filterChain;
+ 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;
+ }
+
+ /**
+ * Creates a new returns a new filter that fills its output with
+ * transparent black. This is used when a <filter> element
+ * has no filter primitive children.
+ */
+ protected static Filter createEmptyFilter(Element filterElement,
+ Rectangle2D filterRegion,
+ Element filteredElement,
+ GraphicsNode filteredNode,
+ BridgeContext ctx) {
+ Rectangle2D primitiveRegion
+ = SVGUtilities.convertFilterPrimitiveRegion(null,
+ filterElement,
+ filteredElement,
+ filteredNode,
+ filterRegion,
+ filterRegion,
+ ctx);
+ return new FloodRable8Bit(primitiveRegion, TRANSPARENT_BLACK);
}
/**
@@ -153,17 +187,9 @@ public class SVGFilterElementBridge extends AbstractSVGBridge
}
// check if there is circular dependencies
SVGOMDocument doc = (SVGOMDocument)filterElement.getOwnerDocument();
- URL url;
- try {
- url = new URL(doc.getURLObject(), uri);
- } catch (MalformedURLException ex) {
- throw new BridgeException(filterElement,
- ERR_URI_MALFORMED,
- new Object[] {uri});
-
- }
- if (contains(refs, url)) {
- throw new BridgeException(filterElement,
+ ParsedURL url = new ParsedURL(doc.getURLObject(), uri);
+ if (refs.contains(url)) {
+ throw new BridgeException(ctx, filterElement,
ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES,
new Object[] {uri});
}
@@ -223,21 +249,4 @@ public class SVGFilterElementBridge extends AbstractSVGBridge
}
return in;
}
-
- /**
- * Returns true if the specified list of URLs contains the specified url.
- *
- * @param urls the list of URLs
- * @param key the url to search for
- */
- private static boolean contains(List urls, URL key) {
- Iterator iter = urls.iterator();
- while (iter.hasNext()) {
- URL url = (URL)iter.next();
- if (url.sameFile(key) && url.getRef().equals(key.getRef())) {
- return true;
- }
- }
- return false;
- }
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontElementBridge.java
index a3be6e6..86cdc3a 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontElementBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001,2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -26,7 +27,7 @@ import org.w3c.dom.NodeList;
* Bridge class for the <font> element.
*
* @author <a href="mailto:bella.robinson@cmis.csiro.au">Bella Robinson</a>
- * @version $Id: SVGFontElementBridge.java,v 1.9 2004/08/18 07:12:34 vhardy Exp $
+ * @version $Id: SVGFontElementBridge.java 475685 2006-11-16 11:16:05Z cam $
*/
public class SVGFontElementBridge extends AbstractSVGBridge {
@@ -65,7 +66,7 @@ public class SVGFontElementBridge extends AbstractSVGBridge {
// construct a list of glyph codes that this font can display and
// a list of the glyph elements
NodeList glyphElements = fontElement.getElementsByTagNameNS
- (SVG_NAMESPACE_URI, SVG_GLYPH_TAG);
+ (SVG_NAMESPACE_URI, SVG_GLYPH_TAG);
int numGlyphs = glyphElements.getLength();
String[] glyphCodes = new String[numGlyphs];
String[] glyphNames = new String[numGlyphs];
@@ -92,7 +93,7 @@ public class SVGFontElementBridge extends AbstractSVGBridge {
// get the missing glyph element
NodeList missingGlyphElements = fontElement.getElementsByTagNameNS
- (SVG_NAMESPACE_URI, SVG_MISSING_GLYPH_TAG);
+ (SVG_NAMESPACE_URI, SVG_MISSING_GLYPH_TAG);
Element missingGlyphElement = null;
if (missingGlyphElements.getLength() > 0) {
missingGlyphElement = (Element)missingGlyphElements.item(0);
@@ -100,7 +101,7 @@ public class SVGFontElementBridge extends AbstractSVGBridge {
// get the hkern elements
NodeList hkernElements = fontElement.getElementsByTagNameNS
- (SVG_NAMESPACE_URI, SVG_HKERN_TAG);
+ (SVG_NAMESPACE_URI, SVG_HKERN_TAG);
Element[] hkernElementArray = new Element[hkernElements.getLength()];
for (int i = 0; i < hkernElementArray.length; i++) {
@@ -110,7 +111,7 @@ public class SVGFontElementBridge extends AbstractSVGBridge {
// get the vkern elements
NodeList vkernElements = fontElement.getElementsByTagNameNS
- (SVG_NAMESPACE_URI, SVG_VKERN_TAG);
+ (SVG_NAMESPACE_URI, SVG_VKERN_TAG);
Element[] vkernElementArray = new Element[vkernElements.getLength()];
for (int i = 0; i < vkernElementArray.length; i++) {
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontFace.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontFace.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontFace.java
index 3e2b2f2..798a1e1 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontFace.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontFace.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001,2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -26,7 +27,7 @@ import org.w3c.dom.Element;
* This class represents a <font-face> element or @font-face rule
*
* @author <a href="mailto:bella.robinson@cmis.csiro.au">Bella Robinson</a>
- * @version $Id: SVGFontFace.java,v 1.7 2004/08/18 07:12:34 vhardy Exp $
+ * @version $Id: SVGFontFace.java 475477 2006-11-15 22:44:28Z cam $
*/
public class SVGFontFace extends FontFace {
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontFaceElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontFaceElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontFaceElementBridge.java
index fca93d3..b1ec3c9 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontFaceElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontFaceElementBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001-2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -23,7 +24,7 @@ import java.util.LinkedList;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import org.apache.flex.forks.batik.dom.svg.XMLBaseSupport;
+import org.apache.flex.forks.batik.dom.AbstractNode;
import org.apache.flex.forks.batik.dom.util.XLinkSupport;
import org.apache.flex.forks.batik.util.ParsedURL;
@@ -31,7 +32,7 @@ import org.apache.flex.forks.batik.util.ParsedURL;
* Bridge class for the <font-face> element.
*
* @author <a href="mailto:bella.robinson@cmis.csiro.au">Bella Robinson</a>
- * @version $Id: SVGFontFaceElementBridge.java,v 1.10 2005/02/22 09:12:57 cam Exp $
+ * @version $Id: SVGFontFaceElementBridge.java 502538 2007-02-02 08:52:56Z dvholten $
*/
public class SVGFontFaceElementBridge extends AbstractSVGBridge
implements ErrorConstants {
@@ -75,9 +76,9 @@ public class SVGFontFaceElementBridge extends AbstractSVGBridge
float unitsPerEm;
try {
unitsPerEm = SVGUtilities.convertSVGNumber(unitsPerEmStr);
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException nfEx ) {
throw new BridgeException
- (fontFaceElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object [] {SVG_UNITS_PER_EM_ATTRIBUTE, unitsPerEmStr});
}
@@ -118,9 +119,9 @@ public class SVGFontFaceElementBridge extends AbstractSVGBridge
float slope;
try {
slope = SVGUtilities.convertSVGNumber(slopeStr);
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException nfEx ) {
throw new BridgeException
- (fontFaceElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, slopeStr});
}
@@ -136,15 +137,15 @@ public class SVGFontFaceElementBridge extends AbstractSVGBridge
(null, SVG_ASCENT_ATTRIBUTE);
if (ascentStr.length() == 0) {
// set it to be unitsPerEm * .8
- ascentStr = String.valueOf(unitsPerEm*.8);
+ ascentStr = String.valueOf( unitsPerEm * 0.8);
}
float ascent;
try {
ascent = SVGUtilities.convertSVGNumber(ascentStr);
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException nfEx ) {
throw new BridgeException
- (fontFaceElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
- new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, ascentStr});
+ (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, ascentStr});
}
// descent
@@ -152,15 +153,15 @@ public class SVGFontFaceElementBridge extends AbstractSVGBridge
(null, SVG_DESCENT_ATTRIBUTE);
if (descentStr.length() == 0) {
// set it to be unitsPerEm *.2.
- descentStr = String.valueOf(unitsPerEm*.2);
+ descentStr = String.valueOf(unitsPerEm*0.2);
}
float descent;
try {
descent = SVGUtilities.convertSVGNumber(descentStr);
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException nfEx ) {
throw new BridgeException
- (fontFaceElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
- new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, descentStr});
+ (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE, descentStr });
}
// underline-position
@@ -172,9 +173,9 @@ public class SVGFontFaceElementBridge extends AbstractSVGBridge
float underlinePos;
try {
underlinePos = SVGUtilities.convertSVGNumber(underlinePosStr);
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException nfEx ) {
throw new BridgeException
- (fontFaceElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE,
underlinePosStr});
}
@@ -190,9 +191,9 @@ public class SVGFontFaceElementBridge extends AbstractSVGBridge
try {
underlineThickness =
SVGUtilities.convertSVGNumber(underlineThicknessStr);
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException nfEx ) {
throw new BridgeException
- (fontFaceElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE,
underlineThicknessStr});
}
@@ -208,9 +209,9 @@ public class SVGFontFaceElementBridge extends AbstractSVGBridge
try {
strikethroughPos =
SVGUtilities.convertSVGNumber(strikethroughPosStr);
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException nfEx ) {
throw new BridgeException
- (fontFaceElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE,
strikethroughPosStr});
}
@@ -226,9 +227,9 @@ public class SVGFontFaceElementBridge extends AbstractSVGBridge
try {
strikethroughThickness =
SVGUtilities.convertSVGNumber(strikethroughThicknessStr);
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException nfEx ) {
throw new BridgeException
- (fontFaceElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE,
strikethroughThicknessStr});
}
@@ -242,9 +243,9 @@ public class SVGFontFaceElementBridge extends AbstractSVGBridge
float overlinePos;
try {
overlinePos = SVGUtilities.convertSVGNumber(overlinePosStr);
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException nfEx ) {
throw new BridgeException
- (fontFaceElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE,
overlinePosStr});
}
@@ -260,9 +261,9 @@ public class SVGFontFaceElementBridge extends AbstractSVGBridge
try {
overlineThickness =
SVGUtilities.convertSVGNumber(overlineThicknessStr);
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException nfEx ) {
throw new BridgeException
- (fontFaceElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ (ctx, fontFaceElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object [] {SVG_FONT_FACE_SLOPE_DEFAULT_VALUE,
overlineThicknessStr});
}
@@ -284,7 +285,9 @@ public class SVGFontFaceElementBridge extends AbstractSVGBridge
overlineThickness);
}
-
+ /**
+ * the returned list may contain Strings and ParsedURLs
+ */
public List getFontFaceSrcs(Element fontFaceElement) {
// Search for a font-face-src element
Element ffsrc = null;
@@ -314,18 +317,18 @@ public class SVGFontFaceElementBridge extends AbstractSVGBridge
if (n.getLocalName().equals(SVG_FONT_FACE_URI_TAG)) {
Element ffuri = (Element)n;
String uri = XLinkSupport.getXLinkHref(ffuri);
- String base = XMLBaseSupport.getCascadedXMLBase(ffuri);
+ String base = AbstractNode.getBaseURI(ffuri);
ParsedURL purl;
if (base != null) purl = new ParsedURL(base, uri);
else purl = new ParsedURL(uri);
- ret.add(purl);
+ ret.add(purl); // here we add a ParsedURL
continue;
}
if (n.getLocalName().equals(SVG_FONT_FACE_NAME_TAG)) {
Element ffname = (Element)n;
String s = ffname.getAttribute("name");
if (s.length() != 0)
- ret.add(s);
+ ret.add(s); // here we add a String
}
}
return ret;
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontFamily.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontFamily.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontFamily.java
index 3d618ec..c304b30 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontFamily.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontFamily.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001,2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -17,6 +18,7 @@
*/
package org.apache.flex.forks.batik.bridge;
+import java.lang.ref.SoftReference;
import java.text.AttributedCharacterIterator;
import java.util.Map;
@@ -34,19 +36,19 @@ import org.w3c.dom.NodeList;
* A font family class for SVG fonts.
*
* @author <a href="mailto:bella.robinson@cmis.csiro.au">Bella Robinson</a>
- * @version $Id: SVGFontFamily.java,v 1.9 2004/11/18 01:46:53 deweese Exp $
+ * @version $Id: SVGFontFamily.java 489226 2006-12-21 00:05:36Z cam $
*/
public class SVGFontFamily implements GVTFontFamily {
- public static final
- AttributedCharacterIterator.Attribute TEXT_COMPOUND_DELIMITER =
- GVTAttributedCharacterIterator.TextAttribute.TEXT_COMPOUND_DELIMITER;
+ public static final
+ AttributedCharacterIterator.Attribute TEXT_COMPOUND_ID =
+ GVTAttributedCharacterIterator.TextAttribute.TEXT_COMPOUND_ID;
protected GVTFontFace fontFace;
protected Element fontElement;
protected BridgeContext ctx;
protected Boolean complex = null;
-
+
/**
@@ -104,12 +106,12 @@ public class SVGFontFamily implements GVTFontFamily {
public GVTFont deriveFont(float size, Map attrs) {
SVGFontElementBridge fontBridge;
fontBridge = (SVGFontElementBridge)ctx.getBridge(fontElement);
- Element textElement;
- textElement = (Element)attrs.get(TEXT_COMPOUND_DELIMITER);
- return fontBridge.createFont(ctx, fontElement, textElement,
+ SoftReference sr = (SoftReference)attrs.get(TEXT_COMPOUND_ID);
+ Element textElement = (Element)sr.get();
+ return fontBridge.createFont(ctx, fontElement, textElement,
size, fontFace);
}
-
+
/**
* This method looks at the SVG font and checks if any of
* the glyphs use renderable child elements. If so this
@@ -120,13 +122,13 @@ public class SVGFontFamily implements GVTFontFamily {
public boolean isComplex() {
if (complex != null) return complex.booleanValue();
boolean ret = isComplex(fontElement, ctx);
- complex = new Boolean(ret);
+ complex = ret ? Boolean.TRUE : Boolean.FALSE;
return ret;
}
public static boolean isComplex(Element fontElement, BridgeContext ctx) {
NodeList glyphElements = fontElement.getElementsByTagNameNS
- (SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_GLYPH_TAG);
+ (SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_GLYPH_TAG);
int numGlyphs = glyphElements.getLength();
for (int i = 0; i < numGlyphs; i++) {
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontUtilities.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontUtilities.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontUtilities.java
index 19dcd92..4009e35 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontUtilities.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGFontUtilities.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001-2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -41,7 +42,7 @@ import org.w3c.dom.NodeList;
* Utility class for SVG fonts.
*
* @author <a href="mailto:bella.robinson@cmis.csiro.au">Bella Robinson</a>
- * @version $Id: SVGFontUtilities.java,v 1.17 2004/08/18 07:12:34 vhardy Exp $
+ * @version $Id: SVGFontUtilities.java 501844 2007-01-31 13:54:05Z dvholten $
*/
public abstract class SVGFontUtilities implements SVGConstants {
@@ -51,13 +52,13 @@ public abstract class SVGFontUtilities implements SVGConstants {
// FontFamily that matches
Map fontFamilyMap = ctx.getFontFamilyMap();
List ret = (List)fontFamilyMap.get(doc);
- if (ret != null)
+ if (ret != null)
return ret;
ret = new LinkedList();
NodeList fontFaceElements = doc.getElementsByTagNameNS
- (SVG_NAMESPACE_URI, SVG_FONT_FACE_TAG);
+ (SVG_NAMESPACE_URI, SVG_FONT_FACE_TAG);
SVGFontFaceElementBridge fontFaceBridge;
fontFaceBridge = (SVGFontFaceElementBridge)ctx.getBridge
@@ -78,7 +79,7 @@ public abstract class SVGFontUtilities implements SVGConstants {
}
return ret;
}
-
+
/**
* Given a font family name tries to find a matching SVG font
@@ -106,7 +107,7 @@ public abstract class SVGFontUtilities implements SVGConstants {
String fontStyle) {
// TODO: should match against font-variant as well
- String fontKeyName = fontFamilyName.toLowerCase() + " " +
+ String fontKeyName = fontFamilyName.toLowerCase() + " " + // todo locale??
fontWeight + " " + fontStyle;
// check fontFamilyMap to see if we have already created an
@@ -122,13 +123,13 @@ public abstract class SVGFontUtilities implements SVGConstants {
Document doc = textElement.getOwnerDocument();
List fontFaces = (List)fontFamilyMap.get(doc);
-
+
if (fontFaces == null) {
fontFaces = getFontFaces(doc, ctx);
fontFamilyMap.put(doc, fontFaces);
}
-
+
Iterator iter = fontFaces.iterator();
List svgFontFamilies = new LinkedList();
while (iter.hasNext()) {
@@ -142,7 +143,7 @@ public abstract class SVGFontUtilities implements SVGConstants {
if (fontFaceStyle.equals(SVG_ALL_VALUE) ||
fontFaceStyle.indexOf(fontStyle) != -1) {
GVTFontFamily ffam = fontFace.getFontFamily(ctx);
- if (ffam != null)
+ if (ffam != null)
svgFontFamilies.add(ffam);
}
}
@@ -151,7 +152,7 @@ public abstract class SVGFontUtilities implements SVGConstants {
// only found one matching svg font family
fontFamilyMap.put(fontKeyName, svgFontFamilies.get(0));
return (GVTFontFamily)svgFontFamilies.get(0);
-
+
} else if (svgFontFamilies.size() > 1) {
// need to find font face that matches the font-weight closest
String fontWeightNumber = getFontWeightNumberString(fontWeight);
@@ -198,7 +199,7 @@ public abstract class SVGFontUtilities implements SVGConstants {
String newFontFamilyWeight =
newFontFamilyWeights.get(minDifferenceIndex) +
", " + weightString;
- newFontFamilyWeights.set(minDifferenceIndex,
+ newFontFamilyWeights.set(minDifferenceIndex,
newFontFamilyWeight);
}
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGGElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGGElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGGElementBridge.java
index 06e19ee..0e1910d 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGGElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGGElementBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001-2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -30,7 +31,7 @@ import org.w3c.dom.events.MutationEvent;
* Bridge class for the <g> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGGElementBridge.java,v 1.26 2004/08/20 19:29:46 deweese Exp $
+ * @version $Id: SVGGElementBridge.java 491178 2006-12-30 06:18:34Z cam $
*/
public class SVGGElementBridge extends AbstractGraphicsNodeBridge {
@@ -63,8 +64,10 @@ public class SVGGElementBridge extends AbstractGraphicsNodeBridge {
public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) {
CompositeGraphicsNode gn =
(CompositeGraphicsNode)super.createGraphicsNode(ctx, e);
- if (gn == null)
- return null;
+ if (gn == null)
+ return null;
+
+ associateSVGContext(ctx, e, gn);
// 'color-rendering'
RenderingHints hints = null;
@@ -100,19 +103,21 @@ public class SVGGElementBridge extends AbstractGraphicsNodeBridge {
* Invoked when an MutationEvent of type 'DOMNodeInserted' is fired.
*/
public void handleDOMNodeInsertedEvent(MutationEvent evt) {
- if ( evt.getTarget() instanceof Element ){
+ if (evt.getTarget() instanceof Element) {
handleElementAdded((CompositeGraphicsNode)node,
e,
(Element)evt.getTarget());
+ } else {
+ super.handleDOMNodeInsertedEvent(evt);
}
}
/**
* Invoked when an MutationEvent of type 'DOMNodeInserted' is fired.
*/
- public void handleElementAdded(CompositeGraphicsNode gn,
- Node parent,
- Element childElt) {
+ protected void handleElementAdded(CompositeGraphicsNode gn,
+ Node parent,
+ Element childElt) {
// build the graphics node
GVTBuilder builder = ctx.getGVTBuilder();
GraphicsNode childNode = builder.build(ctx, childElt);
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGGVTFont.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGGVTFont.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGGVTFont.java
index 49cbf33..4b8d31e 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGGVTFont.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGGVTFont.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001-2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -18,15 +19,13 @@
package org.apache.flex.forks.batik.bridge;
import java.awt.Font;
-import java.awt.Paint;
-import java.awt.Stroke;
import java.awt.font.FontRenderContext;
-import java.awt.font.TextAttribute;
import java.text.AttributedCharacterIterator;
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
import java.util.StringTokenizer;
-import java.util.Vector;
+import java.util.List;
+import java.util.ArrayList;
import org.apache.flex.forks.batik.css.engine.SVGCSSEngine;
import org.apache.flex.forks.batik.css.engine.value.Value;
@@ -42,13 +41,14 @@ import org.apache.flex.forks.batik.gvt.font.SVGGVTGlyphVector;
import org.apache.flex.forks.batik.gvt.text.GVTAttributedCharacterIterator;
import org.apache.flex.forks.batik.gvt.text.TextPaintInfo;
import org.apache.flex.forks.batik.util.SVGConstants;
+
import org.w3c.dom.Element;
/**
* Represents an SVG font.
*
* @author <a href="mailto:bella.robinson@cmis.csiro.au">Bella Robinson</a>
- * @version $Id: SVGGVTFont.java,v 1.19 2005/03/27 08:58:30 cam Exp $
+ * @version $Id: SVGGVTFont.java 489226 2006-12-21 00:05:36Z cam $
*/
public final class SVGGVTFont implements GVTFont, SVGConstants {
@@ -185,7 +185,7 @@ public final class SVGGVTFont implements GVTFont, SVGConstants {
}
float ret;
ret = hKerningTable.getKerningValue(glyphCode1, glyphCode2,
- glyphUnicodes[glyphCode1],
+ glyphUnicodes[glyphCode1],
glyphUnicodes[glyphCode2]);
return ret*scale;
}
@@ -207,7 +207,7 @@ public final class SVGGVTFont implements GVTFont, SVGConstants {
}
float ret;
ret = vKerningTable.getKerningValue(glyphCode1, glyphCode2,
- glyphUnicodes[glyphCode1],
+ glyphUnicodes[glyphCode1],
glyphUnicodes[glyphCode2]);
return ret*scale;
}
@@ -221,7 +221,7 @@ public final class SVGGVTFont implements GVTFont, SVGConstants {
* @return An array of matching glyph codes. This may be empty.
*/
public int[] getGlyphCodesForName(String name) {
- Vector glyphCodes = new Vector();
+ List glyphCodes = new ArrayList();
for (int i = 0; i < glyphNames.length; i++) {
if (glyphNames[i] != null && glyphNames[i].equals(name)) {
glyphCodes.add(new Integer(i));
@@ -229,7 +229,7 @@ public final class SVGGVTFont implements GVTFont, SVGConstants {
}
int[] glyphCodeArray = new int[glyphCodes.size()];
for (int i = 0; i < glyphCodes.size(); i++) {
- glyphCodeArray[i] = ((Integer)glyphCodes.elementAt(i)).intValue();
+ glyphCodeArray[i] = ((Integer)glyphCodes.get(i)).intValue();
}
return glyphCodeArray;
}
@@ -243,7 +243,7 @@ public final class SVGGVTFont implements GVTFont, SVGConstants {
* @return An array of matching glyph codes. This may be empty.
*/
public int[] getGlyphCodesForUnicode(String unicode) {
- Vector glyphCodes = new Vector();
+ List glyphCodes = new ArrayList();
for (int i = 0; i < glyphUnicodes.length; i++) {
if (glyphUnicodes[i] != null && glyphUnicodes[i].equals(unicode)) {
glyphCodes.add(new Integer(i));
@@ -251,7 +251,7 @@ public final class SVGGVTFont implements GVTFont, SVGConstants {
}
int[] glyphCodeArray = new int[glyphCodes.size()];
for (int i = 0; i < glyphCodes.size(); i++) {
- glyphCodeArray[i] = ((Integer)glyphCodes.elementAt(i)).intValue();
+ glyphCodeArray[i] = ((Integer)glyphCodes.get(i)).intValue();
}
return glyphCodeArray;
}
@@ -489,8 +489,8 @@ public final class SVGGVTFont implements GVTFont, SVGConstants {
if (glyphUnicodes[i].indexOf(c) == 0
&& languageMatches(glyphLangs[i])
&& orientationMatches(glyphOrientations[i])
- && formMatches(glyphUnicodes[i], glyphForms[i],
- aci, currentIndex)) {
+ && formMatches(glyphUnicodes[i], glyphForms[i],
+ aci, currentIndex)) {
// found a possible match
if (glyphUnicodes[i].length() == 1) { // not a ligature
@@ -576,7 +576,7 @@ public final class SVGGVTFont implements GVTFont, SVGConstants {
aci = (AttributedCharacterIterator)ci;
}
- Vector glyphs = new Vector();
+ List glyphs = new ArrayList();
char c = ci.first();
while (c != CharacterIterator.DONE) {
boolean foundMatchingGlyph = false;
@@ -596,7 +596,7 @@ public final class SVGGVTFont implements GVTFont, SVGConstants {
tpi = (TextPaintInfo)aci.getAttribute(PAINT_INFO);
}
Glyph glyph = glyphBridge.createGlyph
- (ctx, glyphElement, textElement, i,
+ (ctx, glyphElement, textElement, i,
fontSize, fontFace, tpi);
glyphs.add(glyph);
foundMatchingGlyph = true;
@@ -650,7 +650,7 @@ public final class SVGGVTFont implements GVTFont, SVGConstants {
tpi = (TextPaintInfo)aci.getAttribute(PAINT_INFO);
}
Glyph glyph = glyphBridge.createGlyph
- (ctx, missingGlyphElement, textElement, -1,
+ (ctx, missingGlyphElement, textElement, -1,
fontSize, fontFace, tpi);
glyphs.add(glyph);
}
@@ -659,10 +659,9 @@ public final class SVGGVTFont implements GVTFont, SVGConstants {
// turn the vector of glyphs into an array;
int numGlyphs = glyphs.size();
- Glyph[] glyphArray = new Glyph[numGlyphs];
- for (int i =0; i < numGlyphs; i++) {
- glyphArray[i] = (Glyph)glyphs.get(i);
- }
+
+ Glyph[] glyphArray = (Glyph[])glyphs.toArray( new Glyph[numGlyphs] );
+
// return a new SVGGVTGlyphVector
return new SVGGVTGlyphVector(this, glyphArray, frc);
}
@@ -680,12 +679,13 @@ public final class SVGGVTFont implements GVTFont, SVGConstants {
public GVTGlyphVector createGlyphVector(FontRenderContext frc,
int[] glyphCodes,
CharacterIterator ci) {
- // costruct a string from the glyphCodes
- String str = "";
- for (int i = 0; i < glyphCodes.length; i++) {
- str += glyphUnicodes[glyphCodes[i]];
+ // construct a string from the glyphCodes
+ int nGlyphs = glyphCodes.length;
+ StringBuffer workBuff = new StringBuffer( nGlyphs );
+ for (int i = 0; i < nGlyphs; i++) {
+ workBuff.append( glyphUnicodes[glyphCodes[i]] );
}
- StringCharacterIterator sci = new StringCharacterIterator(str);
+ StringCharacterIterator sci = new StringCharacterIterator( workBuff.toString() );
return createGlyphVector(frc, sci);
}
@@ -718,8 +718,12 @@ public final class SVGGVTFont implements GVTFont, SVGConstants {
hkernElements, vkernElements, textElement);
}
+ public String getFamilyName() {
+ return fontFace.getFamilyName();
+ }
+
protected GVTLineMetrics getLineMetrics(int beginIndex, int limit) {
- if (lineMetrics != null)
+ if (lineMetrics != null)
return lineMetrics;
float fontHeight = fontFace.getUnitsPerEm();
@@ -742,10 +746,10 @@ public final class SVGGVTFont implements GVTFont, SVGConstants {
lineMetrics = new GVTLineMetrics
- (ascent, Font.ROMAN_BASELINE, baselineOffsets, descent,
- fontHeight, fontHeight, limit-beginIndex,
- stOffset, stThickness,
- ulOffset, ulThickness,
+ (ascent, Font.ROMAN_BASELINE, baselineOffsets, descent,
+ fontHeight, fontHeight, limit-beginIndex,
+ stOffset, stThickness,
+ ulOffset, ulThickness,
olOffset, olThickness);
return lineMetrics;
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGGlyphElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGGlyphElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGGlyphElementBridge.java
index 1e246f4..112094b 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGGlyphElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGGlyphElementBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001,2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -17,22 +18,22 @@
*/
package org.apache.flex.forks.batik.bridge;
-import java.awt.Paint;
import java.awt.Shape;
-import java.awt.Stroke;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.util.StringTokenizer;
-import java.util.Vector;
+import java.util.List;
+import java.util.ArrayList;
import org.apache.flex.forks.batik.gvt.CompositeGraphicsNode;
import org.apache.flex.forks.batik.gvt.GraphicsNode;
-import org.apache.flex.forks.batik.gvt.font.Glyph;
import org.apache.flex.forks.batik.gvt.font.GVTFontFace;
+import org.apache.flex.forks.batik.gvt.font.Glyph;
import org.apache.flex.forks.batik.gvt.text.TextPaintInfo;
import org.apache.flex.forks.batik.parser.AWTPathProducer;
import org.apache.flex.forks.batik.parser.ParseException;
import org.apache.flex.forks.batik.parser.PathParser;
+
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
@@ -43,7 +44,7 @@ import org.w3c.dom.NodeList;
* Bridge class for the <glyph> element.
*
* @author <a href="mailto:bella.robinson@cmis.csiro.au">Bella Robinson</a>
- * @version $Id: SVGGlyphElementBridge.java,v 1.14 2004/09/06 00:01:58 deweese Exp $
+ * @version $Id: SVGGlyphElementBridge.java 501922 2007-01-31 17:47:47Z dvholten $
*/
public class SVGGlyphElementBridge extends AbstractSVGBridge
implements ErrorConstants {
@@ -81,8 +82,6 @@ public class SVGGlyphElementBridge extends AbstractSVGBridge
GVTFontFace fontFace,
TextPaintInfo tpi) {
-
-
float fontHeight = fontFace.getUnitsPerEm();
float scale = fontSize/fontHeight;
AffineTransform scaleTransform
@@ -99,9 +98,9 @@ public class SVGGlyphElementBridge extends AbstractSVGBridge
PathParser pathParser = new PathParser();
pathParser.setPathHandler(app);
pathParser.parse(d);
- } catch (ParseException ex) {
- throw new BridgeException(glyphElement,
- ERR_ATTRIBUTE_VALUE_MALFORMED,
+ } catch (ParseException pEx) {
+ throw new BridgeException(ctx, glyphElement,
+ pEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object [] {SVG_D_ATTRIBUTE});
} finally {
// transform the shape into the correct coord system
@@ -185,7 +184,7 @@ public class SVGGlyphElementBridge extends AbstractSVGBridge
// glyph-name
String nameList
= glyphElement.getAttributeNS(null, SVG_GLYPH_NAME_ATTRIBUTE);
- Vector names = new Vector();
+ List names = new ArrayList();
StringTokenizer st = new StringTokenizer(nameList, " ,");
while (st.hasMoreTokens()) {
names.add(st.nextToken());
@@ -212,17 +211,18 @@ public class SVGGlyphElementBridge extends AbstractSVGBridge
s = parentFontElement.getAttributeNS(null, SVG_HORIZ_ADV_X_ATTRIBUTE);
if (s.length() == 0) {
// throw an exception since this attribute is required on the font element
- throw new BridgeException (parentFontElement, ERR_ATTRIBUTE_MISSING,
- new Object[] {SVG_HORIZ_ADV_X_ATTRIBUTE});
+ throw new BridgeException
+ (ctx, parentFontElement, ERR_ATTRIBUTE_MISSING,
+ new Object[] {SVG_HORIZ_ADV_X_ATTRIBUTE});
}
}
float horizAdvX;
try {
horizAdvX = SVGUtilities.convertSVGNumber(s) * scale;
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException nfEx ) {
throw new BridgeException
- (glyphElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
- new Object [] {SVG_HORIZ_ADV_X_ATTRIBUTE, s});
+ (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object [] {SVG_HORIZ_ADV_X_ATTRIBUTE, s});
}
// vert-adv-y
@@ -238,10 +238,10 @@ public class SVGGlyphElementBridge extends AbstractSVGBridge
float vertAdvY;
try {
vertAdvY = SVGUtilities.convertSVGNumber(s) * scale;
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException nfEx ) {
throw new BridgeException
- (glyphElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
- new Object [] {SVG_VERT_ADV_Y_ATTRIBUTE, s});
+ (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object [] {SVG_VERT_ADV_Y_ATTRIBUTE, s});
}
// vert-origin-x
@@ -257,10 +257,10 @@ public class SVGGlyphElementBridge extends AbstractSVGBridge
float vertOriginX;
try {
vertOriginX = SVGUtilities.convertSVGNumber(s) * scale;
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException nfEx ) {
throw new BridgeException
- (glyphElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
- new Object [] {SVG_VERT_ORIGIN_X_ATTRIBUTE, s});
+ (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object [] {SVG_VERT_ORIGIN_X_ATTRIBUTE, s});
}
// vert-origin-y
@@ -276,10 +276,10 @@ public class SVGGlyphElementBridge extends AbstractSVGBridge
float vertOriginY;
try {
vertOriginY = SVGUtilities.convertSVGNumber(s) * -scale;
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException nfEx ) {
throw new BridgeException
- (glyphElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
- new Object [] {SVG_VERT_ORIGIN_Y_ATTRIBUTE, s});
+ (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object [] {SVG_VERT_ORIGIN_Y_ATTRIBUTE, s});
}
Point2D vertOrigin = new Point2D.Float(vertOriginX, vertOriginY);
@@ -296,10 +296,10 @@ public class SVGGlyphElementBridge extends AbstractSVGBridge
float horizOriginX;
try {
horizOriginX = SVGUtilities.convertSVGNumber(s) * scale;
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException nfEx ) {
throw new BridgeException
- (parentFontElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
- new Object [] {SVG_HORIZ_ORIGIN_X_ATTRIBUTE, s});
+ (ctx, parentFontElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object [] {SVG_HORIZ_ORIGIN_X_ATTRIBUTE, s});
}
// horiz-origin-y
@@ -311,10 +311,10 @@ public class SVGGlyphElementBridge extends AbstractSVGBridge
float horizOriginY;
try {
horizOriginY = SVGUtilities.convertSVGNumber(s) * -scale;
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException nfEx ) {
throw new BridgeException
- (glyphElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
- new Object [] {SVG_HORIZ_ORIGIN_Y_ATTRIBUTE, s});
+ (ctx, glyphElement, nfEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object [] {SVG_HORIZ_ORIGIN_Y_ATTRIBUTE, s});
}
Point2D horizOrigin = new Point2D.Float(horizOriginX, horizOriginY);
@@ -322,7 +322,7 @@ public class SVGGlyphElementBridge extends AbstractSVGBridge
// return a new Glyph
return new Glyph(unicode, names, orientation,
arabicForm, lang, horizOrigin, vertOrigin,
- horizAdvX, vertAdvY, glyphCode,
+ horizAdvX, vertAdvY, glyphCode,
tpi, dShape, glyphContentNode);
}
}