Re: text-anchor: middle bug?

2011-06-25 Thread Cameron McCormack
Cameron McCormack:
 I’m just downloading an earlier 1.6 JRE to verify.

So it looks to me that the bug shows up with 1.6.0_24 but not with
1.6.0_23.  Unfortunately I don’t have the time at the moment to track
down whether there Batik is incorrectly using the AWT font/text stuff
when text-anchor is in use, or whether it is a bug in the JRE.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: Converting Font to SVG: all glyphs are rotated

2011-06-21 Thread Cameron McCormack
Dieter:
 yep...I meant flipped vertically or rotated 180 and flipped horizontally ;)
 
 Do you have a link where it is described that SVG coordinates are
 upside down wrt cartesian and the reasons why this was done?

Also note that inside glyphs, the coordinate system has (0,0) at the
bottom left of the glyph cell, whereas in normal SVG content, (0,0) is
at the top left.  So if you are copying path data out of glyph d=
you will need to apply a scale(1,-1) transform to it to flip it.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: Batik PDF 'rasterizer' rasterizes objects under the mask

2011-05-29 Thread Cameron McCormack
Hi Jan.

Jan Tosovsky:
 I rely on mask in my SVG image (simplified test case enclosed) but when it
 is later converted into the PDF format, all the objects underneath that mask
 are rasterized. Although the final quality can be set via the dpi attribute,
 I would prefer vector nature of these objects (btw, it drastically reduces
 the final file size). Is there any option or approach to avoid this
 rasterizing? Or is this behaviour by design?
 
 I use Batik 1.7. Actually I need it for FOP, but it uses Batik for SVG
 processing I think.

I am not knowledgeable about PDF, but my understanding was that the type
of effects that masks can have cannot be represented in PDF itself and
therefore have to be rasterised.  I see that your example actually uses
a mask that is either fully on or fully off at every point.  If that is
representative of your actual uses of masks, you could replace that with
a clipPath, which shouldn’t cause the content to be rasterised.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: font size question

2011-04-17 Thread Cameron McCormack
Hi Christian.

Christian Convey:
 A few months ago I found that Firefox and Chromium were rendering my
 Batik-generated SVG files differently.  Someone on this list kindly
 pointed out the problem: My font size (in the .svg file) was listed as
 10, not 10px.  (See example below.)
 
 Any suggestions for what I do in Java to make the px suffix appear
 in my svg file's font size(s)?

This is https://issues.apache.org/bugzilla/show_bug.cgi?id=50100, which
was fixed a couple of months ago.  You’ll need to grab the source from
Subversion to have this fix.  If you can’t get the latest code from
Subversion, you can work around this issue by setting useCss to false to
make SVGGraphics2D use presentation attributes instead of the style=
attribute; presentation attributes are allowed to omit units from
lengths, so browsers will be happy with them.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: font size question

2011-04-17 Thread Cameron McCormack
Christian Convey:
 Thanks very much.  Any idea when a new Batik release will come out
 that contains this fix?

That is a good question.  I feel like we have enough bug fixes, and it
has been long enough since the last release, that it is worth making a
1.8 release.  We would just need to find a developer who has the time to
manage the release.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: font size question

2011-04-17 Thread Cameron McCormack
Martin Gainty:
 usually font characteristics are handled by css will batik read css?

Yes, Batik processes style elements and style= attributes.  Passing
in `useCSS = false` to one of the stream() methods on SVGGraphics2D just
means that it will generate presentation attributes:

  svg ... font-size=12 font-family=Whatever

instead of style= attributes:

  svg ... style=font-size: 12; font-family: Whatever

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: Batik 1.7 latest version having Font Family names with digits in them cause Batik to throw exception

2011-03-22 Thread Cameron McCormack
Nishu:
 I have used font-family=MS Shell Dlg 2 in SVG which leads to issue.
 font-family without integer works fine.
 
 Does Batik has fix for this issue?  Can any one please point me to
 Batik jar which has fix for this issue?

It’s a known issue:

  https://issues.apache.org/bugzilla/show_bug.cgi?id=49968

In the meantime, you can work around the problem by quoting the font
family name: font-family='MS Shell Dlg 2'.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: maven for 1.7

2011-03-20 Thread Cameron McCormack
Hi Benson,

Benson Margulies:
 Clearly someone went to a lot of trouble to allow for maven pub, since
 the ant build does everything required except signatures.

I added those to the build file at some point because someone was
requesting maven artifacts.  I don’t know much about maven though, TBH.

 I already have access to publish org.apache.xmlgraphics artifacts
 to the apache repro from having helped out on this with fop, but I
 think I should get a more official-looking OK from the dev list before
 repeating this trick for Batik. Also, my key should be checked into
 your svn tree if I'm going to sign the artifacts.

You’re more than welcome to publish the official artifacts, thanks!  If
you email me your public key I’ll add it to KEYS.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: BufferedImage as SVG

2011-02-22 Thread Cameron McCormack
Roland Ucker:
 can Batik be used to save a java.awt.image.BufferedImage as SVG?

No, that’s fundamentally the inverse of what Batik does.  Batik can take
an SVG document and render it into a raster image, but it cannot
vectorise a raster image into SVG.  This mighe be useful for you:

  http://delineate.sourceforge.net/

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: Text on Path - startOffset range

2011-02-22 Thread Cameron McCormack
Jan Tosovsky:
 It's me again. I've prepared more complex example and these
 startOffset ranges turned out to be still problematic (particularly
 with the text-anchor attribute set to the middle), see the attached
 example (December ember).

 The text anchor is shifted so that text is not centered at the
 specified point so both occurrences appear in different positions
 (they should match).

Unfortunately I don’t have time right now to look into the correctness
of this example to verify if it’s a bug.  I would suggest as a simple
workaround to define a second path that is just the top half arc of the
circle, and centre a single “December” string on it.  This seems better
than splitting the string across the endpoints of the circle path
anyway.

 Should I report it somewhere?

You can file bugs here:

  https://issues.apache.org/bugzilla/

Thanks,

Cameron

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: Text on Path - startOffset range

2011-02-21 Thread Cameron McCormack
Jan Tosovsky:
 I am creating a wheel with labels on it (text on the path) but as text
 outside the path is clipped, I must to render these cases twice (the second
 time out of 0-100% range), see the attached test case. But it seems to be
 not supported by Batik as Squiggle tools returns the following exception:
 …

I think you are right.  I can’t find anything in the SVG spec that
disallows negative percentages.  This is fixed in SVN now (r1073181).

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: Use of parameters

2011-02-03 Thread Cameron McCormack
Hi Dao.

Dao Hodac:
 it is not even a candidate but firefox and chrome (at least) supports
 it (if you can see the page in those browsers), isn't it?

No, the document uses JavaScript to simulate the feature.  I don’t
believe there are any native implementations of SVG Parameters yet.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: Batik font scaling: no px or pt suffix

2011-01-19 Thread Cameron McCormack
detlef.amb...@gmx.de:
 now works ok with
 
 useCSS = false;
 
 for the meantime.

Yeah, that should work (since the font-size presentation attribute is
allowed to omit the units).

Nightly build is up now btw.

 The .svg is more than two times larger than the .jpg but the quality is
 much better. My smartphone doesn't gorge it, either. The larger size is
 probably mainly due to my ignorance of graphics features.

You could try running the output through something like SVG Scour to
reduce its size:

  http://www.codedread.com/scour/

 Anyway, stuff works. Have a look at windspeed (both homebrew ultrasonic
 and windcup in comparison) and temperature on my Berlin rooftop.
 
 http://www.dschuecker.de/test.svg

Nice.  Yeah there’s a lot of duplication of attributes in the output
(e.g. the fill=none and font-size=14) which could be moved up to a
group.  Scour might be able to factor out styles like that, I’m not
sure.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: Batik font scaling: no px or pt suffix

2011-01-18 Thread Cameron McCormack
Peter Hull:
 He said, In style attributes, style element, and external
 stylesheets, yes. Firefox is correctly following the CSS
 specification, there.  To me that implies that there is _not_ a flaw
 in Firefox - it is other platforms that are being too loose with the
 specification.

Exactly right.  Batik should change to output “px” in style attributes.
This is bug 50100:

  https://issues.apache.org/bugzilla/show_bug.cgi?id=50100

I just committed a fix for this.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: Batik font scaling: no px or pt suffix

2011-01-18 Thread Cameron McCormack
Christian Convey:
 Awesome! Thanks! Any idea when that fix will hit the Ubuntu
 repositories?

No idea, sorry, I’m not sure how often those packages are updated.  If
my nightly build script works (fingers crossed, it’s failed the last
couple of days since I tried to “fix” it), it should be available in
tomorrow’s:

  http://mcc.id.au/batik-nightly/

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: Batik and Rhino

2011-01-13 Thread Cameron McCormack
Hi Jyoti.

Jyoti Gandhe:
 I am using Batik for rendering SVG in my java application. The SVG
 is interactive and responds to mouse events. I have programmed
 mouse listeners in JavaScript using Rhino) to execute . I am using
 JavaScript for listener code instead of Java so that I can reuse the
 SVG file in an HTML page without having to rewrite anything. My SVG
 files looks like -

 svg onload=init(evt)
 
   script
   var svgDocument;
 
   function init(evt) {
   svgDocument = evt.target.ownerDocument;
   }
 
   /script
 
 .
 
 /svg
 
 I have a few questions about using JavaScript with Batik - 
 
 1. My JavaScript code declares functions. Is it possible to invoke
 JavaScript functions from my java class? For instance, can I invoke
 the function 'init' from a Java class.

Yes.  You can do this by evaluating some JavaScript in the context of
the document that is loaded in your JSVGCanvas.  You will have to
subclass the JSVGCanvas to get access to it, though, and that’s a bit
convoluted.

See this thread:

  http://web.archiveorange.com/archive/v/FI71MNKfN7TAqvWbnHcx

You’re not working with an applet, but the discussion of how to extend
JSVGCanvas (and various other classes) to get access to the right
information should get you there.

(It should be easier to evaluate some script using a method directly on
JSVGCanvas, I agree…)

 2. Occasionally, I need to pass data from my JavaScript functions to
 my java class. Is it possible to invoke methods of my Java object from
 my JavaScript?

Yes, if you have a reference to the Java object in your JavaScript, then
you can just call the method on it.  See in the example I linked to the
bindObject() call – you could use this to create a global variable in
your JavaScript that is a reference to your Java object.

Or you could pass it in as an argument to a JavaScript function that you
call from Java.

 3. I have a version of my application that uses java for mouse
 listeners. It is much faster than the JavaScript prototype. I suspect
 performance issues with Rhino. Are there tips and tricks to improve
 performance when using Rhino and batik together.

The only thing I can think of is whether Rhino is running in intrepreted
or compiled mode.  If you look in script/rhino/RhinoInterpreter.java,
there is:

if (rhinoClassLoader == null) {
cx.setOptimizationLevel(-1);
}

which should mean it uses interpreted mode if you’re in an applet or
some other context where it can’t define classes with byte code
directly.  I don’t know what the default optimization level is, but I
would hope that it would be = 0, which means compiled.

Nothing else comes to mind.

 4. I understand that Rhino ships with JDK 6 as the default JavaScript
 execution engine for javax.Script . Is it possible to use the Rhino
 that ships with JDK instead of js.jar that ships with Batik.

