You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by de...@apache.org on 2002/03/19 16:19:26 UTC
cvs commit: xml-batik/sources/org/apache/batik/bridge SVGFeBlendElementBridge.java SVGFeColorMatrixElementBridge.java SVGFeComponentTransferElementBridge.java SVGFeCompositeElementBridge.java SVGFeConvolveMatrixElementBridge.java SVGFeDiffuseLightingElementBridge.java SVGFeDisplacementMapElementBridge.java SVGFeGaussianBlurElementBridge.java SVGFeMergeElementBridge.java SVGFeMorphologyElementBridge.java SVGFeOffsetElementBridge.java SVGFeSpecularLightingElementBridge.java SVGFeTileElementBridge.java SVGFilterElementBridge.java
deweese 02/03/19 07:19:26
Modified: samples/tests/spec/filters feTile.svg
sources/org/apache/batik/bridge SVGFeBlendElementBridge.java
SVGFeColorMatrixElementBridge.java
SVGFeComponentTransferElementBridge.java
SVGFeCompositeElementBridge.java
SVGFeConvolveMatrixElementBridge.java
SVGFeDiffuseLightingElementBridge.java
SVGFeDisplacementMapElementBridge.java
SVGFeGaussianBlurElementBridge.java
SVGFeMergeElementBridge.java
SVGFeMorphologyElementBridge.java
SVGFeOffsetElementBridge.java
SVGFeSpecularLightingElementBridge.java
SVGFeTileElementBridge.java
SVGFilterElementBridge.java
Log:
1) Cleaned up filterPrimitiveRegions for filters.
Fixes feMorphology clipping bug (and a number of others that people
hadn't noticed yet).
2) Fixed a bug in feTile test (off by one pixel in last test case)
3) Fixed a bug in feTile test (needs input filter primitive region
set to object bounding box not filter region).
Revision Changes Path
1.3 +5 -2 xml-batik/samples/tests/spec/filters/feTile.svg
Index: feTile.svg
===================================================================
RCS file: /home/cvs/xml-batik/samples/tests/spec/filters/feTile.svg,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- feTile.svg 20 Nov 2001 15:08:24 -0000 1.2
+++ feTile.svg 19 Mar 2002 15:19:25 -0000 1.3
@@ -14,7 +14,7 @@
<!-- feTile test -->
<!-- -->
<!-- @author vincent.hardy@eng.sun.com -->
-<!-- @version $Id: feTile.svg,v 1.2 2001/11/20 15:08:24 hillion Exp $ -->
+<!-- @version $Id: feTile.svg,v 1.3 2002/03/19 15:19:25 deweese Exp $ -->
<!-- ========================================================================= -->
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
@@ -44,6 +44,7 @@
<filter id="tile_1" primitiveUnits="objectBoundingBox"
filterUnits="objectBoundingBox"
x="0" y="0" width="200%" height="200%">
+ <feOffset x="0%" y="0%" width="100%" height="100%"/>
<feTile />
</filter>
@@ -53,6 +54,7 @@
<filter id="tile_2" primitiveUnits="objectBoundingBox"
filterUnits="objectBoundingBox"
x="-50%" y="-50%" width="200%" height="200%">
+ <feOffset x="0%" y="0%" width="100%" height="100%"/>
<feTile />
</filter>
@@ -62,6 +64,7 @@
<filter id="tile_3" primitiveUnits="objectBoundingBox"
filterUnits="objectBoundingBox"
x="-25%" y="-25%" width="200%" height="200%">
+ <feOffset x="0%" y="0%" width="100%" height="100%"/>
<feTile />
</filter>
@@ -111,7 +114,7 @@
<g transform="translate(257.5, 307.25) translate(-12.5, 0) skewY(15) translate(12.5, 0)">
<rect x="0" y="0" width="50" height="25" style="fill:url(#tileFill); filter:url(#tile_3)"/>
- <rect x="-12.5" y="-7.25" width="100" height="50" style="fill:none; stroke:black;"/>
+ <rect x="-12.5" y="-6.25" width="100" height="50" style="fill:none; stroke:black;"/>
</g>
<g transform="translate(257.5, 307.25) ">
<text x="37.5" y="-22.25">tile_3 (top left offset)</text>
1.12 +3 -11 xml-batik/sources/org/apache/batik/bridge/SVGFeBlendElementBridge.java
Index: SVGFeBlendElementBridge.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGFeBlendElementBridge.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- SVGFeBlendElementBridge.java 24 Jul 2001 16:00:37 -0000 1.11
+++ SVGFeBlendElementBridge.java 19 Mar 2002 15:19:25 -0000 1.12
@@ -28,7 +28,7 @@
* Bridge class for the <feBlend> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFeBlendElementBridge.java,v 1.11 2001/07/24 16:00:37 deweese Exp $
+ * @version $Id: SVGFeBlendElementBridge.java,v 1.12 2002/03/19 15:19:25 deweese Exp $
*/
public class SVGFeBlendElementBridge
extends AbstractSVGFilterPrimitiveElementBridge {
@@ -98,17 +98,9 @@
return null; // disable the filter
}
- // The default region is the union of the input sources
- // regions unless 'in' is 'SourceGraphic' in which case the
- // default region is the filterChain's region
- Filter sourceGraphics = (Filter)filterMap.get(SVG_SOURCE_GRAPHIC_VALUE);
Rectangle2D defaultRegion;
- if (in == sourceGraphics) {
- defaultRegion = filterRegion;
- } else {
- defaultRegion = in.getBounds2D();
- defaultRegion.add(in2.getBounds2D());
- }
+ defaultRegion = (Rectangle2D)in.getBounds2D().clone();
+ defaultRegion.add(in2.getBounds2D());
// get filter primitive chain region
Rectangle2D primitiveRegion
1.11 +5 -12 xml-batik/sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java
Index: SVGFeColorMatrixElementBridge.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGFeColorMatrixElementBridge.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- SVGFeColorMatrixElementBridge.java 24 Jul 2001 16:00:37 -0000 1.10
+++ SVGFeColorMatrixElementBridge.java 19 Mar 2002 15:19:25 -0000 1.11
@@ -26,7 +26,7 @@
* Bridge class for the <feColorMatrix> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFeColorMatrixElementBridge.java,v 1.10 2001/07/24 16:00:37 deweese Exp $
+ * @version $Id: SVGFeColorMatrixElementBridge.java,v 1.11 2002/03/19 15:19:25 deweese Exp $
*/
public class SVGFeColorMatrixElementBridge
extends AbstractSVGFilterPrimitiveElementBridge {
@@ -80,17 +80,10 @@
return null; // disable the filter
}
- // The default region is the union of the input sources
- // regions unless 'in' is 'SourceGraphic' in which case the
- // default region is the filterChain's region
- Filter sourceGraphics = (Filter)filterMap.get(SVG_SOURCE_GRAPHIC_VALUE);
- Rectangle2D defaultRegion;
- if (in == sourceGraphics) {
- defaultRegion = filterRegion;
- } else {
- defaultRegion = in.getBounds2D();
- }
-
+ // Default region is the size of in (if in is SourceGraphic or
+ // SourceAlpha it will already include a pad/crop to the
+ // proper filter region size).
+ Rectangle2D defaultRegion = in.getBounds2D();
Rectangle2D primitiveRegion
= SVGUtilities.convertFilterPrimitiveRegion(filterElement,
filteredElement,
1.12 +5 -12 xml-batik/sources/org/apache/batik/bridge/SVGFeComponentTransferElementBridge.java
Index: SVGFeComponentTransferElementBridge.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGFeComponentTransferElementBridge.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- SVGFeComponentTransferElementBridge.java 11 Feb 2002 16:00:08 -0000 1.11
+++ SVGFeComponentTransferElementBridge.java 19 Mar 2002 15:19:25 -0000 1.12
@@ -28,7 +28,7 @@
* Bridge class for the <feComponentTransfer> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFeComponentTransferElementBridge.java,v 1.11 2002/02/11 16:00:08 tkormann Exp $
+ * @version $Id: SVGFeComponentTransferElementBridge.java,v 1.12 2002/03/19 15:19:25 deweese Exp $
*/
public class SVGFeComponentTransferElementBridge
extends AbstractSVGFilterPrimitiveElementBridge {
@@ -82,17 +82,10 @@
return null; // disable the filter
}
- // The default region is the union of the input sources
- // regions unless 'in' is 'SourceGraphic' in which case the
- // default region is the filterChain's region
- Filter sourceGraphics = (Filter)filterMap.get(SVG_SOURCE_GRAPHIC_VALUE);
- Rectangle2D defaultRegion;
- if (in == sourceGraphics) {
- defaultRegion = filterRegion;
- } else {
- defaultRegion = in.getBounds2D();
- }
-
+ // Default region is the size of in (if in is SourceGraphic or
+ // SourceAlpha it will already include a pad/crop to the
+ // proper filter region size).
+ Rectangle2D defaultRegion = in.getBounds2D();
Rectangle2D primitiveRegion
= SVGUtilities.convertFilterPrimitiveRegion(filterElement,
filteredElement,
1.12 +3 -11 xml-batik/sources/org/apache/batik/bridge/SVGFeCompositeElementBridge.java
Index: SVGFeCompositeElementBridge.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGFeCompositeElementBridge.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- SVGFeCompositeElementBridge.java 24 Jul 2001 16:00:38 -0000 1.11
+++ SVGFeCompositeElementBridge.java 19 Mar 2002 15:19:25 -0000 1.12
@@ -28,7 +28,7 @@
* Bridge class for the <feComposite> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFeCompositeElementBridge.java,v 1.11 2001/07/24 16:00:38 deweese Exp $
+ * @version $Id: SVGFeCompositeElementBridge.java,v 1.12 2002/03/19 15:19:25 deweese Exp $
*/
public class SVGFeCompositeElementBridge
extends AbstractSVGFilterPrimitiveElementBridge {
@@ -97,17 +97,9 @@
return null; // disable the filter
}
- // The default region is the union of the input sources
- // regions unless 'in' is 'SourceGraphic' in which case the
- // default region is the filterChain's region
- Filter sourceGraphics = (Filter)filterMap.get(SVG_SOURCE_GRAPHIC_VALUE);
Rectangle2D defaultRegion;
- if (in == sourceGraphics) {
- defaultRegion = filterRegion;
- } else {
- defaultRegion = in.getBounds2D();
- defaultRegion.add(in2.getBounds2D());
- }
+ defaultRegion = (Rectangle2D)in.getBounds2D().clone();
+ defaultRegion.add(in2.getBounds2D());
// get filter primitive chain region
Rectangle2D primitiveRegion
1.12 +5 -12 xml-batik/sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java
Index: SVGFeConvolveMatrixElementBridge.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGFeConvolveMatrixElementBridge.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- SVGFeConvolveMatrixElementBridge.java 24 Jul 2001 16:00:38 -0000 1.11
+++ SVGFeConvolveMatrixElementBridge.java 19 Mar 2002 15:19:25 -0000 1.12
@@ -29,7 +29,7 @@
* Bridge class for the <feConvolveMatrix> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFeConvolveMatrixElementBridge.java,v 1.11 2001/07/24 16:00:38 deweese Exp $
+ * @version $Id: SVGFeConvolveMatrixElementBridge.java,v 1.12 2002/03/19 15:19:25 deweese Exp $
*/
public class SVGFeConvolveMatrixElementBridge
extends AbstractSVGFilterPrimitiveElementBridge {
@@ -108,17 +108,10 @@
return null; // disable the filter
}
- // The default region is the union of the input sources
- // regions unless 'in' is 'SourceGraphic' in which case the
- // default region is the filterChain's region
- Filter sourceGraphics = (Filter)filterMap.get(SVG_SOURCE_GRAPHIC_VALUE);
- Rectangle2D defaultRegion;
- if (in == sourceGraphics) {
- defaultRegion = filterRegion;
- } else {
- defaultRegion = in.getBounds2D();
- }
-
+ // Default region is the size of in (if in is SourceGraphic or
+ // SourceAlpha it will already include a pad/crop to the
+ // proper filter region size).
+ Rectangle2D defaultRegion = in.getBounds2D();
Rectangle2D primitiveRegion
= SVGUtilities.convertFilterPrimitiveRegion(filterElement,
filteredElement,
1.13 +5 -12 xml-batik/sources/org/apache/batik/bridge/SVGFeDiffuseLightingElementBridge.java
Index: SVGFeDiffuseLightingElementBridge.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGFeDiffuseLightingElementBridge.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- SVGFeDiffuseLightingElementBridge.java 24 Jul 2001 16:00:38 -0000 1.12
+++ SVGFeDiffuseLightingElementBridge.java 19 Mar 2002 15:19:25 -0000 1.13
@@ -22,7 +22,7 @@
* Bridge class for the <feDiffuseLighting> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFeDiffuseLightingElementBridge.java,v 1.12 2001/07/24 16:00:38 deweese Exp $
+ * @version $Id: SVGFeDiffuseLightingElementBridge.java,v 1.13 2002/03/19 15:19:25 deweese Exp $
*/
public class SVGFeDiffuseLightingElementBridge
extends AbstractSVGLightingElementBridge {
@@ -94,17 +94,10 @@
return null; // disable the filter
}
- // The default region is the union of the input sources
- // regions unless 'in' is 'SourceGraphic' in which case the
- // default region is the filterChain's region
- Filter sourceGraphics = (Filter)filterMap.get(SVG_SOURCE_GRAPHIC_VALUE);
- Rectangle2D defaultRegion;
- if (in == sourceGraphics) {
- defaultRegion = filterRegion;
- } else {
- defaultRegion = in.getBounds2D();
- }
-
+ // Default region is the size of in (if in is SourceGraphic or
+ // SourceAlpha it will already include a pad/crop to the
+ // proper filter region size).
+ Rectangle2D defaultRegion = in.getBounds2D();
Rectangle2D primitiveRegion
= SVGUtilities.convertFilterPrimitiveRegion(filterElement,
filteredElement,
1.12 +3 -12 xml-batik/sources/org/apache/batik/bridge/SVGFeDisplacementMapElementBridge.java
Index: SVGFeDisplacementMapElementBridge.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGFeDisplacementMapElementBridge.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- SVGFeDisplacementMapElementBridge.java 24 Jul 2001 16:00:38 -0000 1.11
+++ SVGFeDisplacementMapElementBridge.java 19 Mar 2002 15:19:25 -0000 1.12
@@ -29,7 +29,7 @@
* Bridge class for the <feDisplacementMap> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFeDisplacementMapElementBridge.java,v 1.11 2001/07/24 16:00:38 deweese Exp $
+ * @version $Id: SVGFeDisplacementMapElementBridge.java,v 1.12 2002/03/19 15:19:25 deweese Exp $
*/
public class SVGFeDisplacementMapElementBridge
extends AbstractSVGFilterPrimitiveElementBridge {
@@ -106,18 +106,9 @@
return null; // disable the filter
}
- // The default region is the union of the input sources
- // regions unless 'in' is 'SourceGraphic' in which case the
- // default region is the filterChain's region
- Filter sourceGraphics = (Filter)filterMap.get(SVG_SOURCE_GRAPHIC_VALUE);
Rectangle2D defaultRegion;
- if (in == sourceGraphics) {
- defaultRegion = filterRegion;
- } else {
- defaultRegion = in.getBounds2D();
- defaultRegion.add(in2.getBounds2D());
- }
-
+ defaultRegion = (Rectangle2D)in.getBounds2D().clone();
+ defaultRegion.add(in2.getBounds2D());
// get filter primitive chain region
Rectangle2D primitiveRegion
= SVGUtilities.convertFilterPrimitiveRegion(filterElement,
1.14 +8 -33 xml-batik/sources/org/apache/batik/bridge/SVGFeGaussianBlurElementBridge.java
Index: SVGFeGaussianBlurElementBridge.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGFeGaussianBlurElementBridge.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- SVGFeGaussianBlurElementBridge.java 24 Jul 2001 16:00:38 -0000 1.13
+++ SVGFeGaussianBlurElementBridge.java 19 Mar 2002 15:19:25 -0000 1.14
@@ -27,7 +27,7 @@
* Bridge class for the <feGaussianBlur> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFeGaussianBlurElementBridge.java,v 1.13 2001/07/24 16:00:38 deweese Exp $
+ * @version $Id: SVGFeGaussianBlurElementBridge.java,v 1.14 2002/03/19 15:19:25 deweese Exp $
*/
public class SVGFeGaussianBlurElementBridge
extends AbstractSVGFilterPrimitiveElementBridge {
@@ -88,36 +88,10 @@
return null; // disable the filter
}
- // Therefore, to take the
- // filter primitive region into account, only a pad operation
- // on the input is required.
-
- // The default region is the union of the input sources
- // regions unless 'in' is 'SourceGraphic' in which case the
- // default region is the filterChain's region
- Filter sourceGraphics = (Filter)filterMap.get(SVG_SOURCE_GRAPHIC_VALUE);
-
- // <!> HACK / TEMPORARY FIX. HANDLE SOURCE ALPHA REGION
- // DEFAULT PROPERLY. THIS REQUIRES A MORE GENERIC FIX.
- String inStr = filterElement.getAttributeNS(null, SVG_IN_ATTRIBUTE);
- /////////////////////////////////////////////////////////////////////
-
- Rectangle2D defaultRegion;
- if (in == sourceGraphics) {
- defaultRegion = filterRegion;
- }
-
- // <!> HACK PART TWO / TEMPORARY FIX. HANDLE SOURCE ALPHA REGION
- // DEFAULT PROPERLY. THIS REQUIRES A MORE GENERIC FIX.
- /////////////////////////////////////////////////////////////////////
- else if( SVG_SOURCE_ALPHA_VALUE.equals(inStr) ){
- defaultRegion = filterRegion;
- }
- /////////////////////////////////////////////////////////////////////
- else {
- defaultRegion = in.getBounds2D();
- }
-
+ // Default region is the size of in (if in is SourceGraphic or
+ // SourceAlpha it will already include a pad/crop to the
+ // proper filter region size).
+ Rectangle2D defaultRegion = in.getBounds2D();
Rectangle2D primitiveRegion
= SVGUtilities.convertFilterPrimitiveRegion(filterElement,
filteredElement,
@@ -126,8 +100,9 @@
filterRegion,
ctx);
- PadRable pad
- = new PadRable8Bit(in, primitiveRegion, PadMode.ZERO_PAD);
+ // Take the filter primitive region into account, we need to
+ // pad/crop the input and output.
+ PadRable pad = new PadRable8Bit(in, primitiveRegion, PadMode.ZERO_PAD);
// build filter
Filter blur = new GaussianBlurRable8Bit
1.14 +8 -2 xml-batik/sources/org/apache/batik/bridge/SVGFeMergeElementBridge.java
Index: SVGFeMergeElementBridge.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGFeMergeElementBridge.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- SVGFeMergeElementBridge.java 11 Feb 2002 16:00:08 -0000 1.13
+++ SVGFeMergeElementBridge.java 19 Mar 2002 15:19:25 -0000 1.14
@@ -28,7 +28,7 @@
* Bridge class for the <feMerge> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFeMergeElementBridge.java,v 1.13 2002/02/11 16:00:08 tkormann Exp $
+ * @version $Id: SVGFeMergeElementBridge.java,v 1.14 2002/03/19 15:19:25 deweese Exp $
*/
public class SVGFeMergeElementBridge
extends AbstractSVGFilterPrimitiveElementBridge {
@@ -81,9 +81,15 @@
return null; // <!> FIXME: no subelement found, result unspecified
}
+ if (srcs.size() == 0) {
+ return null; // <!> FIXME: no subelement found, result unspecified
+ }
+
// the default region is the input sources regions union
Iterator iter = srcs.iterator();
- Rectangle2D defaultRegion = ((Filter)iter.next()).getBounds2D();
+ Rectangle2D defaultRegion =
+ (Rectangle2D)((Filter)iter.next()).getBounds2D().clone();
+
while (iter.hasNext()) {
defaultRegion.add(((Filter)iter.next()).getBounds2D());
}
1.12 +7 -16 xml-batik/sources/org/apache/batik/bridge/SVGFeMorphologyElementBridge.java
Index: SVGFeMorphologyElementBridge.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGFeMorphologyElementBridge.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- SVGFeMorphologyElementBridge.java 24 Jul 2001 16:00:38 -0000 1.11
+++ SVGFeMorphologyElementBridge.java 19 Mar 2002 15:19:25 -0000 1.12
@@ -26,7 +26,7 @@
* Bridge class for the <feMorphology> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFeMorphologyElementBridge.java,v 1.11 2001/07/24 16:00:38 deweese Exp $
+ * @version $Id: SVGFeMorphologyElementBridge.java,v 1.12 2002/03/19 15:19:25 deweese Exp $
*/
public class SVGFeMorphologyElementBridge
extends AbstractSVGFilterPrimitiveElementBridge {
@@ -90,21 +90,10 @@
return null; // disable the filter
}
- // feMorphology is a point operation. Therefore, to take the
- // filter primitive region into account, only a pad operation
- // on the input is required.
-
- // The default region is the union of the input sources
- // regions unless 'in' is 'SourceGraphic' in which case the
- // default region is the filterChain's region
- Filter sourceGraphics = (Filter)filterMap.get(SVG_SOURCE_GRAPHIC_VALUE);
- Rectangle2D defaultRegion;
- if (in == sourceGraphics) {
- defaultRegion = filterRegion;
- } else {
- defaultRegion = in.getBounds2D();
- }
-
+ // Default region is the size of in (if in is SourceGraphic or
+ // SourceAlpha it will already include a pad/crop to the
+ // proper filter region size).
+ Rectangle2D defaultRegion = in.getBounds2D();
Rectangle2D primitiveRegion
= SVGUtilities.convertFilterPrimitiveRegion(filterElement,
filteredElement,
@@ -113,6 +102,8 @@
filterRegion,
ctx);
+ // Take the filter primitive region into account, we need to
+ // pad/crop the input and output.
PadRable pad = new PadRable8Bit(in, primitiveRegion, PadMode.ZERO_PAD);
// build tfilter
1.11 +5 -12 xml-batik/sources/org/apache/batik/bridge/SVGFeOffsetElementBridge.java
Index: SVGFeOffsetElementBridge.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGFeOffsetElementBridge.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- SVGFeOffsetElementBridge.java 24 Jul 2001 16:00:38 -0000 1.10
+++ SVGFeOffsetElementBridge.java 19 Mar 2002 15:19:25 -0000 1.11
@@ -25,7 +25,7 @@
* Bridge class for the <feOffset> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFeOffsetElementBridge.java,v 1.10 2001/07/24 16:00:38 deweese Exp $
+ * @version $Id: SVGFeOffsetElementBridge.java,v 1.11 2002/03/19 15:19:25 deweese Exp $
*/
public class SVGFeOffsetElementBridge
extends AbstractSVGFilterPrimitiveElementBridge {
@@ -80,17 +80,10 @@
return null; // disable the filter
}
- // The default region is the union of the input sources
- // regions unless 'in' is 'SourceGraphic' in which case the
- // default region is the filterChain's region
- Filter sourceGraphics = (Filter)filterMap.get(SVG_SOURCE_GRAPHIC_VALUE);
- Rectangle2D defaultRegion;
- if (in == sourceGraphics) {
- defaultRegion = filterRegion;
- } else {
- defaultRegion = in.getBounds2D();
- }
-
+ // Default region is the size of in (if in is SourceGraphic or
+ // SourceAlpha it will already include a pad/crop to the
+ // proper filter region size).
+ Rectangle2D defaultRegion = in.getBounds2D();
Rectangle2D primitiveRegion
= SVGUtilities.convertFilterPrimitiveRegion(filterElement,
filteredElement,
1.13 +5 -12 xml-batik/sources/org/apache/batik/bridge/SVGFeSpecularLightingElementBridge.java
Index: SVGFeSpecularLightingElementBridge.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGFeSpecularLightingElementBridge.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- SVGFeSpecularLightingElementBridge.java 24 Jul 2001 16:00:38 -0000 1.12
+++ SVGFeSpecularLightingElementBridge.java 19 Mar 2002 15:19:25 -0000 1.13
@@ -23,7 +23,7 @@
* Bridge class for the <feSpecularLighting> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFeSpecularLightingElementBridge.java,v 1.12 2001/07/24 16:00:38 deweese Exp $
+ * @version $Id: SVGFeSpecularLightingElementBridge.java,v 1.13 2002/03/19 15:19:25 deweese Exp $
*/
public class SVGFeSpecularLightingElementBridge
extends AbstractSVGLightingElementBridge {
@@ -96,17 +96,10 @@
return null; // disable the filter
}
- // The default region is the union of the input sources
- // regions unless 'in' is 'SourceGraphic' in which case the
- // default region is the filterChain's region
- Filter sourceGraphics = (Filter)filterMap.get(SVG_SOURCE_GRAPHIC_VALUE);
- Rectangle2D defaultRegion;
- if (in == sourceGraphics) {
- defaultRegion = filterRegion;
- } else {
- defaultRegion = in.getBounds2D();
- }
-
+ // Default region is the size of in (if in is SourceGraphic or
+ // SourceAlpha it will already include a pad/crop to the
+ // proper filter region size).
+ Rectangle2D defaultRegion = in.getBounds2D();
Rectangle2D primitiveRegion
= SVGUtilities.convertFilterPrimitiveRegion(filterElement,
filteredElement,
1.10 +1 -2 xml-batik/sources/org/apache/batik/bridge/SVGFeTileElementBridge.java
Index: SVGFeTileElementBridge.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGFeTileElementBridge.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SVGFeTileElementBridge.java 24 Jul 2001 16:00:38 -0000 1.9
+++ SVGFeTileElementBridge.java 19 Mar 2002 15:19:25 -0000 1.10
@@ -22,7 +22,7 @@
* Bridge class for the <feTile> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFeTileElementBridge.java,v 1.9 2001/07/24 16:00:38 deweese Exp $
+ * @version $Id: SVGFeTileElementBridge.java,v 1.10 2002/03/19 15:19:25 deweese Exp $
*/
public class SVGFeTileElementBridge
extends AbstractSVGFilterPrimitiveElementBridge {
@@ -70,7 +70,6 @@
// Get the tiled region. For feTile, the default for the
// filter primitive subregion is the parent filter region.
Rectangle2D defaultRegion = filterRegion;
-
Rectangle2D primitiveRegion
= SVGUtilities.convertFilterPrimitiveRegion(filterElement,
filteredElement,
1.14 +6 -1 xml-batik/sources/org/apache/batik/bridge/SVGFilterElementBridge.java
Index: SVGFilterElementBridge.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGFilterElementBridge.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- SVGFilterElementBridge.java 11 Feb 2002 16:00:08 -0000 1.13
+++ SVGFilterElementBridge.java 19 Mar 2002 15:19:25 -0000 1.14
@@ -22,6 +22,8 @@
import org.apache.batik.ext.awt.image.renderable.Filter;
import org.apache.batik.ext.awt.image.renderable.FilterChainRable8Bit;
import org.apache.batik.ext.awt.image.renderable.FilterChainRable;
+import org.apache.batik.ext.awt.image.PadMode;
+import org.apache.batik.ext.awt.image.renderable.PadRable8Bit;
import org.apache.batik.gvt.GraphicsNode;
import org.apache.batik.gvt.filter.GraphicsNodeRable;
import org.apache.batik.gvt.filter.GraphicsNodeRable8Bit;
@@ -33,7 +35,7 @@
* Bridge class for the <filter> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGFilterElementBridge.java,v 1.13 2002/02/11 16:00:08 tkormann Exp $
+ * @version $Id: SVGFilterElementBridge.java,v 1.14 2002/03/19 15:19:25 deweese Exp $
*/
public class SVGFilterElementBridge extends AbstractSVGBridge
implements FilterBridge, ErrorConstants {
@@ -69,6 +71,9 @@
// make the initial source as a RenderableImage
Filter sourceGraphic = filteredNode.getGraphicsNodeRable(true);
+ // Pad out to filterRegion
+ sourceGraphic = new PadRable8Bit(sourceGraphic, filterRegion,
+ PadMode.ZERO_PAD);
// build a FilterChainRable8Bit
FilterChainRable filterChain
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org