Keywan,
Take a look through the archive for emails with the subject Re:
JSVGCanvas.setRenderingTransform(). Sounds like they might apply to you.
I also recommend looking through the Batik source code at the ViewBox
class, where various getPreserveAspectRatioTransform() methods are
defined to help you generate useful transformations that can be
passed to setRenderingTransform().
The main trick in this is to undo the current viewing transformation
by getting it (getViewingTranform() method), inverting it, and
applying it (setRenderingTransform()). Then you can apply your own
transformation to zoom the way you want. (You can concatenate
transformations to make this only one call to setRenderingTransform
()). I tried very hard to write my own before getting help from
Thomas and using the static methods in the ViewBox class. I recommend
you just figure how to use the transformations returned by
ViewBox.getPreserveAspectRatioTransform() methods rather than trying
to roll your own. They are pretty logical though, and knowing what I
know now it probably wouldn't be so hard.
Don't know about SVGGraphics2D, so I leave that to someone else.
Regards,
Randy
On Jun 22, 2007, at 12:34 PM, Keywan Najafi Tonekaboni wrote:
Hi,
since I added a JSVGCanvas in my JFrame, the frame itself keeps
"empty"
until I resize the window, after the canvas was build completly
(SVGDocument&SVGGraphics2D generated and added). At the moment I use a
small hack, to resize the frame, after all was generated.
I have another question about zooming the document. Is there
anywhere a
property, which saves the current canvas zoom?
Is it possible to change the zoom absolute and not relativ? For
example
I would set it back to the original size. Or would implement a
combobox,
like in Evince (Gnome PDF Viewer) with "50%", "100%", "200%" etc.
If I wand zoom features like "Fit in Page", " Fit in width", must I
implement them by my own, or is there already a class.
I have another question related to SVGGraphics2D. I want to draw a
rect,
filled with a transparent color and a non-transparent black stroke,
At the moment I draw it this way:
svgG2D.setPaint(Color.BLACK);
BasicStroke stroke = new BasicStroke((float)1.5);
svgG2D.setStroke(stroke);
svgG2D.draw(shape);
svgG2D.setPaint(new Color(255, 0, 0, 64));
svgG2D.fill(shape);
I guess this is not the most intelligent solution...
Thanks for your help.
Regards,
Keywan
--
Keywan Najafi Tonekaboni
http://www.prometoys.net
[EMAIL PROTECTED]:/# apt-get --purge remove dominion
After unpacking world will be freed.
You are about to do something potentially beneficial
To continue type in the phrase 'Yes, do as We say!'
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: batik-users-
[EMAIL PROTECTED]