You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Michael Mikic <mi...@lmr.khm.de> on 2003/08/13 15:33:59 UTC

JSVGCanvas in a JScrollPane again....

Hello!

I want to put the JSVGCanvas into a JScrollPane. I'm using batik-1.5b5 
(should be a CVS Version from 2 days ago). I'm using the class 
JSVGViewerFrame and modified it a little because I do not need all 
functions apart from zooming, panning and printing. I've done a subclass 
extending the JSVGCanvas and implemented the Scrollable Interface. All 
works fine as long I just do nothing else than scrolling with the thumbs 
of the JScrollPane.

My problem now is to update the thumbs of the JScrollPane whenever I 
zoom into/out of the canvas or whenever I pan the canvas.

I've noticed some approachs here but I cannot get it work for my panel. 
Does anyone have a solution? Maybe a code sample?

Thanks in advance,

Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


RE: JSVGCanvas in a JScrollPane again....

Posted by Zach DelProposto <zs...@umich.edu>.
> I am in kind-of a bind and would love to help out in any way, if that
> might speed up the process. '

I will send it to you wednesday. Feel free to send me a private email to
ensure that that is done.

>
> I could use the current solution, but, when I zoom in, the document gets
> clipped.
>
> I think the clipping is because the canvas is always the document size.
> Something clips it so it will not draw bigger than the canvas.  So when
> the viewport is bigger than the document's native size, and the document
> is being displayed at more than 100% normal size, the document gets
> clipped.  The viewable image is never bigger than the document's native
> size.
>
> I have gone through Batik and tried to change the rendering size to no
> avail.  I am starting to think the clipping is coming from one of the
> java.awt or javax.swing classes.  Changing the canvas size, however,
> causes Batik to rescales the image again.
>
> Does your new "scroll pane" address this issue or is this a separate
> problem?
>

Currently, the way it works (from memory) is:
	a) document is scaled to fit (aspect ratio maintained) in window
	b) user may zoom, pan, or enlarge/reduce window
	c) if window is enlarged (and, lets say, the document is being
		magnified 200%), no clipping will occur.

however, because the viewbox transform is changed by Batik (via
updateRenderingTransform()) the scroll position / translate position is
not quite right, and, clipping can occur. The current scroll code has this
problem. That's why I need to override and modify the
updateRenderingTransform() method. (I only recently figured this out from
this list and some of my own investigation).

