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 hardc0d3r <ha...@gmail.com> on 2007/07/14 15:20:45 UTC

Zoom 100%

everytime the svg file loads it is fitted in the screen. how do i make zoom
100% on load?
-- 
View this message in context: http://www.nabble.com/Zoom-100--tf4079030.html#a11593630
Sent from the Batik - Users mailing list archive at Nabble.com.


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


Re: Zoom 100%

Posted by th...@kodak.com.
Hi Archie,

"Archie Cobbs" <ar...@gmail.com> wrote on 07/23/2007 11:58:39 AM:

> On 7/19/07, thomas.deweese@kodak.com <th...@kodak.com> wrote:
> 
> Coordinate Systems  |      Transforms 
> --------------------+-----------------------------
> Screen pixels       |
>                     |   Painting Transform 
> Offscreen buffer    |
>                     |   Rendering Transform   -+
> Initial SVG view    |                          +- Combined into 
> ViewBox Transform
>                     |   Viewing Transform     -+ 
> Root <svg> local    |
> 
> Thanks Thomas, that helps.
> 
> One last question..  the viewing transform maps the rectangle in 
> "SVG space" defined by the top level "viewBox" attribute onto.. 
> what? A rectangle with lower left corner at (0,0) and width "width" 
> and height "height" ? Or width 1.0 and height 1.0?

   Close, it maps the viewBox (if there is one) to _upper_ left corner at
0,0 and the width and height of the "window" (which for transcoders might 
not really be a window).  Typically the window takes it's size from 
the width and height attributes on the outermost SVG element but those are
really "suggestions" and the user agent can override them for various 
reasons, like to limit the window to the screen size...


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


Re: Zoom 100%

Posted by Archie Cobbs <ar...@gmail.com>.
On 7/19/07, thomas.deweese@kodak.com <th...@kodak.com> wrote:
>
>
> Coordinate Systems  |      Transforms
> --------------------+-----------------------------
> Screen pixels       |
>                     |   Painting Transform
> Offscreen buffer    |
>                     |   Rendering Transform   -+
> Initial SVG view    |                          +- Combined into ViewBox
> Transform
>                     |   Viewing Transform     -+
> Root <svg> local    |


Thanks Thomas, that helps.

One last question..  the viewing transform maps the rectangle in "SVG space"
defined by the top level "viewBox" attribute onto.. what? A rectangle with
lower left corner at (0,0) and width "width" and height "height" ? Or width
1.0 and height 1.0?

Thanks.

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com

Re: Zoom 100%

Posted by th...@kodak.com.
Hi Archie,

> On 7/18/07, thomas.deweese@kodak.com <th...@kodak.com> wrote:
> [blah blah blah]
 
archie.cobbs@gmail.com wrote on 07/18/2007 10:19:31 AM:

> Is there a wiki page or something somewhere that describes all the 
> different transforms used by JSVGComponent?

   Not that I am aware of.

> I've seen rendering, viewing, viewbox, painting, etc... some of 
> which include others (?)

Coordinate Systems  |      Transforms
--------------------+-----------------------------
Screen pixels       |
                    |   Painting Transform
Offscreen buffer    |
                    |   Rendering Transform   -+
Initial SVG view          |                          +- Combined into 
ViewBox Transform
                    |   Viewing Transform     -+ 
Root <svg> local    |


> It would be nice to have it all explained somewhere... taking you 
> all the way from the SVG coordinate space to the actual screen pixels.

    There you go.

    The Viewing Transform is defined by the preserve aspect
ratio handling on the root SVG element (mapping viewBox to
the initial Canvas size).

    The Rendering Transform is adjustments to that initial
Viewing Transform due to the user panning/zooming/rotating.

    The Painting Transform is used to implement interactive
feedback for 'rendering transform' updates.  Like panning,
'live zoom' and the like.  Once the interactive operation
is completed it's added into the Rendering Transform.


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


Re: Zoom 100%

Posted by Archie Cobbs <ar...@awarix.com>.
On 7/18/07, thomas.deweese@kodak.com <th...@kodak.com> wrote:
>
>     You can control the initial viewing transform by subclassing the
> Canvas and overriding 'calculateViewingTransform'.  However you
> might want to also consider overriding setGraphicsNode and doing your
> adjustments in the 'rendering transform' rather than adjusting the
> 'viewing transform' (as that can have other effects).


Is there a wiki page or something somewhere that describes all the different
transforms used by JSVGComponent?

I've seen rendering, viewing, viewbox, painting, etc... some of which
include others (?)

It would be nice to have it all explained somewhere... taking you all the
way from the SVG coordinate space to the actual screen pixels.

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com

zoom and panning