Perhaps!  I’ve never tried.  You would need to write your own
org.apache.batik.script.Interpreter{,Factory} implementations and
register them using the Service Provider Interface.  I guess they would
look pretty much the same as the ones in org.apache.batik.script.rhino
but using the JDK class names (which I can’t remember off the top of my
head – something like javax.script.rhino).

 5. Is it common to use Batik + Rhino for creating interactive SVG in
 a java application. If so, can you share your experience with me. Are
 there any tutorials or sample application I can look at for help.

Some people do use it this way.  I don’t think I have an easy example
application to show you, though, sorry.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: error casting to SVGSVGElement

2010-06-05 Thread Cameron McCormack
Hi Harry.

Harry Kao:
 I'm trying to embed a stylesheet into an SVG document but the sample
 code isn't working for me:
 
 http://xmlgraphics.apache.org/batik/using/svg-generator.html#Customizing+the+generated+SVG+style
 
 If I do this:
 
   org.w3c.dom.Document svgDoc =
   GenericDOMImplementation.getDOMImplementation()
   .createDocument(http://www.w3.org/2000/svg;, svg, null);
   System.out.println(el:  + svgDoc.getDocumentElement());
   System.out.println(ns:  + svgDoc.getDocumentElement().getNamespaceURI());
   System.out.println(name:  + svgDoc.getDocumentElement().getNodeName());
   SVGSVGElement s = (SVGSVGElement)svgDoc.getDocumentElement();
 
 I get the following output:
 
   el: org.apache.batik.dom.genericelemen...@1ac88440
   ns: http://www.w3.org/2000/svg
   name: svg
   Exception in thread main java.lang.ClassCastException: 
 org.apache.batik.dom.GenericElementNS cannot be cast to 
 org.w3c.dom.svg.SVGSVGElement
 at ReportRenderer.main(ReportRenderer.java:120)
 
 Is there an obvious reason why this cast is failing?

It fails because the kind of document that is created from the
GenericDOMImplementation isn’t an SVGDocument, it’s a GenericDocument.
If all you need to do to the generated document is to manipulate its
tree a bit and then say serialize it, and not do any SVG DOM specific
stuff, then that’s fine; it just means that the document element will be
of class GenericElementNS rather than something that implements the
SVGSVGElement interface.

(A GenericDocument might be ever so slightly lighter weight than an
SVGDocument.  I wouldn’t think it’s an appreciable different, though.)

If you do need to do some SVG DOM specific stuff on the document (e.g.
you want to build its corresponding graphics tree so that you can call
getBoundingBox() on some elements) then you need to use the
SVGDOMImplementation rather than the GenericDOMImplementation.  That
DOMImplementation will create an SVGDocument whose root element will
implement SVGSVGElement.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: Rasterizing produces 2 empty IDAT chunks

2010-05-20 Thread Cameron McCormack
Thomas DeWeese:
  Really in my mind the main issue is that you should be able to call
  flush whenever you want and not cause real havok which isn't the
  case without the proposed patch.

jonathan wood:
 I agree...why the closed underlying stream allows modification seems a bit
 perverse.

I agree with both of those points.  The simple fix of not writing a zero
length IDAT chunk when flush() is called seems best to me.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: Get stroke-width from GVT nodes

2010-05-09 Thread Cameron McCormack
Hi Nick.

Nick Hebner:
 I am a noob batik user and I am probably missing something simple. What I am
 trying to do is to calculate the total composite path length of all paths
 having a stroke-width 0.01 or less within a given document. So far, I have
 been successful in loading the document, building a GVT tree, iterating
 through it to create a composite path, and using the PathLength class to
 calculate the length. What I cannot figure out is how to check the
 stroke-width of a given path in the GVT tree. How can I accomplish this?

From the ShapeNode, you can get its ShapePainter.  If it is a
StrokeShapePainter, then you can get its java.awt.Stroke (which should
be a java.awt.BasicStroke; on which you can call getLineWidth()).
Otherwise, if it is CompositeShapePainter, then it could have a
StrokePainter in it.  Otherwise, the shape isn’t stroked.

Or, if you wanted to work on the SVG DOM instead, you could traverse the
document tree and call window.getComputedStyle() on each path/whatever
element to determine the value of its ‘stroke-width’ property.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: Get stroke-width from GVT nodes

2010-05-09 Thread Cameron McCormack
Nick Hebner:
 I initially went with GVT just because I was following the GVT builder
 tutorial. Later, I found the PathLength class that operated on Shape
 objects. Is there a PathLength analogue for DOM or is GVT better in this
 case?

Depends on what you want to do with the PathLength.  If you want to
perform a get-point-at-distance-along on a path element, then you can
do:

  SVGPathElement pathElt = …;
  SVGPoint p = pathElt.getPointAtLength(12.34);

From the SVG DOM you can’t get the tangent at a point, or approximate
the path by straight line segments, though.

But either way, you need to have the GVT tree built because
getPointAtLength() will just internally call the method on PathLength,
which needs the rendering tree.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Nightly builds

2010-03-10 Thread Cameron McCormack
Hi everyone.

I noticed recently that my Batik nightly builds haven’t been building
since some time last year.  They should be building again now.  You can
see a bunch of commits included in the build I kicked off earlier today:

  http://mcc.id.au/batik-nightly/

Thanks,

Cameron

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: Nightly builds

2010-03-10 Thread Cameron McCormack
Hi Helder.

Helder Magalhães:
 Oops... Actually, I had noticed for a while already, but I thought
 they were being built in a semi-automated fashion. Now I know I should
 have confirmed it. ;-)

Yes it is fully automated, when it is working. :)  But I did a manual
build yesterday to avoid waiting overnight.

 As we're at it, did you notice the 1.6 in the splash [1] image? ;-)
 …
 [1] http://mcc.id.au/batik-nightly/webstart/squiggle.gif

Hmm, so actually I can’t see that the splash image is used at all, at
least not on my current system (Java 6, Windows).  I’ve updated the JNLP
file to use the smaller Batik logo from the top of the website now, but
it still isn’t displayed for me when it is downloading Squiggle.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: background for text

2009-12-29 Thread Cameron McCormack
Dao Hodac:
 interesting, I never think filter oriented... but if I want to highlight a
 filled shape, the yellow never appears, isn't it?

If it’s a rectangle, yes, unless you set the filter region to extend
beyond the shape’s bounding box.  However, when
filterUnits=objectBoundingBox (the default), you can only use
percentages of the bounding box width/height, so it’s not possible to
set a fixed number of units units worth of padding, for example.

If you used filterUnits=userSpaceOnUse you could specify some user
units for the filter region, but then you need to know the size of the
shape you are applying the filter to.

The filter primitive margin attributes from the SVG 1.2 Filters spec
would let you keep objectBoundingBox mode while giving some user unit
values to inflate the filter region rectangle by:

  http://www.w3.org/TR/SVGFilter12/#FilterElementFilterMarginUnitsAttribute

That is not yet implemented in Batik, though.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Welcome to Helder Magalhã es as a committer

2009-12-29 Thread Cameron McCormack
Hello all,

I’d just like to congratulate Helder Magalhães on being voted in as a
committer for the Apache Batik project!  Helder has been doing great
work recently answering questions on the mailing list and keeping newly
filed bugs from going unanswered.

Helder, perhaps you’d like to add yourself to
http://xmlgraphics.apache.org/batik/contributors.html and also the
Squiggle splash screen? :)

Thanks too to Clay Leeds for organizing the vote.

Cameron

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



A repainting issue

2009-12-29 Thread Cameron McCormack
Hello all.

I’m having an intermittent problem with my application that uses a
JSVGCanvas, where occasionally an element isn’t painted.  The
application is a diagram editor, and the problem usually shows up when I
am dragging a shape around on the editing canvas.  The shape is
sometimes painted and sometimes not, during dragging.  Other SVG
elements (handles for the shape) are painted over where the shape should
be, so I suspect it isn’t a problem with the renderer classes.

While in a state where the shape isn’t painted, I dumped the SVG to a
file and loaded it in Squiggle to verify that I was modifying the DOM
correctly.  I also added assertions to all of the public mutating
methods in the org.apache.batik.dom.Abstract* classes to ensure that all
invocations were done in the UpdateManager’s thread.

Also, when I got into that state, I tried forcing a repaint of the
JSVGCanvas itself with paintImmediately() to no avail.  (I’ve turned off
double buffering of the canvas while testing.)

I guess the GVT is being built with the right geometry, since I can
mouse over where the shape should be and the cursor changes (since I
have a cursor=move on the g that makes up the shape).  The ShapeNode
itself also does seem to have a ShapePainter with the right fill and
stroke.  I haven’t investigated any more of the GVT yet though to see if
anything else is preventing the shape from being painted.

Are there anything else obvious I should check for (perhaps some other
threading requirements I’m not aware of) before I start tracing from
GraphicsNode.paint() to see what’s going on?

And what’s the easiest way to force the GVT to be repainted to the
canvas’ offscreen buffer and then on to the component itself, without
forcing a GVT rebuild (so I can verify whether the GVT was built
correctly)?

Thanks,

Cameron

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: A repainting issue

2009-12-29 Thread Cameron McCormack
Cameron McCormack:
 And what’s the easiest way to force the GVT to be repainted to the
 canvas’ offscreen buffer and then on to the component itself, without
 forcing a GVT rebuild (so I can verify whether the GVT was built
 correctly)?

Forget the offscreen buffer part, since I’ve turned off double
buffering, as mentioned.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: A repainting issue

2009-12-29 Thread Cameron McCormack
Cameron McCormack:
 I’m having an intermittent problem with my application that uses a
 JSVGCanvas, where occasionally an element isn’t painted.

As usual, writing down my problem in a mail has helped me work out what
the problem was. :-)

In the Swing thread, I’m getting the GraphicsNode of one of the elements
in my document and painting it on a different component.  (It’s a
thumbnail view of the diagram.)  I think this painting is happening at
the same time as updating/painting is happening on the JSVGCanvas.

So my question now becomes: when is it safe for me to grab the GVT node
and paint it somewhere?  In an UpdateManager Runnable?  Or is there
something I can synchronize on so I can do it directly from the Swing
thread?  Otherwise, I guess I will have to paint it to a buffer and then
paint that buffer to my thumbnail component in the Swing EDT.

Thanks again,

Cameron

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: SVG Size V/S Memory requirement

2009-12-29 Thread Cameron McCormack
Praveen Nayak2:
 Is there a way we can know the memory required by an SVG file before 
 rendering it? I show the SVG diagram in an applet.
 I ask this because if this information is available, we can use the new 
 param tag available from JRE 6 Update 10 onwards
 param name=java_arguments value= /
 
 to adjust the memory accordingly, for large diagrams.

I think the best you could do is to profile your applet (when it’s
running standalone, so you can run it in a profiler) to see how much
memory is used for the given SVG documents you are using.

There’s not an easy way to tell how much memory an arbitrary SVG
document is going to need.

(Seems crazy that you still can’t have the VM increase the amount of
available heap size as needed, and that you need to choose it ahead of
time!)

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: background for text

