> > Batik's ImageTranscoder seems to ignore imported styles.
> >
> > @import url("../default.css");
> >
> > Is this not supported? The styles defined there are not visible AFAICS.
>
> Hi Ralf,
>
> I believe it is. Can you provide a reproducable test case?
Yep, here we go:
______________________________________________________________________
[ CSSImportDemo.svg ]
______________________________________________________________________
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
<!ENTITY ns_svg "http://www.w3.org/2000/svg">
<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
]>
<!-- external CSS -->
<?xml-stylesheet type="text/css" href="styleB.css" ?>
<svg xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="310" height="540"
xml:space="preserve">
<rect x="10" y="10" width="100" height="20" />
<circle cx="50" cy="50" r="20" />
</svg>
______________________________________________________________________
[ styleA.css ]
______________________________________________________________________
circle {
fill:#0000FF;
}
______________________________________________________________________
[ styleB.css ]
______________________________________________________________________
@import url("styleA.css");
rect {
fill:#FF0000;
}
______________________________________________________________________
[ CSSImportDemo.java ] (taken from Batik's site)
______________________________________________________________________
import java.io.*;
import org.apache.batik.transcoder.image.JPEGTranscoder;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
public class CSSImportDemo {
public static void main(String[] args) throws Exception {
// create a JPEG transcoder
JPEGTranscoder t = new JPEGTranscoder();
// set the transcoding hints
t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(.8));
// create the transcoder input
String svgURI = new File("CSSImportDemo.svg").toURL().toString();
TranscoderInput input = new TranscoderInput(svgURI);
// create the transcoder output
OutputStream ostream = new FileOutputStream("out.jpg");
TranscoderOutput output = new TranscoderOutput(ostream);
// save the image
t.transcode(input, output);
// flush and close the stream then exit
ostream.flush();
ostream.close();
System.exit(0);
}
}
______________________________________________________________________
The rect appears "red" as expected, whereas the circle should glow
"blue" - but it doesn't.
Thanks.
ralf ...
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]