Hi Peter,
Peter Wagener <[EMAIL PROTECTED]> wrote on 03/04/2006 01:36:00
AM:
> >> Also, a more recent test of this technique was throwing
> >> BridgeException's at seemingly random times on one of the
> >> many the 'appendChild' calls.
> On Mar 2, 2006, at 9:11 PM, [EMAIL PROTECTED] wrote:
> > What sort of bridge exception? Out of Memory?
>
> It's complaining about a CSS property on a <g> element being
> invalid. Here's the top of the stack trace:
>
> org.apache.batik.bridge.BridgeException:
> file:/C:/temp/trident7-classes/com/W7Optics/AppClient/LMSView/shelf/
> drawing/T7Chassis.svg:0
> The URI "file:/C:/temp/trident7-classes/com/W7Optics/AppClient/
> LMSView/shelf/drawing/T7Chassis.svg#XMLID_1_"
> for a CSS property found on the element <g> is invalid
> at org.apache.batik.bridge.CSSUtilities.convertMask(Unknown Source)
It looks like something is 'missing' from the Document. My
guess from what I know is that you are copying a subtree from
one document and appending it to another. In the subtree you
are copying is something like:
mask="url(#XMLID_1_)"
Somewhere else in that source document is a mask element with
id="XMLID_1_". For your copy/append to work you would have to
also copy the elements the subtree references or potentially use
xml:base to redirect URL references back to the originating doc.
Given your situation you might look into using the 'use' element
from SVG, or an 'image' element referencing an SVG file.
> Just for kicks, I ran the Batik Rasterizer app on a few of the SVG
> files with the "-validate" flag; it wasn't too happy with them, so
> apparently they're not strict SVG.
From Illustrator they won't be "clean", but that doesn't mean they
are really bad. Illustrator is pretty good about putting it's stuff
in a private namespace. This won't validate against the DTD but _is_
legal SVG (basically DTD isn't powerful enough to really capture the
rules).
> Because of the exception I was seeing above, I wasn't sure if the
> 'appendChild' method above was the best way to handle the situation.
> I figured if I could just overlay the SVG versus combining it, maybe
> I'd limit my issues.
If you can use the 'use' or 'image' element to pull in the external
reference that is probably better than the appendChild approach.
> > I would look at simplifying the graphics I have a hard
> > time understanding why these elements would need to be so
> > detailed...
>
> Yeah, I suppose they really don't need to be. But getting that point
> across to the graphic designers might be tough.
It might be, but I would suggest that they go for a 'minimalist'
approach rather than 'photo-realistic'. A few simple gradients, simple
line art, etc...
> How about this for an alternative:
>
> 1. Convert all the SVG's to PNG files
> 2. Add them to a document as <image> elements
This is certainly a viable alternative.
> 3. Register an UpdateManagerListener whose job is to change the size
> of the images on the fly.
Why are you changing the size of the image elements? The
SVG engine will resize the images as needed for display.
> Would that work? What would be the best way to scale the image
> elements appropriately?
Just like everything else in SVG the image element will keep
it's size relative to everything else as you zoom in/out. At some
point the graphic may turn pixilated. You can either live with this
or you might choose to use the 'multiImage' element which allows
you to reference multiple versions of the 'image' to use at
different magnifications (the highest level could be a reference
to an SVG file for example), take a look at
samples/tests/spec12/structure/multi.svg
> It feels like a hack, and it does kinda beg the question of why I'd
> use Batik in the first place. But the ability to move the image and
> scale it is a big hit with any users that see it.
From your application point of view it shouldn't make much of a
difference if the content is SVG or raster images, it's just that
with raster images you need to manage the resolution issue (remember
that you could limit the zoom in, for your application so you don't
have to go overboard with the size of the images).
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]