2009-12-21 Thread Cameron McCormack
dao:
 I'd like to highlight a text element of my svg file:
 
 text transform=matrix(1 0 0 1 433.8965 494.4141) style=fill:#00;
 font-family:'CourierNewPSMT'; font-size:24;00.00/text
 
 I cannot see any way to set the background of a text, or to get the box size
 to draw a rectangle around it.
 
 Do you know how I can do this?

A hacky way of declaratively drawing background for your text is to use
a filter:

  svg xmlns='http://www.w3.org/2000/svg' font-size='24'
filter id='f' x='0' y='0' width='100%' height='100%'
  feFlood flood-color='yellow' result='bg'/
  feMerge
feMergeNode in='bg'/
feMergeNode in='SourceGraphic'/
  /feMerge
/filter
text x='20' y='100' filter='url(#f)'Hello there/text
  /svg

The overhead of doing this is probably much greater than computing the
bounding box of the text and inserting a rect to draw the background,
though.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: nesting baseline-shift

2009-06-09 Thread Cameron McCormack
Hi Nicolas.

Nice to see a familiar name!

Nicolas Socheleau:
 I have a question about baseline-shift.
 
 The SVG spec specifies for the baseline-shift property the following:
 'baseline-shift' properties can nest. Each nested 'baseline-shift' is 
 added to previous baseline shift values.
 
 http://www.w3.org/TR/SVG11/text.html#BaselineShiftProperty
 
 How does it apply when a text/ has a baseline-shift and not its
 tspan/ children? I would expect the tspan to be shifted as well.

Yes I think you are right.

 I attached an example with on the right side my interpretation of the
 result.

Looks like a bug, please file it on https://issues.apache.org/bugzilla/.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: Issue regarding NativeArray assignment using Scriptable

2009-05-26 Thread Cameron McCormack
Shekhar Bhati:
 I have a serious problem using Rhino script.
 I have a hidden input variable in my jsp and my task is to assign a array to
 this object in a javascript file.
 myform.myObject.value=myArray;
 
 In my put(){} method I have written this code :
 
 window.eval(name.toString() + '=' + value.toString());
 
 It works for all other assignments other than this array one and gives this
 array
 *netscape.javascript.JSException: Failure to evaluate
 value=NativeArray;@53537c*
 Anyone have any idea how can I do this task.

As John says, this seems like a Rhino question more than a Batik
question.  However I can see from your output what the problem is: the
toString() of your NativeArray object doesn’t return a string that is
suitable for parsing again as script.  You’ll need to get something that
looks like [1, 2, 3].  Rhino implements a toSource() JavaScript method
on Array objects that will give you that.  Try this (untested):

  String jsSourceOfTheArray =
  ScriptableObject.callMethod(ctx, value, toSource, null);

where ctx is your org.mozilla.javascript.Context object.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: Clarification with pointer-events and use?

2009-05-21 Thread Cameron McCormack
Hi Michael.

Bishop, Michael W. CTR USJFCOM JFL:
 I think I've seen something like this before, but I haven't been able
 to find it in the archives. Here's what's going on. I have some SVG
 defined in defs. Elsewhere in the document, I have a g with the
 attribute pointer-events set to visible. Within this g, I have
 use elements that reference the SVG found in defs. The use
 elements have further attributes on them.

 I'm registering a DOM mouse-down listener on the g tag. Pointer
 events are being generated, but the event target is the SVG defined
 in defs and I can't access the unique attributes found on my use
 element. Is there anyway to discover information about the use
 element instead of the SVG it uses?

 defs
 circle id=circle ... /
 /defs
  
 g pointer-events=visible
 use xlink:href=#circle id=12345/
 /g
  
 I want to discover the id attribute on the use element, but I'm
 getting the circle as the event target.

So according to the spec, event flow should go like this:

  SVGGElement CAPTURING
  SVGUseElement CAPTURING
  SVGElementInstance corresponding to the circle AT_TARGET
  SVGUseElement BUBBLING
  SVGGElement BUBBLING

Batik doesn’t implement the SVGElementInstance stuff; what it actually
does is actually close the used content into a hidden tree and
dispatches events to those.  So the circle that the event is
dispatched to in the AT_TARGET phase is actually a copy of the circle
element from your document.

Per spec, if you wanted to find out which use element you’re in, you’d
do:

  event.target.correspondingUseElement

since event.target would be the SVGElementInstance object.  But that
won’t work at the moment.  Batik creates a fake DOM node to be the root
of the cloned shadow tree, and it has a pointer to the use element
that it’s the root of the shadow tree for.  So you can do this:

  var n = event.target;
  while (n.parentNode) {
n = n.parentNode;
  }
  // here, n will be an org.apache.batik.dom.svg.SVGOMUseShadowRoot

  n = n.getCSSParentNode();
  // now n will be the use element

This is non-standard of course, but it should suffice until the proper
element instance tree is implemented.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: [Color animation]

2009-05-20 Thread Cameron McCormack
Cui Jian:
 however, removing the element is the last thing I want to do, because it  
 might cause concurrent exception if any related thread doesn't work in  
 time, and most of the time they don't...

As Helder and Thomas said, if you’re manipulating the DOM from the Swing
event dispatch thread (in response to the JButton clicks), you’re doing
it wrong.

 I've tried the elementTimeControl and it works perfectly, remaining one  
 problem though:

 Actually I want the animation only start if I press the button, which  
 means it is stopped at first as the svg is loaded.
 But if I do the endElement() directly after I initiate the animateColorE  
 like this:

animateColorE.setAttributeNS(null,  
 SVGConstants.SVG_REPEAT_COUNT_ATTRIBUTE, indefinite);
((ElementTimeControl)animateColorE).endElement();

 I would get a null pointer exception when I start the program:

endElement() probably doesn’t work until it’s in the document, which
will initialise it.

But you can avoid that by having begin=indefinite on the element.
That’ll make it not start when inserted, and just wait for a
beginElement() call.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: xml:base

2009-04-23 Thread Cameron McCormack
Jan Tošovský:
 thanks for clarification. But I've found that for getting it to work I must
 place xml:base to each individual item in defs. Placing it to the root of
 subtree doesn't work.

If that’s true, then that’s a bug.  Please file it on
https://issues.apache.org/bugzilla/enter_bug.cgi?product=Batik and
attach a test case that demonstrates the problem.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: org.w3c.dom.Document - SVGDocument

2009-04-22 Thread Cameron McCormack
Hi Michael.

Bishop, Michael W. CTR USJFCOM JFL:
 I have a lightweight API that creates a Document that contains SVG. It
 uses Java's core DOM model. I'm going to start working on a UI that
 displays this information. The API doesn't rely on Batik and I don't
 want it to have to in order to keep it small. It basically just puts
 supplied information into a template to produce its output. The UI,
 of course, will use Batik to display the content. Is there a way to
 easily go from the Document produced by the API to an SVGDocument that
 can be used with Batik UI components?

You’ll need to clone the whole document as Batik’s DOM objects for it
to work in the JSVGCanvas.  The JSVGComponent.setDocument() method will
do that if you pass in a Document object that isn’t an SVGOMDocument,
but you can do it yourself with the same code that’s in that method:

  Document myNonBatikDOMDocument = …;
  Document myBatikDOMDocument = DOMUtilities.deepCloneDocument
(myNonBatikDOMDocument, SVGDOMImplementation.getDOMImplementation());

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: xml:base

2009-04-21 Thread Cameron McCormack
Hi Jan.

Jan Tošovský:
 I've already tried many combinations but still without success. Has
 anybody small piece of working code for dynamic creation of SVG with
 setting of xml:base?

Attached is a test program that creates an SVG document and sets an HTTP
URL as the xml:base= on the root svg element, so that an image
element’s relative URL is resolved against it.

-- 
Cameron McCormack ≝ http://mcc.id.au/
import org.apache.batik.dom.svg.*;
import org.apache.batik.swing.*;
import org.w3c.dom.*;
import org.w3c.dom.svg.SVGDocument;
import java.awt.*;
import javax.swing.*;

