xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bishop, Michael W. CONTR J9C880" <michael.bishop....@jfcom.mil>
Subject RE: Tracking changes to the rendering transform?
Date Fri, 03 Oct 2008 14:22:42 GMT
> Once the receiving client gets these three points, I'm not clear on how to derive the
transform from the three
> points.  That's a math issue, not a Batik issue of course.
 
OK, I've been thinking about this issue some.  I think I have an idea for translate/scale,
but I'm not sure about other transform values.
 
Let's say the receiving client receives 3 points; A1 (upper-left), A2 (upper-right), and A3
(lower-left).
The receiving client already has a JSVGCanvas with three points C1, C2, C3.
 
I'm thinking that a translation is derived to translate C1 to A1.  Now both of the upper-left
corners match.  Now for X scale, you calculate the distance between C1 and C2 and A1 and A2
and apply the right scale multiple  For Y, it's C1 and C3 and A1 and A3.  I don't think you
scale around the center; you scale around the origin (C1).
 
What I'm not clear on now is the (unlikely) case of other transforms such as rotation, skew,
and shear.
 
Am I even on the right track for starting to handle these changes?
 
Michael

________________________________

From: Bishop, Michael W. CONTR J9C880 [mailto:michael.bishop.ctr@jfcom.mil]
Sent: Thu 10/2/2008 11:04 AM
To: batik-users@xmlgraphics.apache.org
Subject: RE: Tracking changes to the rendering transform?


Hi Thomas.
 
Scarily enough, I do follow most of this.  It appears I did learn something working with transforms
for translating/scaling/rotating elements a year or so ago.
 
> (On change of the rendering transform)
 
So when setRenderingTransform returns, I can assume the changes to the JSVGCanvas have occured?
 Will this be accurate:
 
public void setRenderingTransform(AffineTransform renderingTransform) {
   super.setRenderingTransform(renderingTransform);
   // Derive corner points here.
}
 
Once the receiving client gets these three points, I'm not clear on how to derive the transform
from the three points.  That's a math issue, not a Batik issue of course.
 
> You aren't done yet...
 
This is where I start to get confused.  I have to remove the existing VIEWING transform to
derive the RENDERING transform?  So I "remove" the VIEWING transform by doing the inverse,
then apply that inverse to the RENDERING transform to get the final value?
 
Michael
 

________________________________

From: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com]
Sent: Tue 9/30/2008 9:21 PM
To: batik-users@xmlgraphics.apache.org
Cc: batik-users@xmlgraphics.apache.org
Subject: RE: Tracking changes to the rendering transform?



Hi Michael,

"Bishop, Michael W. CONTR J9C880" <michael.bishop.ctr@jfcom.mil> wrote on 09/25/2008
01:13:47 PM:

>    "The one thing you need to consider is that the rendering transform 
> does interact with the viewing transform (From the viewbox).  So in 
> the case that the window that is viewing the document is a different 
> size/aspect ratio then you may need a different rendering transform 
> to get the same 'view'. "
> 
> In a whiteboarding situation, the document is supposed to stay in 
> sync between clients.  Assuming that we are syncing changes to the 
> viewBox attribute, does this satisfy the need to manage the viewing transform?

   I don't think so... 

   Since the rendering transform sits outside of the viewing transform 
if one client has a window that is say 600 pixels wide and is paned over 
so that the left edge is in the middle of the screen their translate 
would be 300.   However if that is applied to a Window that is 1200 
pixels wide the left edge would only be 1/4 of the way across. 

   One way to view this problem is to communicate what points in 
the root SVG element's coordinate system correspond to the corners 
of the window.  With that in mind it's worth noting that a general 
affine transform can be specified by the remapping of three points 
(e.g. top left, top right, and bottom left points that are visible 
in the document).  So you can easily calculate those points by 
mapping the corners of the window to the root SVG element's coordinate 
system (on change of the rendering transform).  If you then send 
those points to the other clients they can calculate the transform 
that would map those same points to the corners of the new client's 
window (probably with some adjustment for aspect ratio - which is 
simple if you don't allow for non-uniform scaling).  You aren't 
done yet because that is the full transform and you need to remove 
the existing viewing transform to know what the rendering transform 
should be.  Fortunately that is simply a matter of inverting the 
viewing transform and multiplying/premultiplying that with the 
'full transform' to get the residual that should be set as the 
rendering transform. 

   I hope that this makes some sense to you. 
 
> From: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com]
> Sent: Thu 9/25/2008 6:34 AM
> To: batik-users@xmlgraphics.apache.org
> Cc: batik-users@xmlgraphics.apache.org
> Subject: RE: Tracking changes to the rendering transform?
> 
> 
> 
> 
> Hi Dan,  Michael,
> 
> "Dan Slater" <dslater@simulsoft.com> wrote on 09/23/2008 02:01:01 PM:
> 
> > Extend the JSVGCanvas and override the setRenderingTransform method.
> > For example:
> 
>    Yes, this is how I would track changes to the rendering transform. 
> We don't expose it through any of the Swing change API's. 
> 
> >         public void setRenderingTransform(final AffineTransform at) {
> >             //System.out.println("JSVGCanvasX set rendering transform...");
> >             setRenderingTransform(at, true);
> >             Point2D.Double pt2d = new Point2D.
> > Double(locationListener.getLastX(),locationListener.getLastY());
> >             SVGSVGElement root = this.getSVGDocument().getRootElement();
> >             if (root != null) setUserPositionXY(pt2d, root);
> >        }
> 
> "Bishop, Michael" <michael.bishop.ctr@jfcom.mil> wrote on 09/23/2008:
> 
> >> I'm in a whiteboarding situation where I want to communicate my 
> >> "view" to other users. If I pan/zoom/etc, I want to be able to 
> >> notify the other users as to what I'm looking at. I'm talking about 
> >> view changes that do not modify the document.
> > 
> >> I believe I can do this by tracking the render transform. Is there a
> >> way to listen for changes to the render transform? 
> 
>     See above... 
> 
> >> Is there anything else I have to think about tracking to achieve 
> >> this goal? I know the "viewBox" attribute exists, but that's 
> >> different; it's a modification to the document itself.
> 
>    The one thing you need to consider is that the rendering transform 
> does interact with the viewing transform (From the viewbox).  So in 
> the case that the window that is viewing the document is a different 
> size/aspect ratio then you may need a different rendering transform 
> to get the same 'view'. 
> 
> [attachment "winmail.dat" deleted by Thomas E. DeWeese/449433/EKC] 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org

Mime
View raw message