Package org.apache.flex.forks.batik.dom.svg

Examples of org.apache.flex.forks.batik.dom.svg.SVGOMAnimatedRect$BaseSVGRect


            // 'visibility'
            cgn.setVisible(CSSUtilities.convertVisibility(e));

            // 'viewBox' and "preserveAspectRatio' attributes
            SVGOMAnimatedRect vb = (SVGOMAnimatedRect) se.getViewBox();
            SVGAnimatedPreserveAspectRatio par = se.getPreserveAspectRatio();
            AffineTransform viewingTransform =
                ViewBox.getPreserveAspectRatioTransform(e, vb, par, w, h, ctx);

            float actualWidth = w;
            float actualHeight = h;
            try {
                AffineTransform vtInv = viewingTransform.createInverse();
                actualWidth = (float) (w*vtInv.getScaleX());
                actualHeight = (float) (h*vtInv.getScaleY());
            } catch (NoninvertibleTransformException ex) {}

            AffineTransform positionTransform =
                AffineTransform.getTranslateInstance(x, y);
            // The outermost preserveAspectRatio matrix is set by the user
            // agent, so we don't need to set the transform for outermost svg
            if (!isOutermost) {
                // X & Y are ignored on outermost SVG.
                cgn.setPositionTransform(positionTransform);
            } else if (doc == ctx.getDocument()) {
                // <!> FIXME: hack to compute the original document's size
                ctx.setDocumentSize(new Dimension((int) (w + 0.5f),
                                                  (int) (h + 0.5f)));
            }
            // Set the viewing transform, this is often updated when the
            // component prepares for rendering.
            cgn.setViewingTransform(viewingTransform);

            // 'overflow' and 'clip'
            Shape clip = null;
            if (CSSUtilities.convertOverflow(e)) { // overflow:hidden
                float [] offsets = CSSUtilities.convertClip(e);
                if (offsets == null) { // clip:auto
                    clip = new Rectangle2D.Float(x, y, w, h);
                } else { // clip:rect(<x> <y> <w> <h>)
                    // offsets[0] = top
                    // offsets[1] = right
                    // offsets[2] = bottom
                    // offsets[3] = left
                    clip = new Rectangle2D.Float(x+offsets[3],
                                                 y+offsets[0],
                                                 w-offsets[1]-offsets[3],
                                                 h-offsets[2]-offsets[0]);
                }
            }

            if (clip != null) {
                try {
                    AffineTransform at = new AffineTransform(positionTransform);
                    at.concatenate(viewingTransform);
                    at = at.createInverse(); // clip in user space
                    clip = at.createTransformedShape(clip);
                    Filter filter = cgn.getGraphicsNodeRable(true);
                    cgn.setClip(new ClipRable8Bit(filter, clip));
                } catch (NoninvertibleTransformException ex) {}
            }
            RenderingHints hints = null;
            hints = CSSUtilities.convertColorRendering(e, hints);
            if (hints != null)
                cgn.setRenderingHints(hints);

            // 'enable-background'
            Rectangle2D r = CSSUtilities.convertEnableBackground(e);
            if (r != null) {
                cgn.setBackgroundEnable(r);
            }

            if (vb.isSpecified()) {
                SVGRect vbr = vb.getAnimVal();
                actualWidth = vbr.getWidth();
                actualHeight = vbr.getHeight();
            }
            ctx.openViewport
                (e, new SVGSVGElementViewport(actualWidth,
View Full Code Here


                   
                    CanvasGraphicsNode cgn;
                    cgn = (CanvasGraphicsNode)node;
                   
                    // 'viewBox' and "preserveAspectRatio' attributes
                    SVGOMAnimatedRect vb = (SVGOMAnimatedRect) se.getViewBox();
                    SVGAnimatedPreserveAspectRatio par = se.getPreserveAspectRatio();
                    AffineTransform newVT = ViewBox.getPreserveAspectRatioTransform
                        (e, vb, par, w, h, ctx);

                    AffineTransform oldVT = cgn.getViewingTransform();
View Full Code Here

TOP

Related Classes of org.apache.flex.forks.batik.dom.svg.SVGOMAnimatedRect$BaseSVGRect

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.