public class BaseTest {
private static String SVGNS = http://www.w3.org/2000/svg;;
private static String XMLNS = http://www.w3.org/XML/1998/namespace;;
private static String XLINKNS = http://www.w3.org/1999/xlink;;

public static void main(String[] args) {
try {
final SVGDocument d = (SVGDocument) SVGDOMImplementation.getDOMImplementation().createDocument(SVGNS, svg, null);
Element svg = d.getDocumentElement();
svg.setAttributeNS(XMLNS, xml:base, http://www.google.com/;);
svg.setAttribute(viewBox, 0 0 100 100);
Element img = d.createElementNS(SVGNS, image);
img.setAttribute(width, 100);
img.setAttribute(height, 100);
img.setAttributeNS(XLINKNS, xlink:href, /images/nav_logo4.png);
svg.appendChild(img);

EventQueue.invokeLater(new Runnable() {
public void run() {
JFrame f = new JFrame(xml:base test);
JSVGCanvas c = new JSVGCanvas(null, false, false);
f.getContentPane().add(c);
f.setSize(400, 300);
f.setVisible(true);
c.setSVGDocument(d);
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
}


-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org

Re: Problem with Curve.subdivide

2009-04-18 Thread Cameron McCormack
Hi Helder.

Helder Magalhães:
 I seems like this change could have fixed visible errors so, as this
 didn't go through the usual bug reporting procedure, I'd say this
 NeedsReleaseNote [1]. ;-)

I don’t think we’ve used that keyword before.  In fact, we don’t tend to
use the keywords at all in Bugzilla for Batik.  The small number of
developers means we probably don’t need much process overhead.

 I'm not sure if, before releasing a new version commits are throughly
 analyzed, though for (potentially) missing things in CHANGES: I've
 never got to quite understood if there's a procedure for this -- I've
 looked at file MAINTAIN but nothing relevant was found
 (nevertheless, step 8 of Distribution Creation seems somehow
 related).

For the 1.6 and 1.7 releases, I went through all the commits since the
previous release and updated the CHANGES file.  Recently, I have been
making sure to update CHANGES as I go, to avoid having to do that.  It
shouldn’t be hard to come up with a list of commits that didn’t touch
CHANGES, and only look at those, so if CHANGES isn’t updated as fixes
are checked in, I guess it’s not a big problem.

 Should a similar tip (analyze commits before releasing a new
 version) be added to the MAINTAIN file?

I just tweaked the wording of step 8 there to say to update CHANGES
before a release.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: Exception : Unable to make sense of URL for connection

2009-04-15 Thread Cameron McCormack
Hi Claire.

Claire SERRANO:
 I work on a Java application based upon batik. It contains a JSVGCanvas
 displaying the content of a SVGDocument. That document might be modified.
 All modifications are performed in Batik's update manager thread. 
…
 Everything's ok when we load the document in squiggle but not in our
 application, we have this exception when we draw an arrow:
 org.apache.batik.bridge.BridgeException: Unable to make sense of URL for
 connection

The problem may be that the document doesn’t have a URI, so it is unable
to resolve the relative URI “#TMTRIANGLE”, even though it should be in
the same document.

How are you creating the SVGDocument?  You could try calling
setDocumentURI() on it (after casting it to SVGOMDocument) to give it a
URI of some sort.  If the document needs to be able to have relative
reference to files on the local file system, give it a URI like
file:///some/where/file.svg; then it will be able to resolve relative
URIs to files in the /some/where directory.  Or, if you don’t need to
reference local files relatively, even something like
http://example.com/; should do.

Do that setDocumentURI() call just after you have built the document and
before you have installed it in the JSVGCanvas.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: javadoc links to w3.org broken?

2009-04-09 Thread Cameron McCormack
Cameron McCormack:
  I’ll try republishing the javadoc with the above changes right now.

Alan Deikman:
 Where can that be downloaded?   I don't see it at the main page.

You can view the javadocs at:

  http://xmlgraphics.apache.org/batik/javadoc/

There’s no downloadable ZIP file of nightly builds of the javadocs.
You’ll need to check out the sources from svn and build the javadocs
yourself if you want them on your machine.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: BufferedImage black background problem

2009-04-08 Thread Cameron McCormack
Hi Sébastien.

Hamel, Sébastien:
 The simplified code used to convert from SVG to the BufferedImage is the 
 following 
 
   public BufferedImage getImage(SVGDocument svgDocument, int width, int 
 height) {
 // Paint svg into image buffer
 //BufferedImage bufferedImage = new BufferedImage(width, height,
   //BufferedImage.TYPE_USHORT_565_RGB);
 BufferedImage bufferedImage = new BufferedImage(width, height,
 BufferedImage.TYPE_3BYTE_BGR);
 Graphics2D g2d = (Graphics2D) bufferedImage.getGraphics();
  
 // For a smooth graphic with no jagged edges or rastorized look.
 
 
 g2d.setBackground(Color.WHITE);

I’m wondering whether it is an issue of what the BufferedImage is filled
with when you first create it.  Since you use TYPE_3BYTE_BGR, there is
no alpha channel, so the BufferedImage will be filled with some solid
colour.

How about doing a fillRect() to fill the BufferdImage with white
explicitly (assuming that’s what you want as your background colour)?

  g2d.setColor(Color.WHITE);
  g2d.fillRect(0, 0, width, height);

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: Strange entity behaviour: Omitting last character

2009-04-08 Thread Cameron McCormack
Cameron McCormack:
  Can you submit a small, standalone program that demonstrates the
  problem?

Paul Wellner Bou:
 Of course. The SVG:

Thanks.

 I know that it is technically correct replacing it. But why it should?  
 It may have a reason why someone wants it replaced or not. And if there  
 is no need to replace something, I think it shouldn't do it. Or it  
 should be at least configurable.

Yes there’s no reason to.  I just committed a change that serialises
apostrophes as a single character instead of using the entity.

  http://svn.apache.org/viewvc?view=revrevision=763473

Paul Wellner Bou:
   And why is batik omitting the last character if it has to do 
   something  with entities? For example:

Cameron McCormack:
  I don’t think that’s a known bug, no, but it does look like a bug.  As
  above, can you provide a test case?

Paul Wellner Bou:
 Regarding this I found my error. Not on the batik side. I implemented my  
 own java.io.writer and I catched the string in the buffer using new  
 String(cbuf).substring(off, len) and not String.valueOf(cbuf, off, len);  
 in the overriding write(char[] cbuf, int off, int len) method. Sorry.

OK.

Thanks,

Cameron

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: Strange entity behaviour: Omitting last character

2009-04-07 Thread Cameron McCormack
Hi Paul.

Paul Wellner Bou:
 So why are single quotes ' within attributes replaced with their entity?  
 Can I prevent them from beeing replaced?

I doubt that you can prevent them from being replaced without modifying
Batik.  As with the issue you raised earlier, it is perfectly fine for
an XML serialisation to use numeric character references and entity
references like this (i.e., it’s well formed XML).

In the example below, it’s true that the apostrophes need not be
replaced with entities inside double-quoted attributes.  I’m not sure if
the serialisation code sometimes uses double-quoted attributes and
sometimes single-quoted attributes; if it does, then it may use apos;
unconditionally just because it is simpler to do so.  But if it’s usign
double-quoted attributes all the time, then I agree it’s better if it
didn’t use apos;.

Can you submit a small, standalone program that demonstrates the
problem?

 And why is batik omitting the last character if it has to do something  
 with entities? For example:

 * If I try to set an attribute to #xFC; (I did that before I knew that  
 all entities are replaced every time), As result I get: amp;#xFC. The   
 is replaced with it's entity, this is ok, but the semicolon disappeared.

 * If I have single quotes in attribute values (Adobe Illustrator seems  
 to do this writing the font names), those single quotes are replaced  
 with their entity apos; and the last character of the string within the  
  single quotes disappears:

   Original: font-family='ArialNarrow-Bold'
   Batik written: font-family=apos;ArialNarrow-Bolapos;

 I am using Batik-1.8pre. Is this a known bug?

I don’t think that’s a known bug, no, but it does look like a bug.  As
above, can you provide a test case?

Thanks,

Cameron

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: javadoc links to w3.org broken?

2009-03-31 Thread Cameron McCormack
Hi Alan, Helder.

Alan Deikman:
  I have noticed that in the javadoc that comes with Batik, all the links to
  www.w3.org are broken.   Is there a plan to fix this?

Helder Magalhães:
 Not all, at least some [1] seem to be working. ;-)
 
 The DOM package [2] seems to be missing the whole SVG subtree, though...

Since removing the org.w3c.dom.svg interfaces from the Batik source
tree, and instead referencing xml-apis-ext.jar from Apache XML Commons,
there haven’t been links to those interfaces.  I tried to get the
Javadoc published somewhere on www.w3.org, just like the DOM Level 2
ones are, but to no avail yet.  When SVG 1.1 Second Edition is published
(within a couple of months, I expect), hopefully the Javadocs will be
published too, and we can get the Batik ones to link to w3.org.

 As we're at it (speaking of JavaDoc):
  * The footer [3] seems to be corrupted (probably the copyright
 character is being used directly, whereas the HTML entity (copy;)
 should probably be used instead;

The character is specified as #169; in build.xml.  I guess it is an
encoding issue somewhere, but not sure where.  I’ll try using the
-docencoding option to the javadoc tool to ensure that the output is
UTF-8.

  * The footer could hold a link to the ASF homepage [5] (something
 like 'a href=http://www.apache.org/;Apache Software
 Foundation/a').

That should be easy enough to do.

 Should these minor changes be put in a patch?

I’ll try republishing the javadoc with the above changes right now.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: appendChild exception!

2009-03-08 Thread Cameron McCormack
杨莹:
 I get have two svg document instances. the docA and docB, I want to
 insert docA to docB, because I know SVG tag can be nested. so I code
 followling:

 Node node =  docA.getFirstChild();// the svg root element
 docB.appendChild(node); // nest svg

In this case you are lucky that the first child of the Document node is
in fact the svg element.  But this might not always be the case: you
can have a Comment node before it, for example.  It would be better to
use

  Node node = docA.getDocumentElement();

instead.

 but I run the code and get the exception:

 org.w3c.dom.DOMException: The node (type: 1, name: svg) cannot be
 inserted, since the document node already has a node of type 1.
 at 
 org.apache.batik.dom.AbstractNode.createDOMException(AbstractNode.java:408)
 at 
 org.apache.batik.dom.AbstractDocument.checkChildType(AbstractDocument.java:855)
 at 
 org.apache.batik.dom.AbstractParentNode.checkAndRemove(AbstractParentNode.java:455)
 at 
 org.apache.batik.dom.AbstractParentNode.appendChild(AbstractParentNode.java:203)

 why that exception happens? how can I fix it? thanks for reply.

It’s because you are trying to append the svg element as a child of
the Document node, and a Document node can have only one Element child
(which is what the “type 1” means).  Probably you want to append the
svg element as a child of the root svg in docB.  Also, since ‘node’
comes from a different document, you need to call importNode() so that
it can be placed in docB:

  // the ‘true’ means to perform a deep importation (the whole subtree)
  Node node = docB.importNode(docA.getDocumentElement(), true);
  docB.getDocumentElement().appendChild(node);

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: FW: Strange applet delay revisited

2009-02-04 Thread Cameron McCormack
Cameron McCormack:
  Sounds good.  What's the default contents of this file?

Helder Magalhães:
 Well, noticed this check in so a SVN refresh should be sufficient to
 take a look. ;-)

Oh right.  Seems I fell off the batik-commits mailing list, so I didn’t
notice it.

One question: the “class org.w3c.dom.Window” line is commented out
because it “conflicts with our Window class”.  How does it conflict?

(Also I might return iterators to the classes/packages lists wrapped
with Collections.unmodifiableList so that calling code can’t remove
items.  That, or add removeClass()/removePackage() methods, if we want
to allow removals.)

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: FW: Strange applet delay revisited

2009-02-03 Thread Cameron McCormack
Thomas DeWeese:
I've change the import stuff so it reads a file 
 (META-INF/imports/script.txt) each line of the file can
 start with either 'package' or 'class' the rest of the line
 can be any number of space separated class/package names.
 
Users of Batik can also get the 'ImportInfo' class and
 add additional classes/packages if they choose to.

Sounds good.  What’s the default contents of this file?

Cameron McCormack:
   There's an argument to making Squiggle
   configure its JSVGCanvas not to import the whole java.lang package, to
   avoid incompatibilities with scripts that would work in other UAs, but
   I'd be happy either way there.
 
I didn't do this but squiggle could easily add 
 java.lang as an import package to the ImportInfo.
 I did add class java.lang.System since that is fairly useful.

OK.  If you feel happy with having only java.lang.System imported, then
I’m happy with that too.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: Determine clicked 'use' element

2009-02-02 Thread Cameron McCormack
Hi Age.

Age Bosma:
 There's one problem with the method you provided though. You are using
 the 'SVGOMCSSImportedElementRoot' class but this one isn't part of
 batik at all? As far as I have been able to determine it was included
 in version 1.5.1 but it has been removed in a later release for some
 reason. Is there a replacement of some sort available?

In more recent versions those methods were moved to the CSSNavigableNode
interface.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: FW: Strange applet delay revisited

2009-01-29 Thread Cameron McCormack
Hi Helder.

Cameron McCormack:
  Currently, the following packages are imported

Helder Magalhães:
 Wow, impressive! :-) Does this mean that to achieve a standard
 ECMAScript binding this would be the class list? I can try to marsh up
 a patch from this if it sounds useful...

That’s correct, though if we don’t eliminate the importPackage() for
java.lang then there’s no point importing these org.w3c classes
explicitly, since the class loader will still go out to the network,
AFAICT.

Once we’ve decided on the best course of action, I’d be happy to land a
patch that fixes the problem.

 Humm... I'm not sure about this, but this sort of things would be
 tied to a particular implementation (Batik, in this case), so I'd
 argue that, for this sort of functionality, explicit importPackage
 calls could become a requirement - this way, it would be obvious that
 an implementation-specific feature (and not a standard ECMAScript
 binding) was being used, potentially avoiding interoperability
 issues that could raise from not knowing that... Would this behavior
 make sense or am I missing something (such as breaking current
 functionality or similar)?

I agree.  Were I starting from scratch, I’d expose only
importPackage, importClass and Packages from Rhino (as well as the
classes from org.w3c).  At the moment, there are standalone SVG files in
samples/ that rely on java.lang being imported.  I suspect that there
are many users of Batik who create/use documents with such a dependency,
too.

At least if we did

  java = Packages.java

then the global scope won’t be polluted with additional classes each
time you upgrade to a newer JRE version.

So perhaps the best solution is to make RhinoInterpreter (or maybe
Interpreters in general, via InterpreterPool?) configurable as to
whether it should import java.lang classes automatically.  A JSVGCanvas
would import by default, for compatibility with those writing their own
applications using Batik.  There’s an argument to making Squiggle
configure its JSVGCanvas not to import the whole java.lang package, to
avoid incompatibilities with scripts that would work in other UAs, but
I’d be happy either way there.  Those who want to embed a JSVGCanvas in
an applet can configure it not to import java.lang.

Thoughts?

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: FW: Strange applet delay revisited

2009-01-20 Thread Cameron McCormack
  org.w3c.dom.svg.SVGViewElement
  org.w3c.dom.svg.SVGViewSpec
  org.w3c.dom.svg.SVGZoomAndPan
  org.w3c.dom.svg.SVGZoomEvent

Plus, there are a few that are included in source form:

  jet:~/work/svn/batik/trunk/sources $ find org/w3c/dom -name '*.java' | sed 
's/\.java$//' | tr / .
  org.w3c.dom.events.CustomEvent
  org.w3c.dom.events.DocumentEvent
  org.w3c.dom.events.EventException
  org.w3c.dom.events.Event
  org.w3c.dom.events.EventListener
  org.w3c.dom.events.EventTarget
  org.w3c.dom.events.KeyboardEvent
  org.w3c.dom.events.MouseEvent
  org.w3c.dom.events.MutationEvent
  org.w3c.dom.events.MutationNameEvent
  org.w3c.dom.events.TextEvent
  org.w3c.dom.events.UIEvent
  org.w3c.dom.ElementTraversal
  org.w3c.dom.Window
  org.w3c.dom.Location

The java.lang import isn’t needed for conformance to the spec,
obviously.  I suspect that it is used most commonly for use of the
System class, to allow code like:

  script
System.out.println(whatever);
  /script

instead of:

  script
java.lang.System.out.println(whatever);
  /script

or even:

  script
Packages.java.lang.System.out.println(whatever);
  /script

(I notice that some files under the samples/ directory use the System
class.)

Rhino itself effectively does:

  java = Packages.java;

when it initialises.

If we want to keep importing the java.lang.* classes, then we could
manually import all of the classes/interfaces listed here:

  http://java.sun.com/javase/6/docs/api/java/lang/package-summary.html

but many of those seem like they would be unneccessary.  I really don’t
know which would be needed.

If there were a way to enumerate at run time the classes in java.lang,
so that they could all be imported manually, that would be a good
solution (and would also be better than listing all of the above
org.w3c.dom.* interface manually, too) but I don’t know that there is a
way to do that.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: Running Squiggle as an applet.

2008-12-14 Thread Cameron McCormack
Hi Noel.

Noel Whiting:
 changed code as suggested to :
 
 Htmlhead/head
 body
 applet code=org.apache.batik.apps.svgbrowser.Main  height=100% 
 width=100% 
   
 archive=batik-squiggle.jar,batik-all.jar,xerces_2_5_0.jar,js.jar,xml-apis.jar,xml-apis-ext.jar,xalan-2.6.0.jar
  param name=svgFile value=s549.svg
 /applet
 /body/html
 
 but still get 'load: class Main.class not found'.

The Squiggle main class, org.apache.batik.apps.svgbrowser.Main, is not a
java.applet.Applet, and only classes that inherit from java.applet.Applet
can be referenced in the @code attribute and run as applets.  You’ll
need to write your own applet class that runs the Squiggle application
or creates a JSVGCanvas in the applet, as appropriate for whatever
you’re task is.

The applet demo on the website has an example:

  http://xmlgraphics.apache.org/batik/demo.html

The applet code is at:

  http://xmlgraphics.apache.org/batik/demo/AppletDemo.java

Cameron

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



Re: animatable image problem (access denied)

2008-11-26 Thread Cameron McCormack
Hi Jerzy.

Jerzy Jalocha N:
 I suppose (maybe naively), that it should be as easy as
 changing periodically the value for the xlink:href attribute.
 But this has not worked for me so far, for the reasons given
 in the first post. An example:
 
image width=50 height=50 xlink:href=frame0.png dur=1s
   set attributeName=xlink:href to=frame1.png dur=1s /
   ...
   set attributeName=xlink:href to=frame9.png dur=1s /
/image

Something like that would work, but you’d need to use @begin attributes
on the sets so that they don’t all apply at once.  Or, you can use
animate with the list of URLs in a @values attribute.  For example,
the following works for me:

  svg xmlns=http://www.w3.org/2000/svg;
   xmlns:xlink=http://www.w3.org/1999/xlink;
   width=400 height=300
image xlink:href=frame0.png width=100 height=100
  animate attributeName=xlink:href
   values=frame0.png; frame1.png; frame2.png; frame3.png
   calcMode=discrete dur=4s repeatDur=indefinite/
/image
  /svg

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: animatable image problem (access denied)

2008-11-25 Thread Cameron McCormack
Hi Jerzy.

Jerzy Jalocha N:
 I just found a fully implemented example of an animated
 bitmap in the 1.2 specification. It does _not_ work with
 squiggle 1.7 (binary distribution download). It fails with
 the following error:
 
SVG Error:
file:/home/jerzy/work/svg/tests/transition.svg:14
The attribute xlink:href of the element image is required
 
 Anyone knows if squiggle (batik) is able to handle animated
 bitmap images?

Transitions are not implemented in Batik.

As for the above error message, this is because your image element
doesn’t have an initial @xlink:href attribute value.  In SVG Tiny 1.2,
this would be allowed (due to the processing being defined in such
cases), but in SVG 1.1 it is not, and Batik chooses to show an error for
this.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Difference of animation behavior compare to ASV

2008-11-05 Thread Cameron McCormack
Hi Ludo.

Ludo35:
 When I try to run the following file in Squiggle it doesn't behave as in IE
 with ASV3:
 http://www.nabble.com/file/p20339786/Problem%2BWith%2BSquiggle.svg
 Problem+With+Squiggle.svg 
 
 There are two differences:
 - If you run the file and leaves the first animation run and let the ellipse
 goes from the right bottom corner to the left top corner, then click on the
 rectangle button at the bottom, you can notice that the ellipse will go back
 to the left top corner at the end. In IE, the ellipse correctly ends at the
 right bottom corner.

Yes, that looks like a bug in handling animation priority when there is
a frozen animation.  I’ve filed a bug:

  https://issues.apache.org/bugzilla/show_bug.cgi?id=46155

 - If you run the file and quickly click on the rectangle button at the
 bottom, you can notice that the ellipse will go back to its initial position
 (right bottom corner). In IE, the ellipse correctly end at the right bottom
 corner.

I think this is related to the first difference.

 Could you please tell me if this is a known bug? If so, is there a
 workaround?

I haven’t got a workaround.  Re-ordering the animation elements in the
document produces a different (but still incorrect) result.  Working
around the issue would probably require you to avoid using frozen
animations.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Difference of animation behavior compare to ASV

2008-11-05 Thread Cameron McCormack
Cameron McCormack:
 Yes, that looks like a bug in handling animation priority when there is
 a frozen animation.  I’ve filed a bug:
 
   https://issues.apache.org/bugzilla/show_bug.cgi?id=46155

I’ve just committed a fix for that bug.  Can you test with the latest
code from SVN?

Thanks,

Cameron

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Define String Width with bounding box

2008-10-31 Thread Cameron McCormack
Cameron McCormack:
  However, it seems that spaces at the start and end of the element don?t
  contribute to the bounding box, even if xml:space=preserve.  That
  seems to be a bug, so I’ve filed this:
  
https://issues.apache.org/bugzilla/show_bug.cgi?id=46127

Thomas DeWeese:
Do you have a section in the spec that says that unrendered
 text content must contribute to the BBox of a text element?
 There is an obvious conflict here between the bbox be some
 sort of 'logical bounds' vs the 'rendered content bounds'.
 So for example for putting a graphical element next to the
 text you probably wouldn't want to consider the space.

Ah I was following the SVG Tiny 1.2 definition, which says that the
bounding box of a text element is the union of the bounding boxes of
its glyph cells:

  http://dev.w3.org/SVG/profiles/1.2T/publish/coords.html#BoundingBox

The 1.1 definition just says geometry, so probably the current behaviour
is OK for 1.1.

If you want to know actual text content positions I would suggest
 that the text content SVG DOM Api's would be a better choice than
 getBBox:
 
 http://www.w3.org/TR/SVG/text.html#DOMInterfaces
 
   Take a look at 'samples/tests/spec/scripting/text_content.svg'
 in the distribution for an example of using these API's. 
 In particular you can call 'getEndPositionOfChar(index)' for the 
 trailing space to get the location of the end of the space. 

Yes that should work. :)

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Define String Width with bounding box

2008-10-29 Thread Cameron McCormack
Hi Thomas.

Thomas Palfray:
 I'm trying to find the width of a String, but i've a little problem.
 in fact, i use getBBox() to find it, and it works ... but not in one case.

 I have two test String :

 blabla bla
 blabla bla 
 getBBox() gives me the same length for the two String. It seems that it  
 doesn't take the last blankspace.

If you want it to consider all spaces in the text element literally,
then you should set xml:space=preserve on the element:

  tmpText.setAttributeNS
(http://www.w3.org/XML/1998/namespace;, xml:space, preserve);

However, it seems that spaces at the start and end of the element don’t
contribute to the bounding box, even if xml:space=preserve.  That
seems to be a bug, so I’ve filed this:

  https://issues.apache.org/bugzilla/show_bug.cgi?id=46127

Replacing it with a non-breaking space (#x160;) doesn’t seem to help
either, unfortunately.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Odd LinearGradient problem with Batik

2008-10-23 Thread Cameron McCormack
G. Wade Johnson:
 I'm doing some testing with some of my older SVG applications and ran
 into an odd behavior in Batik 1.6 and 1.7.
 
 I am applying a linear gradient as a fill to a path. The path starts
 out as a point at (0, 0). In my application, I extend the path through
 scripting to make a sort of strip chart.
 
 The problem is that Squiggle (in either 1.6 or 1.7) immediately fails
 with an NPE if I use a linear gradient on this empty path. If I use a
 solid color, there is no problem.
 
 Since I originally developed this application with Squiggle as my
 viewer, I quite certain it worked once upon a time. But, now I get the
 following error.
 -
 java.lang.NullPointerException
   at
 org.apache.batik.bridge.SVGLinearGradientElementBridge.buildGradient(SVGLinearGradientElementBridge.java:127)

There was a bug on this line that has been fixed since the 1.7 release.
If you try it with a recent SVN version you shouldn’t get the NPE.

Definitely this shouldn’t throw an exception, here.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: sub-pixel LCD antialiasing for text in Batik

2008-10-23 Thread Cameron McCormack
Hi Stuart.

Stuart Pook:
 I read the thread on Batik 1.7 text rendering issues and followed the  
 instructions to get batik to render the text in my SVG files using  
 sub-pixel aliasing however I cannot get it to work.
 http://mail-archives.apache.org/mod_mbox/xmlgraphics-batik-users/200808.mbox/[EMAIL
  PROTECTED]

Just after that thread I tried to test this as well using the same
rendering hints you tried in your code snippet, and wasn’t able to get
it to work.  I didn’t work on it for long, but I didn’t determine what
the problem was.  I was also using Java 6 on Debian, but I don’t know if
that is part of the issue; I didn’t try other platforms.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: best practice or example of multi-line textArea using using DOM or Graphics2D?

2008-10-22 Thread Cameron McCormack
Hi Sebastian.

Sebastian Wagner:
 thanks  keep up got work, I really like the Batik Toolkit!
 You can add OpenMeetings http://code.google.com/p/openmeetings/ to the
 Open-Source Projects using Batik if you like.

Is it used in the whiteboard?  Anywhere else?  (We like to mention where
in the project Batik is being used.)

Thanks,

Cameron

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: how to export images from a svg file

2008-10-08 Thread Cameron McCormack
jdomuser:
 Thank you very much, i think it will help; now i should retrieve the base64
 string to feed ParsedURL. To retrive the base64 string, i do the following:
 ..
 if (id != null  id.getNodeValue().contains(Picture)) {
  Node grandchild = child.getLastChild();
  NodeList grandchildren = grandchild.getChildNodes();
  if (grandchildren.getLength() == 1) { // base 64 image
  SVGOMImageElement ie = (SVGOMImageElement)
 grandchildren.item(0).getLastChild();
 ..
 but after that, i cant get the string with the line String image =
 ie.getHref().getAnimVal();

What do you get with the above code?

If you don’t have any animations, then you can also use

  String image =
ie.getAttributeNS(http://www.w3.org/1999/xlink;, href);

to get the value of the @xlink:href attribute.

Cameron
(in Korea on vacation, so unable to reply quickly)

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: how to export images from a svg file

2008-10-05 Thread Cameron McCormack
jdomuser:
 thanks but, i want to retrieve the image data that is embedded in the svg
 file, and save them to file, and set them back to the same positions after
 scaling/filtering etc. Is it possible to do that with batik?

I’m not sure what you mean, exactly.  Do you want to load an SVG
document, modify it a bit (e.g. add a transform or a filter), then save
the XML back out to a file (or rasterize it after modification)?

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: how to export images from a svg file

2008-10-05 Thread Cameron McCormack
jdomuser:
 thanks but, i want to retrieve the image data that is embedded in the svg
 file, and save them to file, and set them back to the same positions after
 scaling/filtering etc. Is it possible to do that with batik?

Or (another possibility): do you want to extract base64-encoded image
data from an SVG document?  For example when you have:

  image xlink:href='data:image/png,Abshfdsy39…'/

in there?

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: how to export images from a svg file

2008-10-05 Thread Cameron McCormack
Cameron McCormack:
  Or (another possibility): do you want to extract base64-encoded image
  data from an SVG document?  For example when you have:
  
image xlink:href='data:image/png,Abshfdsy39…'/

jdomuser:
 Yes, thats what i wan to do. I will convert it to a BufferedImage(or some
 other image class) and save to disk, modify it with some other code, and
 then embed the modified image to its old position..

OK.  You can use the ParsedURL class to get an InputStream from that
data: URI:

  
http://xmlgraphics.apache.org/batik/javadoc/org/apache/batik/util/ParsedURL.html

You can then pass that InputStream to the constructor of
org.apache.batik.ext.awt.image.codec.png.PNGImageDecoder, then call
decodeAsRenderedImage(0) on it PNGImageDecoder.  That will return you a
RenderedImage:

  http://java.sun.com/j2se/1.5.0/docs/api/java/awt/image/RenderedImage.html

Then you can convert the RenderedImage to a BufferedImage, using code
like shown here:

  http://www.jguru.com/faq/view.jsp?EID=114602

Once you’ve made the changes to your image, use the PNGImageEncoder
class, which will write the PNG data to an OutputStream.  For that
OutputStream, supply an instance of Base64EncoderStream that is wrapped
by a StringWriter.  Then set the @xlink:href attribute of the image
element to be data:image/png;base64, + yourStringWriter.

Hope that helps,

Cameron

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Java version requirements and upgrading external libraries (was Re: Batik and Rhino 1.6R7)

2008-10-04 Thread Cameron McCormack
Hi Helder.

Cameron McCormack:
  But in the meantime I've committed a change to get this to work in Rhino
  1.6R7. I haven't updated the js.jar from 1.6R5 in the repository yet.

Helder Magalhães:
 Great! :-) I'll attempt to test the change, possibly whenever file
 js.jar is also updated.
 
 Related to the upcoming jar file upgrade, I recall Jeremias Maerki
 blogging on the results of a pool regarding Java version [1]. In my
 working copy I've a few minor changes I'd like to contribute, like
 upgrading Ant version to 1.7 (which requires Java 1.5) so I'd like to
 ask:
  * Are there any plans to drop Java 1.4 support?

In the future, yes.  The result of that poll was a decision to keep
targetting Java 1.4, though.  If there are any features that require
Java 1.5, then we could introduce 1.5-specific sources into the
repository, just like we used to have 1.4-specific sources when we were
targetting 1.3.

Personally, I would be happy with aiming for 1.5, but it is sensible for
all of the XML Graphics projects to have the same aim, due to their
interdependencies.

  * Is there a known procedure for upgrading external libraries used
 within the project?

No, we don’t really have a policy.  So far I have only updated external
dependencies to fix particular bugs, I think.  Assuming it doesn’t break
anything, updating to Rhino 1.6R7 would be fine with me.  We can’t go
for Rhino 1.7 though, since it requires Java 1.5.

  Technically, these functions should return integers that identify the
  timeout/interval, rather than TimerTask objects.
 
 I haven't seen this stated anywhere within the changes nor noticed any
 new bug for this (sorry if I missed something). Shouldn't this be
 pointed out somewhere (source code comment and/or new bug report) so
 it won't get lost? ;-)

Yeah.  Currently this is documented, to a degree, in HTML 5:

  http://www.whatwg.org/specs/web-apps/current-work/multipage/no.html#timers

And there is also documentation like Mozilla’s:

  http://developer.mozilla.org/en/DOM/window.setTimeout

Their definitions are likely to move to a new, standalone spec in the
W3C Web Applications WG:

  http://lists.w3.org/Archives/Public/public-webapps/2008OctDec/0009.html

I’ve filed a bug for their return values:

  https://issues.apache.org/bugzilla/show_bug.cgi?id=45947

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: how to export images from a svg file

2008-10-04 Thread Cameron McCormack
jdomuser:
 Hello, i have downloaded all .jar files related to batik. I need to retrieve
 images from a svg file and save them to disk. I convert swf to svg by using
 openoffice converter. 
 How can i retrieve images from the svg representation and save them to disk?
 thanks in advance.

If you want to convert SVG files to a raster image format, like PNG or
JPEG, you can use the command-line rasterizer tool:

  http://xmlgraphics.apache.org/batik/tools/rasterizer.html

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Batik and Rhino 1.6R7

2008-10-02 Thread Cameron McCormack
Hi Praveen.

Praveen Nayak:
 Sorry, attached now. It was essentially the problem with settimeout put 
 into an SVG file.

So it seems that with the tightened up class shutter of Rhino 1.6R7, the
objects that are returned from setTimeout(), setInterval() are being
flagged as inaccessible from script.  This is because the class names
are org.apache.batik.bridge.ScriptingEnvironment$Window$3 and similar,
and in org.apache.batik.script.rhino.RhinoClassShutter, any class that
begins with org.apache.batik.script.rhino.ScriptingEnvironment is
disallowed.

Technically, these functions should return integers that identify the
timeout/interval, rather than TimerTask objects.  So that will probably
change at some point, which’ll get around the problem here.

But in the meantime I’ve committed a change to get this to work in Rhino
1.6R7.  I haven’t updated the js.jar from 1.6R5 in the repository yet.

  http://svn.apache.org/viewvc?view=revrevision=701300

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Threading clarifications

2008-09-29 Thread Cameron McCormack
Hi Thomas.

Thomas DeWeese:
  Canvas listeners (like GVTTreeBuilderListener) are fired in the Swing
  event dispatch thread, yes?
 
Uhh, yes I think.  Something tickles the back of my memory that
 we didn't fire all of those listeners in the Swing thread (which
 is probably a bug).  It may be that they were fixed however.

OK.

  And how about public methods on the BridgeContext: do they need to be
  done in the UpdateManager?s RunnableQueue too?  For example, if I call
  BridgeContext.getGraphicsNode(), will that need to be in the
  RunnableQueue because the elementNodeMap will possibly be modified
  because of document modifications in the UpdateManager thread?
 
Correct, the Bridge context is effectively part of the DOM.
 Since you mention getGraphicsNode I'll extend that statement to
 also include the GVT tree... So all GVT methods should also be
 called in the UpdateManager's thread.

Gotcha.

Hope that helps.

It does, thanks!

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Batik 1.8 unknown language error

2008-09-18 Thread Cameron McCormack
Hi John.

John C. Turnbull:
 Here's the complete exception:
 
 java.lang.Exception: Unknown language: text/ecmascript
   at 
 org.apache.batik.bridge.BridgeContext.getInterpreter(BridgeContext.java:575)
   at 
 org.apache.batik.bridge.BaseScriptingEnvironment.getInterpreter(BaseScriptingEnvironment.java:320)
   at 
 org.apache.batik.bridge.BaseScriptingEnvironment.getInterpreter(BaseScriptingEnvironment.java:316)
   at 
 org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoad(BaseScriptingEnvironment.java:639)
   at 
 org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoad(BaseScriptingEnvironment.java:612)
   at 
 org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoadEvent(BaseScriptingEnvironment.java:599)
   at 
 org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(UpdateManager.java:239)
   at 
 org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(UpdateManager.java:220)
   at 
 org.apache.batik.swing.svg.SVGLoadEventDispatcher.run(SVGLoadEventDispatcher.java:100)
 
 I see that InterpreterPool has a method putInterpreterFactory() but
 according to NetBeans Find Usages it's never being called in the
 source the way I have it set up.

The factories are added in the static code block in InterpreterPool, and
the factories themselves are discovered via a service provider
interface.  The file that specifies the factories to create is
resources/META-INF/services/org.apache.batik.script.InterpreterFactory.
You’ll need to ensure that resources/ directory is available on the
classpath so that it can be found by the code in that static block.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Accessing CSS style of SVG elements from java code

2008-09-05 Thread Cameron McCormack
Hello Matiouz.

Matiouz Matiouz:
 I'm using batik 1.7 under windows, and I'm programming in java 5.0.
 
 I'm trying to read the css style of elements (circle, rectangle) 
 contained in an SVG file.
 I can iterate through all these elements but I can't find their style.

You’ll need to “boot the CSS engine” to get Batik to compute the CSS
information:

  http://wiki.apache.org/xmlgraphics-batik/BootSvgAndCssDom

Once the graphics tree is built (that last builder.build(…) line) calls
to CSS and SVG DOM methods should work.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Batik feature and performance query

2008-09-03 Thread Cameron McCormack
Hello Steve.

Steve Peterson:
 I'm sure I'll have more questions, but the ones I have now are:

 1.  I'd like to be able to wrap Batik in a simple web service that  
 accepts as input a SVG document, and returns a JPEG -- kind of like the 
 SVG Rasterizer but http focused.  Is there a common way of doing this?

Yes, if you run a Java servlet container (like Jetty or Tomcat) you can
rasterise upon fetching of an HTTP URL.  I wrote a short servlet
example:

  http://mcc.id.au/2007/09/batik-course/code/transcoding-servlet/

The actual Java source under that directory
(WEB-INF/classes/TranscodingServlet.java) shows how you can grab three
request parameters (that would come via the query string in a GET, or
from the form post body with a POST), do some rasterisation based on
that, then spit out the raster back to the browser.

 2.  I stripped the sydney.svg sample document of the interactive  
 features and filter effects, and find that I can render it about once a 
 second using the SVG Rasterizer (rendering 10 copies and averaging) on my 
 notebook (Core Duo T7500 and JDK 1.6).  Is this typical performance?

Are you invoking the JVM each time here?  If so, then yes that would be
typical performance, because JVM startup would take up nearly all of
that time.  You need to have the JVM still running and the classes
loaded to get the best performance.  This is what you will get if you
use the servlet (or some equivalent) approach.

 3.  What's the best way to get good performance out of Batik?  Does it 
 make good use of multicore machines?  Are there opportunities to  
 leverage video card support to improve performance?

Batik doesn’t do anything specific to support multicore or hardware
graphics.  Assuming the JVM you’re running on does it correctly, using
multiple Java threads should help you if you are performing multiple
rasterisations simultaneously.  (And that’s what should happen when
using a servlet — each HTTP request should spawn a new thread.)  As for
the video card, as far as I know that Java2D classes from Sun don’t use
hardware acceleration.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Quick batik question

2008-09-02 Thread Cameron McCormack
Hello Miguel.

Miguel Bento:
 The SVG content is stored as a string, passed as an argument, and i wanted
 to use Batik to construct a GVT tree, so that i could then iterate the tree,
 and construct the Graphic Objects in my application. Pretty simple.. but, i
 only found examples using URI to construct the GVT tree.. so any
 help/pointers would be appreciated.

To get an SVGDocument instance from your string, you’ll need to use the
SAXSVGDocumentBuilder class, like this, assuming ‘content’ has your SVG
content as XML:

  import org.apache.batik.dom.svg.SAXSVGDocumentFactory;
  import org.apache.batik.util.XMLResourceDescriptor;
  import java.io.StringReader;
  …
  String content = …;
  SAXSVGDocumentFactory f = new 
SAXSVGDocumentFactory(XMLResourceDescriptor.getXMLParserClassName());
  SVGDocument doc = f.createSVGDocument(null, new StringReader(content));

(Untested code, but should be the right approach.)  And once you have
the SVGDocument instance, you can do the stuff from your example to
build the graphics tree (using GVTBuilder).

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: SVG file not animating

2008-08-09 Thread Cameron McCormack
Hi John.

John C. Turnbull:
 I have attached a fairly simple SVG that is supposed to display a cute
 melting text animation but it's not animating with Batik 1.7 even though
 there are no errors reported.
 
 Is there a reason why it's not animating with Batik?

Yes.  While Batik supports animation of most things, it doesn’t yet
support animation of referenced resources, such as filters, which is
what this document uses.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Interactive map doesn't display in Batik 1.7

2008-08-09 Thread Cameron McCormack
Hi John.

John C. Turnbull:
 I came across this SVG in a web site that is supposed to display an
 interactive map but when I view it in Squiggle all I see is the Squiggle
 logo.  As there are no errors I don't know how to determine why it is not
 displaying properly.
 
 Can someone else try to open it and let me know why it doesn't display the
 map?

This document uses the CSS pseudo classes :hover and :focus to show and
hide the map as you move the mouse, but Batik doesn’t yet implement
those pseudos.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Interactive map doesn't display in Batik 1.7

2008-08-09 Thread Cameron McCormack
John C. Turnbull:
 Thanks for the info Cameron.
 
 Are there any plans to enable support for this and the animation of
 filters?

In general yes, but I think the main developers don’t have enough
bandwidth for feature development at the moment, so it might be a while.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Batik 1.7 text rendering issues

2008-08-07 Thread Cameron McCormack
Hi John.

John C. Turnbull:
 That property could be useful but how can it determine which type of
 monitor is connected to the Desktop? I think the optimal rendering
 hints for text depend on the monitor and especially whether it's CRT
 vs. LCD.

I think that it queries the OS for the settings (e.g. in the Gnome
Appearance Preferences window, or the Display control panel in Windows).
I don’t know whether particular OSes can get that infomration directly
from the monitor.

 I think the only reliable option is, as has already been suggested,
 to provide the user with a text tuning screen which displays text
 rendered using the various hints and allows them to select the most
 legible one.

If that information isn’t available via this desktop property, then yes,
that’s what would be needed.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Batik 1.7 text rendering issues

2008-08-06 Thread Cameron McCormack
Cameron McCormack:
  [enabling subpixel antialiasing]

Thomas DeWeese:
I don't have anything against this (as it's a fairly simple thing to
 enable through reflection) but do you know how to determine which of the 
 4 LCD dot patterns to use?

I’m not sure, but perhaps the awt.font.desktophints desktop property can
provide this information:

  
http://java.sun.com/javase/6/docs/api/java/awt/doc-files/DesktopProperties.html

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Batik 1.7 text rendering issues

2008-08-05 Thread Cameron McCormack
John C. Turnbull:
 Thanks Thomas, making the change you suggested works just great J And
 I think it makes a big difference too.

It may be worth using reflection to enable this for 1.6, while still
maintaining support for ≤ 1.5.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Bugfix

2008-08-05 Thread Cameron McCormack
Hi Paul.

Paul Solomon:
 What is the best way to submit bugfixes? I have found one so far
 working with batik in the following file. The fix is below

Please create a bugzilla entry with the fix, so that it is not
forgotten:

  https://issues.apache.org/bugzilla/enter_bug.cgi?product=Batik

Thanks,

Cameron

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: a0:space=preserve

2008-08-01 Thread Cameron McCormack
Helder Magalhães:
 These are good news! :-) Could I add Batik's XHR support as underway
 in the SVG implementations Viewer Matrix [1] (Communication row) or
 is it just too soon? ;-)

Well I probably won’t get time to work on it for a while (at least a few
months), so I think it would be premature to mention.

 At least temporarily (I hope), I had to stall my XHR experiments
 regarding Web browser applet integration... :-(
 
 I've stated something related in a SVG-WG mailing list thread [2] (and
 in some IRC sparkles), where I strongly feel that making the
 communication methods homogeneous for SVG would potentially cause an
 SVG implementations deployment boost. XHR support by Batik would
 surely be a helper here. Weirdly enough, at least for me, my post [2]
 hasn't received any feedback to date. Probably I'll ping the SVG-WG
 mailing list in a few weeks as I'd love to see an official position on
 this (high priority, IMO) subject. :-)

I agree that it is good to have consistency across implementations!
Now, I think that Batik’s getURL() won’t quite match the requirements in
1.2T, but it should be good enough for casual use, and I know that
people do use it.  I think having XHR implemented also will make it
easier for people coming from AJAX in an HTML browser world.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: a0:space=preserve

2008-08-01 Thread Cameron McCormack
Cameron McCormack:
 Yes that’s my fault. :-)  Filed a bug for me to get to on the weekend:

OK should be fixed now (got to it before the weekend):

  http://svn.apache.org/viewvc?view=revrevision=681609

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: a0:space=preserve

2008-07-31 Thread Cameron McCormack
Hi Helder.

Thomas DeWeese:
 My guess would be as a result of serializing an SVG that
  had it's xml:space attribute set like this:
 
  e.setAttributeNS(XML_NS, space, preserve);
 
 The serializer is probably creating the namespace
  prefix 'a0' since you didn't provide one.  If I'm right you
  should set the xml:space attribute with:
 
  e.setAttributeNS(XML_NS, xml:space, preserve);

Helder Magalhães:
 Could you provide a pointer where this is stated? That is, the need to
 insert the external namespace prefix (xml:). I've searched for it in
 the specification [1] but, apparently according to the qualifier name
 definition [2], the prefix is labeled optional... Also, I wasn't able
 to find related material within the pointer [3] provided by Cameron.

Right, it’s optional to provide a prefix in there.  The serialiser at
it’s written (well, when the bugs are ironed out) will use the given
prefix if it correctly corresponds to the namespaceURI of the attribute.
Otherwise, it will look up an existing prefix, and if one doesn’t exist,
it’ll create one (the “a0” that emzic found).

The “xml” prefix is always assumed to be declared, can optionally be
explicitly declared (as long as it has the right namespace URI) but must
not be bound to a different prefix.  That’s where the bug comes in.

