Hi Randy, [EMAIL PROTECTED] wrote on 05/25/2007 02:23:43 PM:
> To review, what I'm trying to do is present an initial view exactly > as is produced by appending the URI fragment identifier > "#svgView(viewBox(...))" to the URL. The main reason I don't want to > use the fragment identifier to present my view is I want to retain > the outer SVG's viewBox as the "top" view (control-T on the canvas > will take the user back to view the whole picture). > SVGRect vp = svgelm.getViewport(); > float w = vp.getWidth(); > float h = vp.getHeight(); > > float[] vb = ViewBox. > parseViewBoxAttribute(defpicelm, viewbox, null); > > AffineTransform at = ViewBox. > getPreserveAspectRatioTransform(vb, SVGPreserveAspectRatio. > SVG_PRESERVEASPECTRATIO_XMIDYMID, true, w, h); > > canvas_.setRenderingTransform(at); > Couple of things I'm wonder are: > 1. Should the width and height I pass to getPreserveAspectRatioTransform() > be the width and height from the outer SVG element or the width and > height of the viewport? I'm thinking the latter, but either one > returns an incorrect result. width and height should be that of the JSVGCanvas. > 2. What am I doing wrong? You aren't compensating for the "viewing transform" that was set by the initial viewBox in the SVG Document. You can get this from the canvas with: JSVGComponent.getViewingTransform() You will want to combine the inverse of the viewing transform with your calculated transform (I'm 90% sure that you will want to concatenate it but you may need to be preConcatenate). --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