Posted by hardc0d3r <ha...@gmail.com>.
sir, can you please guide us on how to limit panning and zooming? can you
give us a simple code to start with?
-- 
View this message in context: http://www.nabble.com/Zoom-100--tf4079030.html#a11682446
Sent from the Batik - Users mailing list archive at Nabble.com.


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


Re: Zoom 100%

Posted by th...@kodak.com.
Hi Hardcod3r,

hardc0d3r <ha...@gmail.com> wrote on 07/18/2007 12:36:53 PM:

> can i just set the affinetransform scale?

   With Affine Transforms the scale and the translate interact.
So in short no you can't.

> i tried to limit zooming by using the setToScale.. i was kinda 
> successful but when zooming is beyond the limit, the svg is 
> always set to the upper left corner.. 

   That is because AffineTransform.setToScale changes the transform
to be just a scaling transform with no translate.

> how do i set it on the point where it was zoomed? 

   If you have the point in screen space.  The easiest thing
to do is map that point through the inverse of the Rendering 
Transform.  This will give you the point in the source 
coordinate system of the Rendering Transform.

   Then you can map that point back to 0,0 with a
translate transform:

     Tx = AffineTransform.getTranslateInstance(-ptx, -pty);

   Combine that with your limited scale:
        Tx.preConcatenate(AffineTransform.getScaleInstance(scale, scale));

   Then Translate that back to the middle of the screen:
        Tx.preConcatenate(AffineTransform.getTranslateInstance
                          (canvasSize.width/2, canvasSize.height/2)); 


> and off topic question.. can i just use
> translate to limit panning? if yes, how do i limit panning while 
dragging
> (even when dragged, it will not go over the bounds of the svg)?

   You need to limit the translate in the painting transform.
You can do that be overriding 
        setPaintingTransform(AffineTransform at).

   Or you can implement your own version of the pan/zoom
interactors and disable the built in ones.


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


Re: Zoom 100%

Posted by hardc0d3r <ha...@gmail.com>.
can i just set the affinetransform scale? i tried to limit zooming by using
the setToScale.. i was kinda successful but when zooming is beyond the
limit, the svg is always set to the upper left corner.. how do i set it on
the point where it was zoomed? and off topic question.. can i just use
translate to limit panning? if yes, how do i limit panning while dragging
(even when dragged, it will not go over the bounds of the svg)?
-- 
View this message in context: http://www.nabble.com/Zoom-100--tf4079030.html#a11672332
Sent from the Batik - Users mailing list archive at Nabble.com.


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


Re: Zoom 100%

Posted by th...@kodak.com.
Hi HardCod3r,

hardc0d3r <ha...@gmail.com> wrote on 07/18/2007 09:10:30 AM:

> sir, how about when i want to zoom and focus to a portion of the canvas 
when
> i only needed to and not on load? do i really have to subclass and 
override?

   To adjust the Canvas's view after the initial load just use 
'Canvas.setRenderingTransform'. For an example of zoom and center 
on an object on the canvas take a look at 
        batik.apps.svgbrowser.FindDialog.showSelectedGraphicsNode.

   The code there zoom's and pans the document on a particular
text element in the document.  With the exception of the 
text selection code the zoom and pan code will work for any
graphicsNode (which corresponds roughly with a DOM graphics
Element).


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


Re: Zoom 100%

Posted by hardc0d3r <ha...@gmail.com>.
sir, how about when i want to zoom and focus to a portion of the canvas when
i only needed to and not on load? do i really have to subclass and override?
-- 
View this message in context: http://www.nabble.com/Zoom-100--tf4079030.html#a11668357
Sent from the Batik - Users mailing list archive at Nabble.com.


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


Re: Zoom 100%

Posted by th...@kodak.com.
Hi Hardco3r,

hardc0d3r <ha...@gmail.com> wrote on 07/14/2007 09:32:44 AM:

> sorry.. it's the other way around.. let me rephrase the question.. how 
can i
> make the viewbox focus on a certain point with a certain size/zoom 
factor?

    You can control the initial viewing transform by subclassing the
Canvas and overriding 'calculateViewingTransform'.  However you
might want to also consider overriding setGraphicsNode and doing your
adjustments in the 'rendering transform' rather than adjusting the
'viewing transform' (as that can have other effects).

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


Re: Zoom 100%

Posted by hardc0d3r <ha...@gmail.com>.
sorry.. it's the other way around.. let me rephrase the question.. how can i
make the viewbox focus on a certain point with a certain size/zoom factor?

-- 
View this message in context: http://www.nabble.com/Zoom-100--tf4079030.html#a11593632
Sent from the Batik - Users mailing list archive at Nabble.com.


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