(“xmlns” on the other hand must never be declared.)

 Are there strong reasons to always use the namespace prefix (plus the
 colon) within Batik or any other known implementation(s)? Should this
 question be taken to the SVG Developers [4] forum?

Although setting the prefix doesn’t affect what namespaceURI the node is
in, it will make it easier for you to get out a namespace well-formed
document from a naive serialiser.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: minimal classes needed to use JSVGCanvas in applet

2008-07-16 Thread Cameron McCormack
Hi Helder.

Helder Magalhães:
 I haven't yet found a place in the dependency graph for
 batik-anim.jar (or batik-codec.jar, but that's not required to
 view SVG content). I recall a thread on the subject [2] but no
 conclusion was reached. Could anyone suggest the order for these?

My reply to that thread shows how to extract the current dependencies
from the code:

  http://markmail.org/message/oqh2ucqnzj47cl7w

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: svg event on text value change

2008-07-16 Thread Cameron McCormack
Nirmesh Desai:
 Is there an event for 'text' node's value change?

Yes, you can listen for a DOMCharacterDataModified event:

  http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-MutationEvent

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: svg event on text value change

2008-07-16 Thread Cameron McCormack
Hi Nirmesh.

Nirmesh Desai:
 Is there a place where I can add this listener to appropriate nodes?
 
 Currently onload throws error in batik saying the function not found.

