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/10/03 20:57:16 UTC
cvs commit: xml-batik/sources/org/apache/batik/extension/svg/renderable MultiResRable.java
deweese 2002/10/03 11:57:15
Modified: resources/org/apache/batik/apps/rasterizer/resources
Messages.properties
samples/extensions multi.svg
sources/org/apache/batik/bridge SVGBrokenLinkProvider.java
sources/org/apache/batik/extension/svg
BatikMultiImageElementBridge.java
Added: samples/extensions multi2.svg
samples/extensions/opera opera-0-0-0.svg opera-0-0-2.svg
opera-0-0-4.svg opera-0-2-0.svg opera-0-2-2.svg
opera-0-2-4.svg opera-1-0-0.svg opera-1-0-2.svg
opera-2-0-0.svg opera-3-0-0.svg
samples/extensions/opera/multires opera-0-0-0.jpg
opera-0-0-1.jpg opera-0-0-2.jpg opera-0-0-3.jpg
opera-0-0-4.jpg opera-0-0-5.jpg opera-0-1-0.jpg
opera-0-1-1.jpg opera-0-1-2.jpg opera-0-1-3.jpg
opera-0-1-4.jpg opera-0-1-5.jpg opera-0-2-0.jpg
opera-0-2-1.jpg opera-0-2-2.jpg opera-0-2-3.jpg
opera-0-2-4.jpg opera-0-2-5.jpg opera-0-3-0.jpg
opera-0-3-1.jpg opera-0-3-2.jpg opera-0-3-3.jpg
opera-0-3-4.jpg opera-0-3-5.jpg opera-1-0-0.jpg
opera-1-0-1.jpg opera-1-0-2.jpg opera-1-1-0.jpg
opera-1-1-1.jpg opera-1-1-2.jpg opera-2-0-0.jpg
opera-2-0-1.jpg opera-3-0-0.jpg
sources/org/apache/batik/extension/svg
MultiResGraphicsNode.java
Removed: sources/org/apache/batik/extension/svg/renderable
MultiResRable.java
Log:
1) multiImage element can now reference svg as well as raster files.
2) New example that shows the functionality.
Revision Changes Path
1.12 +2 -2 xml-batik/resources/org/apache/batik/apps/rasterizer/resources/Messages.properties
Index: Messages.properties
===================================================================
RCS file: /home/cvs/xml-batik/resources/org/apache/batik/apps/rasterizer/resources/Messages.properties,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Messages.properties 18 Sep 2002 09:23:11 -0000 1.11
+++ Messages.properties 3 Oct 2002 18:57:13 -0000 1.12
@@ -98,7 +98,7 @@
-q <quality> \n \
\tQuality for the output image. This is only relevant for the \n \
\timage/jpeg mime type. \n \
- -indexed [2|4|8]\n \
+ -indexed (1|2|4|8)\n \
\tReduces the image to given number of bits per pixel using an\n \
\tadaptive pallete, resulting in an Indexed image. This is\n \
\tcurrently only supported for PNG conversion.\n \
@@ -201,7 +201,7 @@
Default: 0.99
Main.cl.option.indexed.description = \
--indexed [2|4|8] indicates that the image should be reduced to the given number of bits per pixel using an adaptive pallete, resulting in an Indexed image. This is currently only supported for PNG conversion.\n \
+-indexed (1|2|4|8) indicates that the image should be reduced to the given number of bits per pixel using an adaptive pallete, resulting in an Indexed image. This is currently only supported for PNG conversion.\n \
Example: -indexed 8 \n \
Default: none
1.3 +4 -2 xml-batik/samples/extensions/multi.svg
Index: multi.svg
===================================================================
RCS file: /home/cvs/xml-batik/samples/extensions/multi.svg,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- multi.svg 20 Feb 2002 13:27:10 -0000 1.2
+++ multi.svg 3 Oct 2002 18:57:13 -0000 1.3
@@ -19,8 +19,10 @@
<!-- <?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"
+<svg width="450" height="500" xml:space="preserve"
viewBox="0 0 450 500"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:batikExt="http://xml.apache.org/batik/ext">
<title>MultiImage Extension Tag</title>
1.1 xml-batik/samples/extensions/multi2.svg
Index: multi2.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. -->
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<!-- regularPoly extension tag test -->
<!-- -->
<!-- @author Thomas.DeWeese@Kodak.com -->
<!-- @version $Id: multi2.svg,v 1.1 2002/10/03 18:57:13 deweese Exp $ -->
<!-- ====================================================================== -->
<!-- <?xml-stylesheet type="text/css" href="extension.css" ?> -->
<svg width="450" height="500" xml:space="preserve"
viewBox="0 0 450 500"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:batikExt="http://xml.apache.org/batik/ext">
<title>MultiImage Extension Tag</title>
<!-- ============================================================= -->
<!-- Test content -->
<!-- ============================================================= -->
<g id="testContent" class="legend" style="text-anchor:middle">
<text x="225" y="40" class="title">MultiImage Extension Tag</text>
<image x="10" y="50" width="270" height="405"
xlink:href="opera/opera-3-0-0.svg"/>
<image x="300" y="50" width="135" height="202.5"
xlink:href="opera/opera-3-0-0.svg"/>
<image x="300" y="277" width="67.5" height="101.25"
xlink:href="opera/opera-3-0-0.svg"/>
</g>
<!-- ============================================================= -->
<!-- Batik sample mark -->
<!-- ============================================================= -->
<use xlink:href="../batikLogo.svg#Batik_Tag_Box" />
</svg>
1.1 xml-batik/samples/extensions/opera/opera-0-0-0.svg
Index: opera-0-0-0.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">
<svg width="360" height="360" viewBox="0 0 360 360"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:batikExt="http://xml.apache.org/batik/ext">
<image x="0" y="0" width="180" height="180"
xlink:href="multires/opera-0-0-0.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="0" y="0" width="180" height="180"/>
<image x="180" y="0" width="180" height="180"
xlink:href="multires/opera-0-1-0.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="180" y="0" width="180" height="180"/>
<image x="0" y="180" width="180" height="180"
xlink:href="multires/opera-0-0-1.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="0" y="180" width="180" height="180"/>
<image x="180" y="180" width="180" height="180"
xlink:href="multires/opera-0-1-1.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="180" y="180" width="180" height="180"/>
</svg>
1.1 xml-batik/samples/extensions/opera/opera-0-0-2.svg
Index: opera-0-0-2.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">
<svg width="360" height="360" viewBox="0 0 360 360"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:batikExt="http://xml.apache.org/batik/ext">
<image x="0" y="0" width="180" height="180"
xlink:href="multires/opera-0-0-2.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="0" y="0" width="180" height="180"/>
<image x="180" y="0" width="180" height="180"
xlink:href="multires/opera-0-1-2.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="180" y="0" width="180" height="180"/>
<image x="0" y="180" width="180" height="180"
xlink:href="multires/opera-0-0-3.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="0" y="180" width="180" height="180"/>
<image x="180" y="180" width="180" height="180"
xlink:href="multires/opera-0-1-3.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="180" y="180" width="180" height="180"/>
</svg>
1.1 xml-batik/samples/extensions/opera/opera-0-0-4.svg
Index: opera-0-0-4.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">
<svg width="360" height="360" viewBox="0 0 360 360"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:batikExt="http://xml.apache.org/batik/ext">
<image x="0" y="0" width="180" height="180"
xlink:href="multires/opera-0-0-4.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="0" y="0" width="180" height="180"/>
<image x="180" y="0" width="180" height="180"
xlink:href="multires/opera-0-1-4.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="180" y="0" width="180" height="180"/>
<image x="0" y="180" width="180" height="180"
xlink:href="multires/opera-0-0-5.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="0" y="180" width="180" height="180"/>
<image x="180" y="180" width="180" height="180"
xlink:href="multires/opera-0-1-5.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="180" y="180" width="180" height="180"/>
</svg>
1.1 xml-batik/samples/extensions/opera/opera-0-2-0.svg
Index: opera-0-2-0.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">
<svg width="360" height="360" viewBox="0 0 360 360"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:batikExt="http://xml.apache.org/batik/ext">
<image x="0" y="0" width="180" height="180"
xlink:href="multires/opera-0-2-0.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="0" y="0" width="180" height="180"/>
<image x="180" y="0" width="180" height="180"
xlink:href="multires/opera-0-3-0.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="180" y="0" width="180" height="180"/>
<image x="0" y="180" width="180" height="180"
xlink:href="multires/opera-0-2-1.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="0" y="180" width="180" height="180"/>
<image x="180" y="180" width="180" height="180"
xlink:href="multires/opera-0-3-1.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="180" y="180" width="180" height="180"/>
</svg>
1.1 xml-batik/samples/extensions/opera/opera-0-2-2.svg
Index: opera-0-2-2.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">
<svg width="360" height="360" viewBox="0 0 360 360"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:batikExt="http://xml.apache.org/batik/ext">
<image x="0" y="0" width="180" height="180"
xlink:href="multires/opera-0-2-2.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="0" y="0" width="180" height="180"/>
<image x="180" y="0" width="180" height="180"
xlink:href="multires/opera-0-3-2.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="180" y="0" width="180" height="180"/>
<image x="0" y="180" width="180" height="180"
xlink:href="multires/opera-0-2-3.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="0" y="180" width="180" height="180"/>
<image x="180" y="180" width="180" height="180"
xlink:href="multires/opera-0-3-3.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="180" y="180" width="180" height="180"/>
</svg>
1.1 xml-batik/samples/extensions/opera/opera-0-2-4.svg
Index: opera-0-2-4.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">
<svg width="360" height="360" viewBox="0 0 360 360"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:batikExt="http://xml.apache.org/batik/ext">
<image x="0" y="0" width="180" height="180"
xlink:href="multires/opera-0-2-4.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="0" y="0" width="180" height="180"/>
<image x="180" y="0" width="180" height="180"
xlink:href="multires/opera-0-3-4.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="180" y="0" width="180" height="180"/>
<image x="0" y="180" width="180" height="180"
xlink:href="multires/opera-0-2-5.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="0" y="180" width="180" height="180"/>
<image x="180" y="180" width="180" height="180"
xlink:href="multires/opera-0-3-5.jpg" />
<rect class="overlay" fill="none" stroke="#F00" stroke-width="4" x="180" y="180" width="180" height="180"/>
</svg>
1.1 xml-batik/samples/extensions/opera/opera-1-0-0.svg
Index: opera-1-0-0.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">
<svg width="360" height="360" viewBox="0 0 360 360"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:batikExt="http://xml.apache.org/batik/ext">
<batikExt:multiImage x="0" y="0" width="180" height="180"
xlink:href="multires/opera-1-0-0.jpg"
pixel-width="180" pixel-height="180">
<batikExt:subImage xlink:href="opera-0-0-0.svg"
pixel-width="360" pixel-height="360"/>
</batikExt:multiImage>
<rect class="overlay" fill="none" stroke="#FF0" stroke-width="4" x="0" y="0" width="180" height="180"/>
<batikExt:multiImage x="180" y="0" width="180" height="180"
xlink:href="multires/opera-1-1-0.jpg"
pixel-width="180" pixel-height="180">
<batikExt:subImage xlink:href="opera-0-2-0.svg"
pixel-width="360" pixel-height="360"/>
</batikExt:multiImage>
<rect class="overlay" fill="none" stroke="#FF0" stroke-width="4" x="180" y="0" width="180" height="180"/>
<batikExt:multiImage x="0" y="180" width="180" height="180"
xlink:href="multires/opera-1-0-1.jpg"
pixel-width="180" pixel-height="180">
<batikExt:subImage xlink:href="opera-0-0-2.svg"
pixel-width="360" pixel-height="360"/>
</batikExt:multiImage>
<rect class="overlay" fill="none" stroke="#FF0" stroke-width="4" x="0" y="180" width="180" height="180"/>
<batikExt:multiImage x="180" y="180" width="180" height="180"
xlink:href="multires/opera-1-1-1.jpg"
pixel-width="180" pixel-height="180">
<batikExt:subImage xlink:href="opera-0-2-2.svg"
pixel-width="360" pixel-height="360"/>
</batikExt:multiImage>
<rect class="overlay" fill="none" stroke="#FF0" stroke-width="4" x="180" y="180" width="180" height="180"/>
</svg>
1.1 xml-batik/samples/extensions/opera/opera-1-0-2.svg
Index: opera-1-0-2.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">
<svg width="360" height="180" viewBox="0 0 360 180"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:batikExt="http://xml.apache.org/batik/ext">
<batikExt:multiImage x="0" y="0" width="180" height="180"
xlink:href="multires/opera-1-0-2.jpg"
pixel-width="180" pixel-height="180">
<batikExt:subImage xlink:href="opera-0-0-4.svg"
pixel-width="360" pixel-height="360"/>
</batikExt:multiImage>
<rect class="overlay" fill="none" stroke="#FF0" stroke-width="4" x="0" y="0" width="180" height="180"/>
<batikExt:multiImage x="180" y="0" width="180" height="180"
xlink:href="multires/opera-1-1-2.jpg"
pixel-width="180" pixel-height="180">
<batikExt:subImage xlink:href="opera-0-2-4.svg"
pixel-width="360" pixel-height="360"/>
</batikExt:multiImage>
<rect class="overlay" fill="none" stroke="#FF0" stroke-width="4" x="180" y="0" width="180" height="180"/>
</svg>
1.1 xml-batik/samples/extensions/opera/opera-2-0-0.svg
Index: opera-2-0-0.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">
<svg width="180" height="270" viewBox="0 0 180 270"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:batikExt="http://xml.apache.org/batik/ext">
<batikExt:multiImage x="0" y="0" width="180" height="180"
xlink:href="multires/opera-2-0-0.jpg"
pixel-width="180" pixel-height="180">
<batikExt:subImage xlink:href="opera-1-0-0.svg"
pixel-width="360" pixel-height="360"/>
</batikExt:multiImage>
<rect class="overlay" fill="none" stroke="#0F0" stroke-width="4" x="0" y="0" width="180" height="180"/>
<batikExt:multiImage x="0" y="180" width="180" height="90"
xlink:href="multires/opera-2-0-1.jpg"
pixel-width="180" pixel-height="90">
<batikExt:subImage xlink:href="opera-1-0-2.svg"
pixel-width="360" pixel-height="180"/>
</batikExt:multiImage>
<rect class="overlay" fill="none" stroke="#0F0" stroke-width="4" x="0" y="180" width="180" height="90"/>
</svg>
1.1 xml-batik/samples/extensions/opera/opera-3-0-0.svg
Index: opera-3-0-0.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">
<svg width="90" height="135" viewBox="0 0 90 135"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:batikExt="http://xml.apache.org/batik/ext">
<batikExt:multiImage x="0" y="0" width="90" height="135"
xlink:href="multires/opera-3-0-0.jpg"
pixel-width="90" pixel-height="135">
<batikExt:subImage xlink:href="opera-2-0-0.svg"
pixel-width="180" pixel-height="270"/>
</batikExt:multiImage>
<rect class="overlay" fill="none" stroke="#00F" stroke-width="4" x="0" y="0" width="90" height="135"/>
</svg>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-0-0.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-0-1.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-0-2.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-0-3.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-0-4.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-0-5.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-1-0.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-1-1.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-1-2.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-1-3.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-1-4.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-1-5.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-2-0.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-2-1.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-2-2.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-2-3.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-2-4.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-2-5.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-3-0.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-3-1.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-3-2.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-3-3.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-3-4.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-0-3-5.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-1-0-0.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-1-0-1.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-1-0-2.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-1-1-0.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-1-1-1.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-1-1-2.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-2-0-0.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-2-0-1.jpg
<<Binary file>>
1.1 xml-batik/samples/extensions/opera/multires/opera-3-0-0.jpg
<<Binary file>>
1.8 +1 -1 xml-batik/sources/org/apache/batik/bridge/SVGBrokenLinkProvider.java
Index: SVGBrokenLinkProvider.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGBrokenLinkProvider.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SVGBrokenLinkProvider.java 19 Sep 2001 12:11:50 -0000 1.7
+++ SVGBrokenLinkProvider.java 3 Oct 2002 18:57:15 -0000 1.8
@@ -39,7 +39,7 @@
extends DefaultBrokenLinkProvider
implements ErrorConstants {
- final static String SVG_BROKEN_LINK_DOCUMENT_PROPERTY =
+ public final static String SVG_BROKEN_LINK_DOCUMENT_PROPERTY =
"org.apache.batik.bridge.BrokenLinkDocument";
UserAgent userAgent;
1.6 +19 -32 xml-batik/sources/org/apache/batik/extension/svg/BatikMultiImageElementBridge.java
Index: BatikMultiImageElementBridge.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/extension/svg/BatikMultiImageElementBridge.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- BatikMultiImageElementBridge.java 13 Aug 2002 21:33:16 -0000 1.5
+++ BatikMultiImageElementBridge.java 3 Oct 2002 18:57:15 -0000 1.6
@@ -33,13 +33,9 @@
import org.apache.batik.dom.util.XLinkSupport;
-import org.apache.batik.ext.awt.image.renderable.Filter;
-
-import org.apache.batik.extension.svg.renderable.MultiResRable;
-
import org.apache.batik.gvt.GraphicsNode;
import org.apache.batik.gvt.ImageNode;
-import org.apache.batik.gvt.RasterImageNode;
+import org.apache.batik.gvt.CompositeGraphicsNode;
import org.apache.batik.util.ParsedURL;
@@ -105,18 +101,10 @@
return null;
}
- ImageNode imageNode = (ImageNode)instantiateGraphicsNode();
-
- // 'transform'
- String s = e.getAttributeNS(null, SVG_TRANSFORM_ATTRIBUTE);
- if (s.length() != 0) {
- imageNode.setTransform
- (SVGUtilities.convertTransform(e, SVG_TRANSFORM_ATTRIBUTE, s));
+ ImageNode imgNode = (ImageNode)super.createGraphicsNode(ctx, e);
+ if (imgNode == null) {
+ return null;
}
- // 'visibility'
- imageNode.setVisible(CSSUtilities.convertVisibility(e));
-
- RasterImageNode node = new RasterImageNode();
List dims = new LinkedList();
List uris = new LinkedList();
@@ -154,23 +142,22 @@
n++;
}
- Filter f = new MultiResRable(uary, dary);
+ Rectangle2D b = getImageBounds(ctx, e);
+
+ GraphicsNode node = new MultiResGraphicsNode(e, b, uary, dary);
+
+ // 'transform'
+ String s = e.getAttributeNS(null, SVG_TRANSFORM_ATTRIBUTE);
+ if (s.length() != 0) {
+ node.setTransform
+ (SVGUtilities.convertTransform(e, SVG_TRANSFORM_ATTRIBUTE, s));
+ }
+ // 'visibility'
+ node.setVisible(CSSUtilities.convertVisibility(e));
- Rectangle2D imgB, b;
- imgB = f.getBounds2D();
- b = getImageBounds(ctx, e);
-
- node.setImage(f);
-
- float []vb = new float[4];
- vb[0] = 0;
- vb[1] = 0;
- vb[2] = (float)imgB.getWidth();
- vb[3] = (float)imgB.getHeight();
- initializeViewport(ctx, e, node, vb, b);
+ imgNode.setImage(node);
- imageNode.setImage(node);
- return imageNode;
+ return imgNode;
}
protected void addInfo(Element e, Collection dims, Collection uris) {
1.1 xml-batik/sources/org/apache/batik/extension/svg/MultiResGraphicsNode.java
Index: MultiResGraphicsNode.java
===================================================================
/*****************************************************************************
* 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. *
*****************************************************************************/
package org.apache.batik.extension.svg;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.awt.image.RenderedImage;
import java.awt.image.renderable.RenderContext;
import java.lang.ref.SoftReference;
import org.apache.batik.ext.awt.image.spi.ImageTagRegistry;
import org.apache.batik.ext.awt.image.renderable.Filter;
import org.apache.batik.ext.awt.image.renderable.AbstractRable;
import org.apache.batik.ext.awt.image.renderable.ClipRable8Bit;
import org.apache.batik.util.ParsedURL;
import org.w3c.dom.Element;
import org.w3c.dom.events.Event;
import org.w3c.dom.events.EventListener;
import org.w3c.dom.events.EventTarget;
import org.w3c.dom.events.MouseEvent;
import org.w3c.dom.events.MutationEvent;
import org.w3c.dom.events.DocumentEvent;
import org.w3c.dom.svg.SVGDocument;
import org.w3c.dom.svg.SVGSVGElement;
import org.apache.batik.util.SVGConstants;
import org.apache.batik.bridge.BridgeException;
import org.apache.batik.bridge.SVGBrokenLinkProvider;
import org.apache.batik.bridge.GVTBuilder;
import org.apache.batik.bridge.UnitProcessor;
import org.apache.batik.bridge.UserAgent;
import org.apache.batik.bridge.DocumentLoader;
import org.apache.batik.bridge.BridgeContext;
import org.apache.batik.bridge.UserAgentAdapter;
import org.apache.batik.bridge.CSSUtilities;
import org.apache.batik.bridge.ViewBox;
import org.apache.batik.gvt.GraphicsNode;
import org.apache.batik.gvt.CompositeGraphicsNode;
import org.apache.batik.gvt.RasterImageNode;
import org.apache.batik.gvt.AbstractGraphicsNode;
/**
* RasterRable This is used to wrap a Rendered Image back into the
* RenderableImage world.
*
* @author <a href="mailto:Thomas.DeWeese@Kodak.com>Thomas DeWeese</a>
* @version $Id: MultiResGraphicsNode.java,v 1.1 2002/10/03 18:57:15 deweese Exp $
*/
public class MultiResGraphicsNode
extends AbstractGraphicsNode implements SVGConstants {
SoftReference [] srcs;
ParsedURL [] srcURLs;
Dimension [] sizes;
Rectangle2D bounds;
GraphicsNode lastSrc;
UserAgent userAgent;
DocumentLoader loader;
BridgeContext ctx;
Element multiImgElem;
/**
* The error code when a required attribute is missing.
* {0} = the name of the attribute
*/
public static final String ERR_ATTRIBUTE_MISSING
= "attribute.missing";
public MultiResGraphicsNode(Element multiImgElem,
Rectangle2D bounds,
ParsedURL []srcURLs,
Dimension [] sizes) {
this.multiImgElem = multiImgElem;
this.srcURLs = new ParsedURL[srcURLs.length];
this.sizes = new Dimension[srcURLs.length];
for (int i=0; i<srcURLs.length; i++) {
this.srcURLs[i] = srcURLs[i];
if (i < sizes.length)
this.sizes[i] = sizes[i];
// System.out.println("Sz: " + this.sizes[i]);
// System.out.println("URL: " + this.srcURLs[i]);
}
this.srcs = new SoftReference[srcURLs.length];
this.bounds = bounds;
userAgent = new UserAgentAdapter();
loader = new DocumentLoader(userAgent);
ctx = new BridgeContext(userAgent, loader);
}
/**
* Paints this node without applying Filter, Mask, Composite, and clip.
*
* @param g2d the Graphics2D to use
*/
public void primitivePaint(Graphics2D g2d) {
// System.out.println("PrimPaint: " + this);
// get the current affine transform
AffineTransform at = g2d.getTransform();
double scx = Math.sqrt(at.getShearX()*at.getShearX()+
at.getScaleX()*at.getScaleX());
// System.out.println("SCX: " + scx);
GraphicsNode gn = null;
int idx =-1;
double w = bounds.getWidth()*scx;
for (int i=1; i<sizes.length; i++) {
if (w > sizes[i].width) {
idx = i-1;
break;
}
}
if (idx == -1)
idx = srcURLs.length-1;
gn = getGraphicsNode(idx);
// System.out.println("GN Idx: " + idx);
if (gn == null) return;
Rectangle2D gnBounds = gn.getBounds();
double sx = bounds.getWidth()/sizes[idx].getWidth();
double sy = bounds.getHeight()/sizes[idx].getHeight();
// System.out.println("Scale: [" + sx + ", " + sy + "]");
// g2d.scale(sx, sy);
gn.paint(g2d);
}
/**
* Returns the bounds of the area covered by this node's primitive paint.
*/
public Rectangle2D getPrimitiveBounds() {
return bounds;
}
public Rectangle2D getGeometryBounds(){
return bounds;
}
/**
* Returns the outline of this node.
*/
public Shape getOutline() {
return bounds;
}
public GraphicsNode getGraphicsNode(int idx) {
// System.out.println("Getting: " + idx);
if (srcs[idx] != null) {
Object o = srcs[idx].get();
if (o != null)
return (GraphicsNode)o;
}
try {
SVGDocument svgDoc = (SVGDocument)loader.loadDocument
(srcURLs[idx].toString());
GraphicsNode gn;
gn = createSVGImageNode(ctx, multiImgElem, svgDoc);
lastSrc = gn;
srcs[idx] = new SoftReference(gn);
return gn;
} catch (Exception ex) { /* ex.printStackTrace(); */ }
try {
GraphicsNode gn;
gn = createRasterImageNode(ctx, multiImgElem, srcURLs[idx]);
srcs[idx] = new SoftReference(gn);
lastSrc = gn;
return gn;
} catch (Exception ex) { /* ex.printStackTrace(); */ }
return null;
}
/**
* Returns a GraphicsNode that represents an raster image in JPEG or PNG
* format.
*
* @param ctx the bridge context
* @param e the image element
* @param uriStr the uri of the image
*/
protected static GraphicsNode createRasterImageNode(BridgeContext ctx,
Element e,
ParsedURL purl) {
RasterImageNode node = new RasterImageNode();
ImageTagRegistry reg = ImageTagRegistry.getRegistry();
Filter img = reg.readURL(purl);
Object obj = img.getProperty
(SVGBrokenLinkProvider.SVG_BROKEN_LINK_DOCUMENT_PROPERTY);
if ((obj != null) && (obj instanceof SVGDocument)) {
// Ok so we are dealing with a broken link.
return createSVGImageNode(ctx, e, (SVGDocument)obj);
}
node.setImage(img);
Rectangle2D imgBounds = img.getBounds2D();
Rectangle2D bounds = getImageBounds(ctx, e);
// create the implicit viewBox for the raster image. The viewBox for a
// raster image is the size of the image
float [] vb = new float[4];
vb[0] = 0; // x
vb[1] = 0; // y
vb[2] = (float)imgBounds.getWidth(); // width
vb[3] = (float)imgBounds.getHeight(); // height
// System.out.println("Bounds: " + bounds);
// System.out.println("ImgB: " + imgBounds);
// handles the 'preserveAspectRatio', 'overflow' and 'clip' and sets the
// appropriate AffineTransform to the image node
initializeViewport(ctx, e, node, vb, bounds);
return node;
}
/**
* Returns a GraphicsNode that represents a svg document as an image.
*
* @param ctx the bridge context
* @param e the image element
* @param imgDocument the SVG document that represents the image
*/
protected static GraphicsNode createSVGImageNode(BridgeContext ctx,
Element e,
SVGDocument imgDocument) {
CompositeGraphicsNode result = new CompositeGraphicsNode();
Rectangle2D r = CSSUtilities.convertEnableBackground(e);
if (r != null) {
result.setBackgroundEnable(r);
}
SVGSVGElement svgElement = imgDocument.getRootElement();
GVTBuilder builder = new GVTBuilder();
GraphicsNode node = builder.build(ctx, svgElement);
// HACK: remove the clip set by the SVGSVGElement as the overflow
// and clip properties must be ignored. The clip will be set later
// using the overflow and clip of the <image> element.
node.setClip(null);
result.getChildren().add(node);
// create the implicit viewBox for the SVG image. The viewBox for a
// SVG image is the viewBox of the outermost SVG element of the SVG file
String viewBox =
svgElement.getAttributeNS(null, SVG_VIEW_BOX_ATTRIBUTE);
float [] vb = ViewBox.parseViewBoxAttribute(e, viewBox);
// handles the 'preserveAspectRatio', 'overflow' and 'clip' and sets the
// appropriate AffineTransform to the image node
Rectangle2D bounds = getImageBounds(ctx, e);
// System.out.println("Bounds: " + bounds);
// System.out.println("ViewBox: " + viewBox);
initializeViewport(ctx, e, result, vb, bounds);
return result;
}
/**
* Initializes according to the specified element, the specified graphics
* node with the specified bounds. This method takes into account the
* 'viewBox', 'preserveAspectRatio', and 'clip' properties. According to
* those properties, a AffineTransform and a clip is set.
*
* @param ctx the bridge context
* @param e the image element that defines the properties
* @param node the graphics node
* @param vb the implicit viewBox definition
* @param bounds the bounds of the image element
*/
protected static void initializeViewport(BridgeContext ctx,
Element e,
GraphicsNode node,
float [] vb,
Rectangle2D bounds) {
float x = (float)bounds.getX();
float y = (float)bounds.getY();
float w = (float)bounds.getWidth();
float h = (float)bounds.getHeight();
AffineTransform at
= ViewBox.getPreserveAspectRatioTransform(e, vb, w, h);
at.preConcatenate(AffineTransform.getTranslateInstance(x, y));
node.setTransform(at);
// 'overflow' and 'clip'
Shape clip = null;
if (CSSUtilities.convertOverflow(e)) { // overflow:hidden
float [] offsets = CSSUtilities.convertClip(e);
if (offsets == null) { // clip:auto
clip = new Rectangle2D.Float(x, y, w, h);
} else { // clip:rect(<x> <y> <w> <h>)
// offsets[0] = top
// offsets[1] = right
// offsets[2] = bottom
// offsets[3] = left
clip = new Rectangle2D.Float(x+offsets[3],
y+offsets[0],
w-offsets[1]-offsets[3],
h-offsets[2]-offsets[0]);
}
}
if (clip != null) {
try {
at = at.createInverse(); // clip in user space
Filter filter = node.getGraphicsNodeRable(true);
clip = at.createTransformedShape(clip);
node.setClip(new ClipRable8Bit(filter, clip));
} catch (java.awt.geom.NoninvertibleTransformException ex) {}
}
}
/**
* Returns the bounds of the specified image element.
*
* @param ctx the bridge context
* @param element the image element
*/
protected static
Rectangle2D getImageBounds(BridgeContext ctx, Element element) {
UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, element);
// 'x' attribute - default is 0
String s = element.getAttributeNS(null, SVG_X_ATTRIBUTE);
float x = 0;
if (s.length() != 0) {
x = UnitProcessor.svgHorizontalCoordinateToUserSpace
(s, SVG_X_ATTRIBUTE, uctx);
}
// 'y' attribute - default is 0
s = element.getAttributeNS(null, SVG_Y_ATTRIBUTE);
float y = 0;
if (s.length() != 0) {
y = UnitProcessor.svgVerticalCoordinateToUserSpace
(s, SVG_Y_ATTRIBUTE, uctx);
}
// 'width' attribute - required
s = element.getAttributeNS(null, SVG_WIDTH_ATTRIBUTE);
float w;
if (s.length() == 0) {
throw new BridgeException(element, ERR_ATTRIBUTE_MISSING,
new Object[] {SVG_WIDTH_ATTRIBUTE});
} else {
w = UnitProcessor.svgHorizontalLengthToUserSpace
(s, SVG_WIDTH_ATTRIBUTE, uctx);
}
// 'height' attribute - required
s = element.getAttributeNS(null, SVG_HEIGHT_ATTRIBUTE);
float h;
if (s.length() == 0) {
throw new BridgeException(element, ERR_ATTRIBUTE_MISSING,
new Object[] {SVG_HEIGHT_ATTRIBUTE});
} else {
h = UnitProcessor.svgVerticalLengthToUserSpace
(s, SVG_HEIGHT_ATTRIBUTE, uctx);
}
return new Rectangle2D.Float(x, y, w, h);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org