vhardy 2002/11/25 08:14:16
Modified: sources/org/apache/batik/bridge SVGUtilities.java
sources/org/apache/batik/extension/svg
BatikExtConstants.java
test-resources/org/apache/batik/test samplesRendering.xml
Added: samples/extensions filterRegion.svg filterRegionDetailed.svg
test-references/samples/extensions filterRegion.png
filterRegionDetailed.png
Log:
Added and complemented Philipe Converset (Qarbon)'s contribution of an extension to
define margins in filter regions
Revision Changes Path
1.22 +238 -61 xml-batik/sources/org/apache/batik/bridge/SVGUtilities.java
Index: SVGUtilities.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGUtilities.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- SVGUtilities.java 13 Jun 2002 11:19:37 -0000 1.21
+++ SVGUtilities.java 25 Nov 2002 16:14:15 -0000 1.22
@@ -36,6 +36,8 @@
import org.apache.batik.parser.PreserveAspectRatioParser;
import org.apache.batik.parser.PreserveAspectRatioParser;
+import org.apache.batik.extension.svg.BatikExtConstants;
+
import org.apache.batik.util.SVGConstants;
import org.apache.batik.util.ParsedURL;
@@ -535,69 +537,182 @@
return filterRes;
}
- /**
- * Returns the filter region according to the x, y, width, height,
- * and filterUnits attributes.
- *
- * @param filterElement the filter element that defines the attributes
- * @param filteredElement the element referencing the filter
- * @param filteredNode the graphics node to filter (objectBoundingBox)
- * @param uctx the unit processor context (userSpaceOnUse)
- * @param ctx the bridge context
- */
- public static
- Rectangle2D convertFilterChainRegion(Element filterElement,
- Element filteredElement,
- GraphicsNode filteredNode,
- BridgeContext ctx) {
-
- // 'x' attribute - default is -10%
- String xStr = getChainableAttributeNS
- (filterElement, null, SVG_X_ATTRIBUTE, ctx);
- if (xStr.length() == 0) {
- xStr = SVG_FILTER_X_DEFAULT_VALUE;
- }
- // 'y' attribute - default is -10%
- String yStr = getChainableAttributeNS
- (filterElement, null, SVG_Y_ATTRIBUTE, ctx);
- if (yStr.length() == 0) {
- yStr = SVG_FILTER_Y_DEFAULT_VALUE;
- }
- // 'width' attribute - default is 120%
- String wStr = getChainableAttributeNS
- (filterElement, null, SVG_WIDTH_ATTRIBUTE, ctx);
- if (wStr.length() == 0) {
- wStr = SVG_FILTER_WIDTH_DEFAULT_VALUE;
- }
- // 'height' attribute - default is 120%
- String hStr = getChainableAttributeNS
- (filterElement, null, SVG_HEIGHT_ATTRIBUTE, ctx);
- if (hStr.length() == 0) {
- hStr = SVG_FILTER_HEIGHT_DEFAULT_VALUE;
- }
- // 'filterUnits' attribute - default is 'objectBoundingBox'
- short unitsType;
- String units = getChainableAttributeNS
- (filterElement, null, SVG_FILTER_UNITS_ATTRIBUTE, ctx);
- if (units.length() == 0) {
- unitsType = OBJECT_BOUNDING_BOX;
- } else {
- unitsType = parseCoordinateSystem
- (filterElement, SVG_FILTER_UNITS_ATTRIBUTE, units);
+ /**
+ * Returns the filter region according to the x, y, width, height,
+ * dx, dy, dw, dh and filterUnits attributes.
+ *
+ * @param filterElement the filter element that defines the attributes
+ * @param filteredElement the element referencing the filter
+ * @param filteredNode the graphics node to filter (objectBoundingBox)
+ * @param uctx the unit processor context (userSpaceOnUse)
+ * @param ctx the bridge context
+ */
+ public static
+ Rectangle2D convertFilterChainRegion(Element filterElement,
+ Element filteredElement,
+ GraphicsNode filteredNode,
+ BridgeContext ctx) {
+
+ // 'x' attribute - default is -10%
+ String xStr = getChainableAttributeNS
+ (filterElement, null, SVG_X_ATTRIBUTE, ctx);
+ if (xStr.length() == 0) {
+ xStr = SVG_FILTER_X_DEFAULT_VALUE;
+ }
+ // 'y' attribute - default is -10%
+ String yStr = getChainableAttributeNS
+ (filterElement, null, SVG_Y_ATTRIBUTE, ctx);
+ if (yStr.length() == 0) {
+ yStr = SVG_FILTER_Y_DEFAULT_VALUE;
+ }
+ // 'width' attribute - default is 120%
+ String wStr = getChainableAttributeNS
+ (filterElement, null, SVG_WIDTH_ATTRIBUTE, ctx);
+ if (wStr.length() == 0) {
+ wStr = SVG_FILTER_WIDTH_DEFAULT_VALUE;
+ }
+ // 'height' attribute - default is 120%
+ String hStr = getChainableAttributeNS
+ (filterElement, null, SVG_HEIGHT_ATTRIBUTE, ctx);
+ if (hStr.length() == 0) {
+ hStr = SVG_FILTER_HEIGHT_DEFAULT_VALUE;
+ }
+ // 'filterUnits' attribute - default is 'objectBoundingBox'
+ short unitsType;
+ String units = getChainableAttributeNS
+ (filterElement, null, SVG_FILTER_UNITS_ATTRIBUTE, ctx);
+ if (units.length() == 0) {
+ unitsType = OBJECT_BOUNDING_BOX;
+ } else {
+ unitsType = parseCoordinateSystem
+ (filterElement, SVG_FILTER_UNITS_ATTRIBUTE, units);
+ }
+
+ // resolve units in the (referenced) filteredElement's
+ // coordinate system
+ UnitProcessor.Context uctx
+ = UnitProcessor.createContext(ctx, filteredElement);
+
+ Rectangle2D region = convertRegion(xStr,
+ yStr,
+ wStr,
+ hStr,
+ unitsType,
+ filteredNode,
+ uctx);
+
+ //
+ // Account for region padding
+ //
+ units = getChainableAttributeNS
+ (filterElement, null,
+ BatikExtConstants.BATIK_EXT_FILTER_MARGINS_UNITS_ATTRIBUTE, ctx);
+ if (units.length() == 0) {
+ // Default to user space on use for margins, not objectBoundingBox
+ unitsType = USER_SPACE_ON_USE;
+ } else {
+ unitsType = parseCoordinateSystem
+ (filterElement,
+ BatikExtConstants.BATIK_EXT_FILTER_MARGINS_UNITS_ATTRIBUTE, units);
+ }
+
+ // 'batik:dx' attribute - default is 0
+ String dxStr =
filterElement.getAttributeNS(BatikExtConstants.BATIK_EXT_NAMESPACE_URI,
+
BatikExtConstants.BATIK_EXT_DX_ATRIBUTE);
+ if (dxStr.length() == 0) {
+ dxStr = BatikExtConstants.SVG_FILTER_DX_DEFAULT_VALUE;
+ }
+ // 'batik:dy' attribute - default is 0
+ String dyStr =
filterElement.getAttributeNS(BatikExtConstants.BATIK_EXT_NAMESPACE_URI,
+
BatikExtConstants.BATIK_EXT_DY_ATRIBUTE);
+ if (dyStr.length() == 0) {
+ dyStr = BatikExtConstants.SVG_FILTER_DY_DEFAULT_VALUE;
+ }
+ // 'batik:dw' attribute - default is 0
+ String dwStr =
filterElement.getAttributeNS(BatikExtConstants.BATIK_EXT_NAMESPACE_URI,
+
BatikExtConstants.BATIK_EXT_DW_ATRIBUTE);
+ if (dwStr.length() == 0) {
+ dwStr = BatikExtConstants.SVG_FILTER_DW_DEFAULT_VALUE;
+ }
+ // 'batik:dh' attribute - default is 0
+ String dhStr =
filterElement.getAttributeNS(BatikExtConstants.BATIK_EXT_NAMESPACE_URI,
+
BatikExtConstants.BATIK_EXT_DH_ATRIBUTE);
+ if (dhStr.length() == 0) {
+ dhStr = BatikExtConstants.SVG_FILTER_DH_DEFAULT_VALUE;
+ }
+
+ return extendRegion(dxStr,
+ dyStr,
+ dwStr,
+ dhStr,
+ unitsType,
+ filteredNode,
+ region,
+ uctx);
+ }
+
+ /**
+ * Returns a rectangle that represents the region extended by the
+ * specified differential coordinates.
+ *
+ * @param dxStr the differential x coordinate of the region
+ * @param dyStr the differential y coordinate of the region
+ * @param dwStr the differential width of the region
+ * @param dhStr the differential height of the region
+ * @param unitsType specifies whether the values are in userSpaceOnUse
+ * or objectBoundingBox space
+ * @param region the region to extend
+ * @param uctx the unit processor context (needed for userSpaceOnUse)
+ */
+ protected static Rectangle2D extendRegion(String dxStr,
+ String dyStr,
+ String dwStr,
+ String dhStr,
+ short unitsType,
+ GraphicsNode filteredNode,
+ Rectangle2D region,
+ UnitProcessor.Context uctx) {
+
+ float dx,dy,dw,dh;
+ switch (unitsType) {
+ case USER_SPACE_ON_USE:
+ dx = UnitProcessor.svgHorizontalCoordinateToUserSpace
+ (dxStr, BatikExtConstants.BATIK_EXT_DX_ATRIBUTE, uctx);
+ dy = UnitProcessor.svgVerticalCoordinateToUserSpace
+ (dyStr, BatikExtConstants.BATIK_EXT_DY_ATRIBUTE, uctx);
+ dw = UnitProcessor.svgHorizontalCoordinateToUserSpace
+ (dwStr, BatikExtConstants.BATIK_EXT_DW_ATRIBUTE, uctx);
+ dh = UnitProcessor.svgVerticalCoordinateToUserSpace
+ (dhStr, BatikExtConstants.BATIK_EXT_DH_ATRIBUTE, uctx);
+ break;
+ case OBJECT_BOUNDING_BOX:
+ Rectangle2D bounds = filteredNode.getGeometryBounds();
+ dx = UnitProcessor.svgHorizontalCoordinateToObjectBoundingBox
+ (dxStr, BatikExtConstants.BATIK_EXT_DX_ATRIBUTE, uctx);
+ dx *= bounds.getWidth();
+
+ dy = UnitProcessor.svgVerticalCoordinateToObjectBoundingBox
+ (dyStr, BatikExtConstants.BATIK_EXT_DY_ATRIBUTE, uctx);
+ dy *= bounds.getHeight();
+
+ dw = UnitProcessor.svgHorizontalCoordinateToObjectBoundingBox
+ (dwStr, BatikExtConstants.BATIK_EXT_DW_ATRIBUTE, uctx);
+ dw *= bounds.getWidth();
+
+ dh = UnitProcessor.svgVerticalCoordinateToObjectBoundingBox
+ (dhStr, BatikExtConstants.BATIK_EXT_DH_ATRIBUTE, uctx);
+ dh *= bounds.getHeight();
+ break;
+ default:
+ throw new Error(); // can't be reached
}
- // resolve units in the (referenced) filteredElement's
- // coordinate system
- UnitProcessor.Context uctx
- = UnitProcessor.createContext(ctx, filteredElement);
+ region.setRect(region.getX() + dx,
+ region.getY() + dy,
+ region.getWidth() + dw,
+ region.getHeight() + dh);
- return convertRegion(xStr,
- yStr,
- wStr,
- hStr,
- unitsType,
- filteredNode,
- uctx);
+ return region;
}
/**
@@ -711,7 +826,69 @@
}
Rectangle2D region = new Rectangle2D.Double(x, y, w, h);
+
+ // Now, extend filter primitive region with dx/dy/dw/dh
+ // settings (Batik extension). The dx/dy/dw/dh padding is
+ // *always* in userSpaceOnUse space.
+
+ units = "";
+ if ((parentNode != null) &&
+ (parentNode.getNodeType() == parentNode.ELEMENT_NODE)) {
+ Element parent = (Element)parentNode;
+ units = getChainableAttributeNS
+ (parent,
+ BatikExtConstants.BATIK_EXT_NAMESPACE_URI,
+
BatikExtConstants.BATIK_EXT_FILTER_PRIMITIVE_MARGINS_UNITS_ATTRIBUTE,
+ ctx);
+ }
+
+ if (units.length() == 0) {
+ unitsType = USER_SPACE_ON_USE;
+ } else {
+ unitsType = parseCoordinateSystem
+ (filterPrimitiveElement,
+
BatikExtConstants.BATIK_EXT_FILTER_PRIMITIVE_MARGINS_UNITS_ATTRIBUTE, units);
+ }
+
+ // 'batik:dx' attribute - default is 0
+ String dxStr =
filterPrimitiveElement.getAttributeNS(BatikExtConstants.BATIK_EXT_NAMESPACE_URI,
+
BatikExtConstants.BATIK_EXT_DX_ATRIBUTE);
+ if (dxStr.length() == 0) {
+ dxStr = BatikExtConstants.SVG_FILTER_DX_DEFAULT_VALUE;
+ }
+
+ // 'batik:dy' attribute - default is 0
+ String dyStr =
filterPrimitiveElement.getAttributeNS(BatikExtConstants.BATIK_EXT_NAMESPACE_URI,
+
BatikExtConstants.BATIK_EXT_DY_ATRIBUTE);
+ if (dyStr.length() == 0) {
+ dyStr = BatikExtConstants.SVG_FILTER_DY_DEFAULT_VALUE;
+ }
+
+ // 'batik:dw' attribute - default is 0
+ String dwStr =
filterPrimitiveElement.getAttributeNS(BatikExtConstants.BATIK_EXT_NAMESPACE_URI,
+
BatikExtConstants.BATIK_EXT_DW_ATRIBUTE);
+ if (dwStr.length() == 0) {
+ dwStr = BatikExtConstants.SVG_FILTER_DW_DEFAULT_VALUE;
+ }
+
+ // 'batik:dh' attribute - default is 0
+ String dhStr =
filterPrimitiveElement.getAttributeNS(BatikExtConstants.BATIK_EXT_NAMESPACE_URI,
+
BatikExtConstants.BATIK_EXT_DH_ATRIBUTE);
+ if (dhStr.length() == 0) {
+ dhStr = BatikExtConstants.SVG_FILTER_DH_DEFAULT_VALUE;
+ }
+
+ region = extendRegion(dxStr,
+ dyStr,
+ dwStr,
+ dhStr,
+ unitsType,
+ filteredNode,
+ region,
+ uctx);
+
region.intersect(region, filterRegion, region);
+
return region;
}
1.14 +35 -1
xml-batik/sources/org/apache/batik/extension/svg/BatikExtConstants.java
Index: BatikExtConstants.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/extension/svg/BatikExtConstants.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- BatikExtConstants.java 15 Nov 2002 15:46:50 -0000 1.13
+++ BatikExtConstants.java 25 Nov 2002 16:14:15 -0000 1.14
@@ -34,6 +34,30 @@
public static final String BATIK_EXT_FLOW_REGION_TAG =
"flowRegion";
+ /** Attribute name for dx attribute */
+ public static final String BATIK_EXT_DX_ATRIBUTE =
+ "dx";
+
+ /** Attribute name for dy attribute */
+ public static final String BATIK_EXT_DY_ATRIBUTE =
+ "dy";
+
+ /** Attribute name for dw attribute */
+ public static final String BATIK_EXT_DW_ATRIBUTE =
+ "dw";
+
+ /** Attribute name for dh attribute */
+ public static final String BATIK_EXT_DH_ATRIBUTE =
+ "dh";
+
+ /** Attribute name for filterPrimitiveMarginsUnits */
+ public static final String BATIK_EXT_FILTER_PRIMITIVE_MARGINS_UNITS_ATTRIBUTE
+ = "filterPrimitiveMarginsUnits";
+
+ /** Attribute name for filterMarginsUnits */
+ public static final String BATIK_EXT_FILTER_MARGINS_UNITS_ATTRIBUTE
+ = "filterMarginsUnits";
+
/** Attribute name for x attribute */
public static final String BATIK_EXT_X_ATTRIBUTE =
"x";
@@ -75,7 +99,6 @@
public static final String BATIK_EXT_PREFORMATTED_ATTRIBUTE =
"preformatted";
-
/** Tag name for Batik's flowText extension div element SVG 1.1). */
public static final String BATIK_EXT_FLOW_DIV_TAG =
"flowDiv";
@@ -145,4 +168,15 @@
public static final String BATIK_EXT_SOLID_OPACITY_PROPERTY =
"solid-opacity";
+ /** Default value for filter dx */
+ public static final String SVG_FILTER_DX_DEFAULT_VALUE = "0";
+
+ /** Default value for filter dy */
+ public static final String SVG_FILTER_DY_DEFAULT_VALUE = "0";
+
+ /** Default value for filter dw */
+ public static final String SVG_FILTER_DW_DEFAULT_VALUE = "0";
+
+ /** Default value for filter dh */
+ public static final String SVG_FILTER_DH_DEFAULT_VALUE = "0";
}
1.1 xml-batik/samples/extensions/filterRegion.svg
Index: filterRegion.svg
===================================================================
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<!-- ====================================================================== -->
<!-- Copyright (C) The Apache Software Foundation. All rights reserved. -->
<!-- -->
<!-- This software is published under the terms of the Apache Software -->
<!-- License version 1.1, a copy of which has been included with this -->
<!-- distribution in the LICENSE file. -->
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<!-- Filter extension attributes -->
<!-- -->
<!-- @author -->
<!-- @version $Id: filterRegion.svg,v 1.1 2002/11/25 16:14:15 vhardy Exp $
-->
<!-- ====================================================================== -->
<?xml-stylesheet type="text/css" href="extension.css" ?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
id="body" width="450" height="500" xml:space="preserve"
viewBox="0 0 450 500"
xmlns:batik="http://xml.apache.org/batik/ext">
<title>Filter Extension Attributes</title>
<defs>
<filter id="DropShadow" x="-20%" y="-20%" width="250%" height="250%">
<feGaussianBlur in="SourceAlpha" stdDeviation="3" result="blurredAlpha"/>
<feOffset in="blurredAlpha" dx="3" dy="3" result="offsetBlurredAlpha"/>
<feFlood result="flooded"
style="flood-color:rgb(0,0,0);flood-opacity:0.65"/>
<feComposite in="flooded" operator="in" in2="offsetBlurredAlpha"
result="coloredShadow"/>
<feComposite in="SourceGraphic" in2="coloredShadow" operator="over"/>
</filter>
<filter id="DropShadowExtended"
batik:dx="-12" batik:dy="-12" batik:dw="24" batik:dh="24">
<feGaussianBlur in="SourceAlpha" stdDeviation="3" result="blurredAlpha"/>
<feOffset in="blurredAlpha" dx="3" dy="3" result="offsetBlurredAlpha"/>
<feFlood result="flooded"
style="flood-color:rgb(0,0,0);flood-opacity:0.65"/>
<feComposite in="flooded" operator="in" in2="offsetBlurredAlpha"
result="coloredShadow"/>
<feComposite in="SourceGraphic" in2="coloredShadow" operator="over"/>
</filter>
</defs>
<!-- ============================================================= -->
<!-- Test content -->
<!-- ============================================================= -->
<g id="testContent" class="legend" style="text-anchor:middle">
<text x="220" y="40" class="title">
Filter Extension Attributes
</text>
<g transform="translate(150 40)">
<g style="fill:#DAA;stroke:black">
<rect x="0" y="40" width="48" height="58" filter="url(#DropShadow)"/>
<rect x="0" y="110" width="48" height="2" filter="url(#DropShadow)"/>
<line x1="0" y1="130" x2="48" y2="130" filter="url(#DropShadow)"/>
<line x1="20" y1="140" x2="20" y2="170" filter="url(#DropShadow)"/>
</g>
<text x="20" y="195" text-anchor="middle">Without</text>
</g>
<g transform="translate(250 40)">
<g style="fill:#ADA;stroke:black;">
<rect x="0" y="40" width="48" height="58"
filter="url(#DropShadowExtended)"/>
<rect x="0" y="110" width="48" height="2"
filter="url(#DropShadowExtended)"/>
<line x1="0" y1="130" x2="48" y2="130"
filter="url(#DropShadowExtended)"/>
<line x1="20" y1="140" x2="20" y2="170"
filter="url(#DropShadowExtended)"/>
</g>
<text x="20" y="195" text-anchor="middle">With</text>
</g>
</g>
<!-- ============================================================= -->
<!-- Batik sample mark -->
<!-- ============================================================= -->
<use xlink:href="../batikLogo.svg#Batik_Tag_Box" />
</svg>
1.1 xml-batik/samples/extensions/filterRegionDetailed.svg
Index: filterRegionDetailed.svg
===================================================================
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<!-- ========================================================================= -->
<!-- Copyright (C) The Apache Software Foundation. All rights reserved. -->
<!-- -->
<!-- This software is published under the terms of the Apache Software License -->
<!-- version 1.1, a copy of which has been included with this distribution in -->
<!-- the LICENSE file. -->
<!-- ========================================================================= -->
<!-- ========================================================================= -->
<!-- -->
<!-- @author [EMAIL PROTECTED] -->
<!-- @version $Id: filterRegionDetailed.svg,v 1.1 2002/11/25 16:14:15 vhardy Exp $
-->
<!-- ========================================================================= -->
<?xml-stylesheet type="text/css" href="extension.css" ?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:b="http://xml.apache.org/batik/ext"
id="body" width="450" height="500" viewBox="0 0 450 500">
<title>FilterRegions test</title>
<text x="225" y="40" class="title">
Filter Regions with padding
</text>
<style type="text/css">
<![CDATA[
.filterRegionControl {
fill: none;
stroke: black;
stroke-opacity: 1;
stroke-width: 1;
shape-rendering: crispEdges;
}
.bbox {
fill: none;
stroke: black;
stroke-opacity: 1;
stroke-width: 1;
shape-rendering: crispEdges;
stroke-dasharray: 3 3;
}
.filterRegionControlLabel {
fill: black;
font-size: 10;
text-anchor: middle;
shape-rendering: crispEdges;
}
]]>
</style>
<defs>
<!-- ======================================================== -->
<!-- filterRegion_0 -->
<!-- chain padding: [userSpaceOnUse], undefined -->
<!-- flood padding: [userSpaceOnUse], undefined -->
<!-- -->
<!-- Expected fill region: (0, 0, 60, 40) in user space -->
<!-- ======================================================== -->
<filter id="filterRegion_0" x="0" y="0" width="1" height="1">
<feFlood flood-color="crimson"
result="crimson"/>
</filter>
<!-- ======================================================== -->
<!-- filterRegion_1 -->
<!-- chain padding: [userSpaceOnUse], -5,-5,10,10 -->
<!-- flood padding: [userSpaceOnUse], undefined -->
<!-- -->
<!-- Expected fill region: (-5, -5, 70, 50) in user space -->
<!-- ======================================================== -->
<filter id="filterRegion_1" x="0" y="0" width="1" height="1"
b:dx="-5" b:dy="-5" b:dw="10" b:dh="10">
<feFlood flood-color="gold"
result="gold"/>
</filter>
<!-- ======================================================== -->
<!-- filterRegion_2 -->
<!-- chain padding: [userSpaceOnUse], 5,5,-10,-10 -->
<!-- flood padding: [userSpaceOnUse], undefined -->
<!-- -->
<!-- Expected fill region: (5, 5, 50, 30) in user space -->
<!-- ======================================================== -->
<filter id="filterRegion_2" x="0" y="0" width="1" height="1"
b:dx="5" b:dy="5" b:dw="-10" b:dh="-10">
<feFlood flood-color="orange"
result="orange"/>
</filter>
<!-- ======================================================== -->
<!-- filterRegion_3 -->
<!-- chain padding: [userSpaceOnUse], -5,-5,10,10 -->
<!-- flood padding: [userSpaceOnUse], undefined -->
<!-- -->
<!-- Expected fill region: (-5, -5, 70, 50) in user space -->
<!-- ======================================================== -->
<filter id="filterRegion_3" x="0" y="0" width="1" height="1"
filterMarginsUnits="userSpaceOnUse"
b:dx="-5" b:dy="-5" b:dw="10" b:dh="10">
<feFlood flood-color="gold" />
</filter>
<!-- ======================================================== -->
<!-- filterRegion_4 -->
<!-- chain padding: [userSpaceOnUse], 5, 5, -10, -10 -->
<!-- flood padding: [userSpaceOnUse], undefined -->
<!-- -->
<!-- Expected fill region: (5, 5, 50, 30) in user space -->
<!-- ======================================================== -->
<filter id="filterRegion_4" x="0" y="0" width="1" height="1"
filterMarginsUnits="userSpaceOnUse"
b:dx="5" b:dy="5" b:dw="-10" b:dh="-10">
<feFlood flood-color="orange" />
</filter>
<!-- ======================================================== -->
<!-- filterRegion_5 -->
<!-- chain padding: [objectBoundingBox], -.1, -.1, .2, .2 -->
<!-- flood padding: [userSpaceOnUse], undefined -->
<!-- -->
<!-- Expected fill region: (-6, -4, 72, 48) in user space -->
<!-- ======================================================== -->
<filter id="filterRegion_5" x="0" y="0" width="1" height="1"
filterMarginsUnits="objectBoundingBox"
b:dx="-.1" b:dy="-.1" b:dw=".2" b:dh=".2">
<feFlood flood-color="gold" />
</filter>
<!-- ======================================================== -->
<!-- filterRegion_6 -->
<!-- chain padding: [objectBoundingBox], .1, .1, -.2, -.2 -->
<!-- flood padding: [userSpaceOnUse], undefined -->
<!-- -->
<!-- Expected fill region: (6, 4, 48, 32) in user space -->
<!-- ======================================================== -->
<filter id="filterRegion_6" x="0" y="0" width="1" height="1"
filterMarginsUnits="objectBoundingBox"
b:dx=".1" b:dy=".1" b:dw="-.2" b:dh="-.2">
<feFlood flood-color="orange" />
</filter>
<!-- ======================================================== -->
<!-- filterRegion_7 -->
<!-- chain padding: [userSpaceOnUse], undefined -->
<!-- flood padding: [default], 5, 5, -10, -10 -->
<!-- -->
<!-- Expected fill region: (5, 5, 50, 30) in user space -->
<!-- ======================================================== -->
<filter id="filterRegion_7" x="0" y="0" width="1" height="1">
<feFlood flood-color="crimson" result="crimson"/>
<feFlood flood-color="gold"
result="gold" b:dx="5" b:dy="5" b:dw="-10" b:dh="-10"/>
<feMerge>
<feMergeNode in="crimson" />
<feMergeNode in="gold" />
</feMerge>
</filter>
<!-- ======================================================== -->
<!-- filterRegion_8 -->
<!-- chain padding: [userSpaceOnUse], undefined -->
<!-- flood padding: [userSpaceOnUse], 5, 5, -10, -10 -->
<!-- -->
<!-- Expected fill region: (5, 5, 50, 30) in user space -->
<!-- ======================================================== -->
<filter id="filterRegion_8" x="0" y="0" width="1" height="1"
b:filterPrimitiveMarginsUnits="userSpaceOnUse">
<feFlood flood-color="gold" result="gold"/>
<feFlood flood-color="crimson"
result="crimson" b:dx="5" b:dy="5" b:dw="-10" b:dh="-10"/>
<feMerge>
<feMergeNode in="gold" />
<feMergeNode in="crimson" />
</feMerge>
</filter>
<!-- ======================================================== -->
<!-- filterRegion_9 -->
<!-- chain padding: [userSpaceOnUse], undefined -->
<!-- flood padding: [objectBoundingBox], .1, .1, -.2, -.2 -->
<!-- -->
<!-- Expected fill region: (6, 4, 48, 32) in user space -->
<!-- ======================================================== -->
<filter id="filterRegion_9" x="0" y="0" width="1" height="1"
b:filterPrimitiveMarginsUnits="objectBoundingBox">
<feFlood flood-color="gold" result="gold"/>
<feFlood flood-color="crimson"
result="crimson" b:dx=".1" b:dy=".1" b:dw="-.2" b:dh="-.2"/>
<feMerge>
<feMergeNode in="gold" />
<feMergeNode in="crimson" />
</feMerge>
</filter>
</defs>
<!-- ============================ -->
<!-- filterRegion_0 : No padding -->
<!-- ============================ -->
<g transform="translate(20, 100)">
<rect x="0" y="0" width="60" height="40" filter="url(#filterRegion_0)" />
<rect class="filterRegionControl" x="0" y="0" width="60" height="40" />
<text x="30" y="-10" class="filterRegionControlLabel">No padding</text>
</g>
<!-- ========================================== -->
<!-- filterRegion_1 : User Space chain padding -->
<!-- ========================================== -->
<g transform="translate(120, 100)">
<rect x="0" y="0" width="60" height="40" filter="url(#filterRegion_1)" />
<rect class="filterRegionControl" x="-5" y="-5" width="70" height="50" />
<rect class="bbox" x="0" y="0" width="60" height="40" />
<text x="30" y="-10" class="filterRegionControlLabel">Chain Padding A</text>
</g>
<!-- ============================================== -->
<!-- filterRegion_2 : User Space chain padding -->
<!-- ============================================== -->
<g transform="translate(220, 100)">
<rect x="0" y="0" width="60" height="40" filter="url(#filterRegion_2)" />
<rect class="filterRegionControl" x="5" y="5" width="50" height="30" />
<rect class="bbox" width="60" height="40" />
<text x="30" y="-10" class="filterRegionControlLabel">Chain Padding B</text>
</g>
<!-- ========================================== -->
<!-- filterRegion_3 : User Space chain padding -->
<!-- ========================================== -->
<g transform="translate(120, 200)">
<rect x="0" y="0" width="60" height="40" filter="url(#filterRegion_3)" />
<rect class="filterRegionControl" x="-5" y="-5" width="70" height="50" />
<rect class="bbox" width="60" height="40" />
<text x="30" y="-10" class="filterRegionControlLabel">Chain Padding C</text>
</g>
<!-- ============================================== -->
<!-- filterRegion_4 : Use Space chain padding -->
<!-- ============================================== -->
<g transform="translate(220, 200)">
<rect x="0" y="0" width="60" height="40" filter="url(#filterRegion_4)" />
<rect class="filterRegionControl" x="5" y="5" width="50" height="30" />
<rect class="bbox" width="60" height="40" />
<text x="30" y="-10" class="filterRegionControlLabel">Chain Padding D</text>
</g>
<!-- ========================================== -->
<!-- filterRegion_5 : object BB chain padding -->
<!-- ========================================== -->
<g transform="translate(120, 300)">
<rect x="0" y="0" width="60" height="40" filter="url(#filterRegion_5)" />
<rect class="bbox" width="60" height="40" />
<rect class="filterRegionControl" x="-6" y="-4" width="72" height="48" />
<text x="30" y="-10" class="filterRegionControlLabel">Chain Padding E</text>
</g>
<!-- ============================================== -->
<!-- filterRegion_6 : object BB chain padding -->
<!-- ============================================== -->
<g transform="translate(220, 300)">
<rect x="0" y="0" width="60" height="40" filter="url(#filterRegion_6)" />
<rect class="bbox" width="60" height="40" />
<rect class="filterRegionControl" x="6" y="4" width="48" height="32" />
<text x="30" y="-10" class="filterRegionControlLabel">Chain Padding F</text>
</g>
<!-- =================================================== -->
<!-- filterRegion_7 : user space primitive padding -->
<!-- =================================================== -->
<g transform="translate(320, 100)">
<rect x="0" y="0" width="60" height="40" filter="url(#filterRegion_7)" />
<rect class="bbox" width="60" height="40" />
<rect class="filterRegionControl" x="5" y="5" width="50" height="30" />
<text x="30" y="-10" class="filterRegionControlLabel">Primitive Padding
A</text>
</g>
<!-- =================================================== -->
<!-- filterRegion_8 : user space primitive padding -->
<!-- =================================================== -->
<g transform="translate(320, 200)">
<rect x="0" y="0" width="60" height="40" filter="url(#filterRegion_8)" />
<rect class="bbox" width="60" height="40" />
<rect class="filterRegionControl" x="5" y="5" width="50" height="30" />
<text x="30" y="-10" class="filterRegionControlLabel">Primitive Padding
B</text>
</g>
<!-- =================================================== -->
<!-- filterRegion_9 : object BB primitive padding -->
<!-- =================================================== -->
<g transform="translate(320, 300)">
<rect x="0" y="0" width="60" height="40" filter="url(#filterRegion_9)" />
<rect class="bbox" width="60" height="40" />
<rect class="filterRegionControl" x="6" y="4" width="48" height="32" />
<text x="30" y="-10" class="filterRegionControlLabel">Primitive Padding
C</text>
</g>
<!-- ============================================================= -->
<!-- Batik sample mark -->
<!-- ============================================================= -->
<use xlink:href="../batikLogo.svg#Batik_Tag_Box" />
</svg>
1.88 +7 -1
xml-batik/test-resources/org/apache/batik/test/samplesRendering.xml
Index: samplesRendering.xml
===================================================================
RCS file:
/home/cvs/xml-batik/test-resources/org/apache/batik/test/samplesRendering.xml,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -r1.87 -r1.88
--- samplesRendering.xml 19 Nov 2002 17:03:54 -0000 1.87
+++ samplesRendering.xml 25 Nov 2002 16:14:15 -0000 1.88
@@ -71,6 +71,12 @@
<test id="samples/extensions/star.svg" >
<property name="Validating" class="java.lang.Boolean" value="false" />
</test>
+ <test id="samples/extensions/filterRegion.svg" >
+ <property name="Validating" class="java.lang.Boolean" value="false" />
+ </test>
+ <test id="samples/extensions/filterRegionDetailed.svg" >
+ <property name="Validating" class="java.lang.Boolean" value="false" />
+ </test>
</testGroup>
<!-- ======================================================================= -->
1.1 xml-batik/test-references/samples/extensions/filterRegion.png
<<Binary file>>
1.1
xml-batik/test-references/samples/extensions/filterRegionDetailed.png
<<Binary file>>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]