Here’s an example:

svg xmlns='http://www.w3.org/2000/svg' width='400' height='300' font-size='18'
  title id='title'Initial title/title
  text x='20' y='30'Document title: “tspan id='t' /tspan”/text
  rect x='20' y='60' width='30' height='30'
onclick='title.firstChild.nodeValue = Hello!'/
  text x='60' y='80'← click to change title/text
  script
var title = document.getElementById('title');
var t = document.getElementById('t');
function update(evt) {
  t.firstChild.nodeValue = title.firstChild.nodeValue;
}
title.addEventListener('DOMCharacterDataModified', update, false);
update();
  /script
/svg

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: WHITE LIST

2008-06-25 Thread Cameron McCormack
Hi Jonathan.

Jonathan Chetwynd:
 please can you white list contributors?

 I find at least 50% of my mail bounces as spam, but only on this
 list...

Do you mean the batik-users mailing list?  Only subscribers to the list
can post; mail from others (e.g. spammers) should be held for moderation
before being allowed to be distributed to subscribers.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: rasterize on server

2008-06-24 Thread Cameron McCormack
Hi Bruce.

Bruce Rindahl:
 I am trying to do something similar as described below but using the  
 PDFTranscoder.  I modified the code as follows:
…
TranscoderInput input = new TranscoderInput(request);
…
 TranscodingServlet.java:24 cannot find symbol
 symbol   :   construction  
 TranscoderInput(javax.servlet.htto.HttpServletRequest)
 location : class org.apache.batik.transcoder.TranscoderInput
