Hi,
I use JSVGComponent in my program to display several pages of svg content.
I have noticed that svg content included in these pages using the <image>
element sometimes gets replaced by the broken link document when switching
quickly between pages. I can reproduce the problem in squiggle (1.6 release
or trunk) as follows:
1. Load any svg document that references another svg file using <image>,
for example samples/tests/spec/structure/image.svg
2. Hit ^R repetitively as fast as you can. After five to ten seconds of
this the referenced svg image is replaced by the broken link image.
It can be a bit tricky to get this to happen - it might occur more readily
in my program because I have multiple JSVGComponents visible, the documents
contain multiple references to the same svg image, and I am running it on a
1.6 GHz processor, which I guess is relatively slow.
A (far from ideal) workaround is to override stopProcessing() as below to
avoid halting the GVTTreeBuilder. In SAXDocumentFactory.startElement(), if
the thread is halted an InterruptedIOException is thrown, which will be
ignored in SVGImageElementBridge.createImageGraphicsNode(), and the broken
link image will get put into the cache. That's my theory anyway!
Regards,
Steve Drake
public void stopProcessing() {
nextDocumentLoader = null;
nextGVTTreeBuilder = null;
if (documentLoader != null) {
documentLoader.halt();
}
//if (gvtTreeBuilder != null) {
// gvtTreeBuilder.halt();
//}
if (svgLoadEventDispatcher != null) {
svgLoadEventDispatcher.halt();
}
if (nextUpdateManager != null) {
nextUpdateManager.interrupt();
nextUpdateManager = null;
}
if (updateManager != null) {
updateManager.interrupt();
}
if (gvtTreeRenderer != null) {
needRender = false;
gvtTreeRenderer.halt();
// can't call private method
AbstractJGVTComponent.haltProgressivePaintThread();
setProgressivePaint(!getProgressivePaint());
setProgressivePaint(!getProgressivePaint());
}
}
--
View this message in context:
http://www.nabble.com/svg-content-included-using-%3Cimage%3E-replaced-by-broken-link-document-tf2773910.html#a7737763
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]