This can be eliminated (no clipping) if after a resize of the window
(canvas) the viewbox transform is reset (scaled into the window). Then
when a zoom occurs (which is via the rendering transform), no clipping
will occur (I'm fairly certain of this).




---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


RE: JSVGCanvas in a JScrollPane again....

Posted by Mark Claassen <ma...@donnell.com>.
I am in kind-of a bind and would love to help out in any way, if that
might speed up the process. '

I could use the current solution, but, when I zoom in, the document gets
clipped.

I think the clipping is because the canvas is always the document size.
Something clips it so it will not draw bigger than the canvas.  So when
the viewport is bigger than the document's native size, and the document
is being displayed at more than 100% normal size, the document gets
clipped.  The viewable image is never bigger than the document's native
size.

I have gone through Batik and tried to change the rendering size to no
avail.  I am starting to think the clipping is coming from one of the
java.awt or javax.swing classes.  Changing the canvas size, however,
causes Batik to rescales the image again.

Does your new "scroll pane" address this issue or is this a separate
problem?

Mark

> -----Original Message-----
> From: Zach Del [mailto:zsd@umich.edu] 
> Sent: Monday, August 18, 2003 5:38 PM
> To: Batik Users
> Subject: Re: JSVGCanvas in a JScrollPane again....
> 
> 
> Michael Mikic wrote:
> 
> > Hello Zach!
> >
> > Yes, I would be interested in a newer version. Could you please mail
> > it me?
> >
> Sure ... but not yet. It's undergoing some final touches. It also no 
> longer uses JScrollPane, but a mimic, because JScrollPane 
> sends too many 
> update messages from the scrollbar, which (on complex SVG documents) 
> take too long to render.
> 
> Zach
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: JSVGCanvas in a JScrollPane again....

Posted by Zach Del <zs...@umich.edu>.
Michael Mikic wrote:

> Hello Zach!
>
> Yes, I would be interested in a newer version. Could you please mail 
> it me?
>
Sure ... but not yet. It's undergoing some final touches. It also no 
longer uses JScrollPane, but a mimic, because JScrollPane sends too many 
update messages from the scrollbar, which (on complex SVG documents) 
take too long to render.

Zach


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


RE: JSVGCanvas in a JScrollPane again....

Posted by Mark Claassen <ma...@donnell.com>.
We would be interested as well.  Thanks!

> -----Original Message-----
> From: Michael Mikic [mailto:mikic@lmr.khm.de] 
> Sent: Monday, August 18, 2003 5:02 AM
> To: Batik Users
> Subject: Re: JSVGCanvas in a JScrollPane again....
> 
> 
> Hello Zach!
> 
> Yes, I would be interested in a newer version. Could you 
> please mail it me?
> 
> Thanks,
> 
> Michael
> 
> 
> Zach DelProposto wrote:
> 
> >thanks
> >
> >if people are interested, I have a newer version with fewer 
> bugs, that 
> >works better with batik 1.5. It also (I don't think the old version 
> >does?) fixes a problem with 'too many' updates via the scrollbars.
> >
> >However, Batik has an annoying habit of changing the viewbox 
> transform 
> >to fit the SVG into the viewbox (even if the SVG is already zoomed), 
> >which I plan to work-around soon. This causes improper 
> translation of 
> >the image when the window is resized.
> >
> >Zach
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: JSVGCanvas in a JScrollPane again....

Posted by Michael Mikic <mi...@lmr.khm.de>.
Hello Zach!

Yes, I would be interested in a newer version. Could you please mail it me?

Thanks,

Michael


Zach DelProposto wrote:

>thanks
>
>if people are interested, I have a newer version with fewer bugs, that
>works better with batik 1.5. It also (I don't think the old version does?)
>fixes a problem with 'too many' updates via the scrollbars.
>
>However, Batik has an annoying habit of changing the viewbox transform to
>fit the SVG into the viewbox (even if the SVG is already zoomed), which I
>plan to work-around soon. This causes improper translation of the image
>when the window is resized.
>
>Zach
>



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: PathLength.pointAtLength returns NULL

Posted by John Greene <jo...@rpiwireless.com>.
John Greene wrote:

> I pass PathLength.pointAtLength a perfectly valid value (somewhere in 
> the middle of the total length of the path) and it returns a null.
> I did just instantiate the PathLength object. Might it not be done 
> processing my path? Is that it?
>
>
> oops. Ignore that. I was indeed seeking a point beyont the end of my 
> curve.





---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


PathLength.pointAtLength returns NULL

Posted by John Greene <jo...@rpiwireless.com>.
I pass PathLength.pointAtLength a perfectly valid value (somewhere in 
the middle of the total length of the path) and it returns a null.
I did just instantiate the PathLength object. Might it not be done 
processing my path? Is that it?



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: JSVGCanvas in a JScrollPane again....

Posted by Thomas DeWeese <Th...@Kodak.com>.
Zach DelProposto wrote:
>>Thanks for your replies!
>>
>>I made it work with the classes JSVGScrollCanvas and with the
>>JSVGViewport done by Zachary DelProposto!! Greetings to Zach.
> 
> 
> thanks
> 
> if people are interested, I have a newer version with fewer bugs, that
> works better with batik 1.5. It also (I don't think the old version does?)
> fixes a problem with 'too many' updates via the scrollbars.
> 
> However, Batik has an annoying habit of changing the viewbox transform to
> fit the SVG into the viewbox (even if the SVG is already zoomed), which I
> plan to work-around soon. This causes improper translation of the image
> when the window is resized.

    The canavs tries to keep the center point the center point, the
magnification does change a bit usually but the center of the canvas should
stay the center of the canvas.  Anyway this should be fairly easy to
change just override updateRenderingTransform.



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: JSVGCanvas in a JScrollPane again....

Posted by Zach DelProposto <zs...@umich.edu>.
> Thanks for your replies!
>
> I made it work with the classes JSVGScrollCanvas and with the
> JSVGViewport done by Zachary DelProposto!! Greetings to Zach.

thanks

if people are interested, I have a newer version with fewer bugs, that
works better with batik 1.5. It also (I don't think the old version does?)
fixes a problem with 'too many' updates via the scrollbars.

However, Batik has an annoying habit of changing the viewbox transform to
fit the SVG into the viewbox (even if the SVG is already zoomed), which I
plan to work-around soon. This causes improper translation of the image
when the window is resized.

Zach


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: JSVGCanvas in a JScrollPane again....

Posted by Michael Mikic <mi...@lmr.khm.de>.
Thanks for your replies!

I made it work with the classes JSVGScrollCanvas and with the 
JSVGViewport done by Zachary DelProposto!! Greetings to Zach.

Michael

Joseph Foster wrote:

>For a credit where credit is due correction: The JSVGScrollCanvas we
>used is by Zachary DelProposito
>
>  
>
>>-----Original Message-----
>>From: Mark Claassen [mailto:mac@donnell.com] 
>>Sent: Thursday, August 14, 2003 1:52 PM
>>To: 'Batik Users'
>>Subject: RE: JSVGCanvas in a JScrollPane again....
>>
>>
>>I am not sure what your exact problems were, but we have had 
>>pretty good luck with the JSVGScrollCanvas.  To zoom we simply do
>>
>>AffineTransform transform = 
>>(AffineTransform)canvas.getRenderingTransform().clone();
>>double newScale = <<whatever>>
>>transform.scale(newScale, newScale); 		
>>scrollCanvas.setRenderingTransform(transform);
>>
>>The JSVGScrollCanvas we used was by Jan Lolling, which can be 
>>found in the Batik mail archives.
>>
>>Mark
>>
>>
>>
>>
>>    
>>
>>>-----Original Message-----
>>>From: Thomas DeWeese [mailto:Thomas.DeWeese@Kodak.com]
>>>Sent: Thursday, August 14, 2003 12:34 PM
>>>To: Batik Users
>>>Subject: Re: JSVGCanvas in a JScrollPane again....
>>>
>>>
>>>Michael Mikic wrote:
>>>      
>>>
>>>>Hello!
>>>>
>>>>I want to put the JSVGCanvas into a JScrollPane. I'm using
>>>>        
>>>>
>>>batik-1.5b5
>>>      
>>>
>>>>(should be a CVS Version from 2 days ago). I'm using the class
>>>>JSVGViewerFrame and modified it a little because I do not 
>>>>        
>>>>
>>need all 
>>    
>>
>>>>functions apart from zooming, panning and printing. I've 
>>>>        
>>>>
>>>done a subclass
>>>      
>>>
>>>>extending the JSVGCanvas and implemented the Scrollable
>>>>        
>>>>
>>>Interface. All
>>>      
>>>
>>>>works fine as long I just do nothing else than scrolling
>>>>        
>>>>
>>>with the thumbs
>>>      
>>>
>>>>of the JScrollPane.
>>>>
>>>>My problem now is to update the thumbs of the JScrollPane 
>>>>        
>>>>
>>whenever I 
>>    
>>
>>>>zoom into/out of the canvas or whenever I pan the canvas.
>>>>        
>>>>
>>>     I would guess that if you override setMySize to call
>>>setPreferredSize(...), invalidate(), and then 
>>>window.validate() [or perhaps pack()] would update the thumbs 
>>>(one would hope).
>>>
>>>     For scrolling/panning I think you need to make sure you
>>>don't use Batik's pan (which updates the rendering transform) 
>>>but use the JSVGScrollPane to change the canvas's location 
>>>under the JViewport.
>>>
>>>      
>>>
>>>>I've noticed some approachs here but I cannot get it work for my
>>>>panel.
>>>>Does anyone have a solution? Maybe a code sample?
>>>>        
>>>>
>>>    Sorry no prepped solution, or code.
>>>
>>>      
>>>
>>>>Thanks in advance,
>>>>
>>>>Michael
>>>>        
>>>>



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


RE: JSVGCanvas in a JScrollPane again....

Posted by Joseph Foster <jl...@donnell.com>.
For a credit where credit is due correction: The JSVGScrollCanvas we
used is by Zachary DelProposito

> -----Original Message-----
> From: Mark Claassen [mailto:mac@donnell.com] 
> Sent: Thursday, August 14, 2003 1:52 PM
> To: 'Batik Users'
> Subject: RE: JSVGCanvas in a JScrollPane again....
> 
> 
> I am not sure what your exact problems were, but we have had 
> pretty good luck with the JSVGScrollCanvas.  To zoom we simply do
> 
> AffineTransform transform = 
> (AffineTransform)canvas.getRenderingTransform().clone();
> double newScale = <<whatever>>
> transform.scale(newScale, newScale); 		
> scrollCanvas.setRenderingTransform(transform);
> 
> The JSVGScrollCanvas we used was by Jan Lolling, which can be 
> found in the Batik mail archives.
> 
> Mark
> 
> 
> 
> 
> > -----Original Message-----
> > From: Thomas DeWeese [mailto:Thomas.DeWeese@Kodak.com]
> > Sent: Thursday, August 14, 2003 12:34 PM
> > To: Batik Users
> > Subject: Re: JSVGCanvas in a JScrollPane again....
> > 
> > 
> > Michael Mikic wrote:
> > > Hello!
> > > 
> > > I want to put the JSVGCanvas into a JScrollPane. I'm using
> > batik-1.5b5
> > > (should be a CVS Version from 2 days ago). I'm using the class
> > > JSVGViewerFrame and modified it a little because I do not 
> need all 
> > > functions apart from zooming, panning and printing. I've 
> > done a subclass
> > > extending the JSVGCanvas and implemented the Scrollable
> > Interface. All
> > > works fine as long I just do nothing else than scrolling
> > with the thumbs
> > > of the JScrollPane.
> > > 
> > > My problem now is to update the thumbs of the JScrollPane 
> whenever I 
> > > zoom into/out of the canvas or whenever I pan the canvas.
> > 
> >      I would guess that if you override setMySize to call
> > setPreferredSize(...), invalidate(), and then 
> > window.validate() [or perhaps pack()] would update the thumbs 
> > (one would hope).
> > 
> >      For scrolling/panning I think you need to make sure you
> > don't use Batik's pan (which updates the rendering transform) 
> > but use the JSVGScrollPane to change the canvas's location 
> > under the JViewport.
> > 
> > > I've noticed some approachs here but I cannot get it work for my
> > > panel.
> > > Does anyone have a solution? Maybe a code sample?
> > 
> >     Sorry no prepped solution, or code.
> > 
> > > 
> > > Thanks in advance,
> > > 
> > > Michael
> > > 
> > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: batik-users-help@xml.apache.org
> > > 
> > > 
> > 
> > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-users-help@xml.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


RE: JSVGCanvas in a JScrollPane again....

Posted by Mark Claassen <ma...@donnell.com>.
I am not sure what your exact problems were, but we have had pretty good
luck with the JSVGScrollCanvas.  To zoom we simply do

AffineTransform transform =
(AffineTransform)canvas.getRenderingTransform().clone();
double newScale = <<whatever>>
transform.scale(newScale, newScale); 		
scrollCanvas.setRenderingTransform(transform);

The JSVGScrollCanvas we used was by Jan Lolling, which can be found in
the Batik mail archives.

Mark




> -----Original Message-----
> From: Thomas DeWeese [mailto:Thomas.DeWeese@Kodak.com] 
> Sent: Thursday, August 14, 2003 12:34 PM
> To: Batik Users
> Subject: Re: JSVGCanvas in a JScrollPane again....
> 
> 
> Michael Mikic wrote:
> > Hello!
> > 
> > I want to put the JSVGCanvas into a JScrollPane. I'm using 
> batik-1.5b5
> > (should be a CVS Version from 2 days ago). I'm using the class 
> > JSVGViewerFrame and modified it a little because I do not need all 
> > functions apart from zooming, panning and printing. I've 
> done a subclass 
> > extending the JSVGCanvas and implemented the Scrollable 
> Interface. All 
> > works fine as long I just do nothing else than scrolling 
> with the thumbs 
> > of the JScrollPane.
> > 
> > My problem now is to update the thumbs of the JScrollPane whenever I
> > zoom into/out of the canvas or whenever I pan the canvas.
> 
>      I would guess that if you override setMySize to call 
> setPreferredSize(...), invalidate(), and then 
> window.validate() [or perhaps pack()] would update the thumbs 
> (one would hope).
> 
>      For scrolling/panning I think you need to make sure you 
> don't use Batik's pan (which updates the rendering transform) 
> but use the JSVGScrollPane to change the canvas's location 
> under the JViewport.
> 
> > I've noticed some approachs here but I cannot get it work for my 
> > panel.
> > Does anyone have a solution? Maybe a code sample?
> 
>     Sorry no prepped solution, or code.
> 
> > 
> > Thanks in advance,
> > 
> > Michael
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-users-help@xml.apache.org
> > 
> > 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: JSVGCanvas in a JScrollPane again....

Posted by Thomas DeWeese <Th...@Kodak.com>.
Michael Mikic wrote:
> Hello!
> 
> I want to put the JSVGCanvas into a JScrollPane. I'm using batik-1.5b5 
> (should be a CVS Version from 2 days ago). I'm using the class 
> JSVGViewerFrame and modified it a little because I do not need all 
> functions apart from zooming, panning and printing. I've done a subclass 
> extending the JSVGCanvas and implemented the Scrollable Interface. All 
> works fine as long I just do nothing else than scrolling with the thumbs 
> of the JScrollPane.
> 
> My problem now is to update the thumbs of the JScrollPane whenever I 
> zoom into/out of the canvas or whenever I pan the canvas.

     I would guess that if you override setMySize to call
setPreferredSize(...), invalidate(), and then window.validate() [or
perhaps pack()] would update the thumbs (one would hope).

     For scrolling/panning I think you need to make sure you don't
use Batik's pan (which updates the rendering transform) but use the
JSVGScrollPane to change the canvas's location under the JViewport.

> I've noticed some approachs here but I cannot get it work for my panel. 
> Does anyone have a solution? Maybe a code sample?

    Sorry no prepped solution, or code.

> 
> Thanks in advance,
> 
> Michael
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org