TranscoderInput input = new TranscoderInput(request);

The TranscoderInput constructor needs to take a Reader (or Document,
InputStream, String or XMLReader):

  
http://xmlgraphics.apache.org/batik/javadoc/org/apache/batik/transcoder/TranscoderInput.html

You can get a Reader from the HttpServletRequest object:

  
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpServletRequest.html

So you need to write:

  TranscoderInput input = new TranscoderInput(request.getReader());

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: xbean reference?

2008-06-18 Thread Cameron McCormack
Hi Praveen.

Praveen Nayak:
 When I host batik-all.jar and the related jars in an applet, there are
 sometimes requests for xbean.jar made to the server. But xbean.jar is
 not a part of the batik source and libraries I downloaded. Should I be
 including something else as well to stop these calls?

It seems that the Rhino JAR includes xbean.jar in its manifest’s
Class-Path entry.  (I think xbean.jar is used for the Bean Scripting
Framework http://www.mozilla.org/rhino/bsf.html.)  I think you could
avoid these requests by editing the manifest of js.jar to remove this
dependency.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: keyboard navigation?

2008-06-16 Thread Cameron McCormack
Jonathan Chetwynd:
 is there keyboard navigation?

No, per the bug you filed:

  https://issues.apache.org/bugzilla/show_bug.cgi?id=41993

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Latest release of batik with maven2

2008-06-13 Thread Cameron McCormack
Lars Eirik Rønning:
 I am unable to find the 1.7 release of batik when using maven.
 Is this not available at the moment?

The groupid changed from 1.6 to 1.7, to org.apache.xmlgraphics:

  http://repo1.maven.org/maven2/org/apache/xmlgraphics/

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: batik, ecmascript DOM?

2008-06-07 Thread Cameron McCormack
Jonathan Chetwynd:
 what's the difference between application and text in the ecmascript  
 header? chose text.

Not much.  application/ecmascript has some well-defined encoding
detection that the others don’t.

  http://www.ietf.org/rfc/rfc4329.txt

 It's not clear to me why the script appears to stall in batik
 wfm Opera and ff.

The file at http://www.openicon.org/irc/ircwithIcon.svg still seems to
create a script element dynamically, which I mentioned earlier
(http://markmail.org/message/vqlrhr6skysd6sg5) will not work.

The file you included include does work though.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: batik, ecmascript DOM?

2008-06-06 Thread Cameron McCormack
Jonathan Chetwynd:
 would squiggle cater with:
 Header(content-type: application/x-javascript);

No, it needs to be one of:

  text/javascript
  text/ecmascript
  application/javascript
  application/ecmascript

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: batik, ecmascript DOM?

2008-06-06 Thread Cameron McCormack
Cameron McCormack:
 Jonathan Chetwynd:
  would squiggle cater with:
  Header(content-type: application/x-javascript);
 
 No, it needs to be one of:
 
   text/javascript
   text/ecmascript
   application/javascript
   application/ecmascript

But actually that’s just for the script elements; I think the header
is ignored.

So taking a look at your document, the issue is that script elements
that are appended to the document are not executed.  If you want to run
some script dynamically, you’ll have to use eval().

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Reading Entities with ECMAScript in Batik

2008-06-05 Thread Cameron McCormack
Hi Martin.

Martin Asal:
 how can I read an entity value with ECMAscript? If there is

 !ENTITY foo bla

 this should give bla:

 document.doctype.entities.getNamedItem(foo).firstChild.nodeValue

 But this doesn't work in Batiks ECMAscript.

Yeah, Batik’s DOM builder doesn’t capture the right SAX events to fill
in document.doctype.entities yet.  I see that the DeclHandler interface
exposes entity declaration parse events:

  http://www.saxproject.org/apidoc/org/xml/sax/ext/DeclHandler.html

but that it is an extension to SAX.  I’d have to investigate to see if
Xerces (the SAX implementation we bundle) implements this extension.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Repainting a JSVGCanvas

2008-05-31 Thread Cameron McCormack
 :
 No, because this method is only called before the first rendering.

OK.  Are you able to provide me with an SVG document that (if used by a
simple program that just displays a JSVGScrollPane in a resizable
window) demonstrates the problem?

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Repainting a JSVGCanvas

2008-05-31 Thread Cameron McCormack
 :
 I have following classes (SVGArea and SVGAreaPainter) which displays
 the document. The SVGArea is used by the SVGAreaPainter. The
 SVGAreaPainter has a lot methods. The one that makes the mouseover
 effect for some elements is

   private void addMouseOverEffect(Element el, String color) {
   Element mouseOver = doc.createElementNS(svgNS, set);
   mouseOver.setAttributeNS(null, attributeName, fill);
   mouseOver.setAttributeNS(null, attributeType, XML);
   mouseOver.setAttributeNS(null, to, color);
   mouseOver.setAttributeNS(null, begin, mouseover);
   el.appendChild(mouseOver);
   Element mouseOut = doc.createElementNS(svgNS, set);
   mouseOut.setAttributeNS(null, attributeName, fill);
   mouseOut.setAttributeNS(null, attributeType, XML);
   mouseOut.setAttributeNS(null, to, el.getAttribute(fill));
   mouseOut.setAttributeNS(null, begin, mouseout);
   el.appendChild(mouseOut);
   }

Are these changes being made in the UpdateManager’s thread?  If not,
then it might explain the problem.  See:

  http://xmlgraphics.apache.org/batik/faq.html#N10215

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: skipping unknown functions

2008-05-29 Thread Cameron McCormack
Hi Martin.

Martin Zdila:
 Is this feature actually planned? If yes, then when do you expect it?

It’s something I’d like to do, but really have no time for for a while.

 Just to let you know, I am using CSS parsing library to parse ugly and wild 
 CSS found in the many WWW pages on the Internet. The result is DOM (using 
 JXCSS library). Then I extract some information and modify the DOM. Finally I 
 transcode DOM back to CSS using XSLT and send it back to browser. Our tool is 
 something like special HTTP proxy.

OK.

 Unfortunately there are many ugly CSS documenst on the Internet and Batik CSS 
 parser error handling is very different from that found in the major 
 webbrowsers. Maybe if you know about better CSS parsing library... ;-)

Of course, you’re always welcome to contribute code to add forwards-
compatible parsing to Batik’s CSS parser.  Just Googling I can find a
couple of other CSS engines in Java, but I don’t know how good they
might be.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Repainting a JSVGCanvas

2008-05-28 Thread Cameron McCormack
 :
 the problem is that I get occasionally a NullPointerException in the
 ScrollListener of the JSVGCanvas. The variable newview is null in
 the updateCompleted method .

Hmm.  I’m not sure what would cause getViewBoxRect() to return null if
all you are doing is resizing, unless there’s a threading issue.

 Rectangle2D newview = getViewBoxRect();
 
 So sometimes the canvas gets white and it has to be repaint. It's
 immediatly repainted when I resize the frame or when I'm using the
 scrollbars. But I've inserted

 if (newview == null) {
   
 canvas.getUpdateManager().getUpdateRunnableQueue().invokeLater(new Runnable() 
 {
 
   @Override
   public void run() {
   canvas.repaint();
   }
 
   });
   return;
   }
 
 and this does not have any effect. Another solution maybe would be to
 avoid to get the Exception. But I don't see what I'm doing wrong.

I don’t think calling canvas.repaint() is the right thing to fix the
problem.  It sounds like there is a problem with JSVGScrollPane or
JSVGCanvas.  Are you able to provide a reduced test case that
demonstrates the problem (perhaps just loading a small SVG document in a
JSVGScrollPane/JSVGCanvas, where continually resizing it will trigger
the bug)?

Thanks,

Cameron

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Manipulation of existing svg document

2008-05-28 Thread Cameron McCormack
Hi Lars.

Lars Eirik Rønning:
 I have an existing svg document where some of the nodes act as placeholders.
 Basically these placeholders will be replaces with base64 encoded images.
 
 1:Are there any convenience methods for adding images to an svg document or
 do i have to manually base64encode the stream and add all attributes such as
 widht and height?
 I have already added an element using the SVGConstant for Images, but to mee
 this still looks like its more or less the same as using any other
 xmldocument.

If you have, say, a BufferedImage and you want to convert it into a
data: URI, you can do the following:

  BufferedImage img = …;

  ByteArrayOutputStream bytes = new ByteArrayOutputStream();
  Base64EncoderStream b64 = new Base64EncoderStream(bytes);
  PNGImageEncoder enc = new PNGImageEncoder(b64, null);
  enc.encode(img);
  b64.close();

  String uri = data:image/png;base64, + bytes.toString();
  
Then you can construct a new image element and set its xlink:href=
attribute to that URI.  This is essentially what the SVGGraphics2D class
does when it gets a drawImage() call.

 If there are any guides or tutorials to using dom for handling images i am
 very happy to receive some pointers..
 2:One of my concerns is that i probably have to add the transformation
 matrix myself. I was hoping that there could be some convenience methods
 which would help me on my way for doing these types of operations.
 Is the transformation matrix necessary in order for the image (or any
 element) to be visible in a svg document?

I’m not quite sure what you want to achieve, so I don’t know whether you
need to set a transform=' on the image elements or not.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Manipulation of existing svg document

2008-05-28 Thread Cameron McCormack
Lars Eirik Rønning:
 Thanks for helping.
 I actually wish to only open the file and get its base64encoding. Note that
 in my case i do not have  bufferedImage, i merely wish to open the fileURI
 and have the bytes encoded to base64.
 I have found a base64Enocder class which may be used (org.apache.codec)

I’m not sure which class you are referring to here.  (Batik doesn’t have
a class called Base64Encoder.)

 As i understand it the Base64EncoderStream class in Batik requires an
 renderedImage as input, but this is not what i am looking at.

No, it doesn’t (PNGImageEncoder does).  You can write whatever bytes you
like to a Base64EncoderStream and it will output them as the base 64
bytes.  So it sounds like you just want to open a FileInputStream and
feeds its bytes to a Base64EncoderStream.

 If i also understand you correct, the transform element is not required in
 order for an image to appear, only if i wish to do some transformation to
 the image, such as translating it or skewing and so forth.

That’s right.  You will have to give it a width= and height=
attribute (and probably an x= and y=, too) to tell it where in your
document it should render.

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: css parser bug?

2008-05-27 Thread Cameron McCormack
Hi Martin.

Martin Zdila:
  i want to use css parser from batik project. unfortunately i've found one
  issue. the problem is that FOO[attr] #bar selector is parsed
  as FOO[attr]#bar. is that a bug or am i missing something?
 
 i found out this is really a bug. it can be fixed by applying attached patch.

 Index: sources/org/apache/batik/css/parser/Parser.java
 ===
 --- sources/org/apache/batik/css/parser/Parser.java   (revision 660421)
 +++ sources/org/apache/batik/css/parser/Parser.java   (working copy)
 @@ -724,7 +724,7 @@
  default:
  throw createCSSParseException(right.bracket);
  case LexicalUnits.RIGHT_BRACKET:
 -nextIgnoreSpaces();
 +next();
  c = conditionFactory.createAttributeCondition
  (name, null, false, null);
  break;
 

That patch looks good and I’ve applied it, thanks!

Cameron

-- 
Cameron McCormack ≝ http://mcc.id.au/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



  1   2   3   4   >