Package javax.media.jai

Examples of javax.media.jai.PerspectiveTransform


            return src;
        }
        /**
         * Transforms src shape to fxBounds
         */
        PerspectiveTransform ptx = PerspectiveTransform.getQuadToQuad(srcBounds.getMinX(), srcBounds.getMinY(), srcBounds.getMaxX(), srcBounds.getMinY(),
                srcBounds.getMaxX(), srcBounds.getMaxY(), srcBounds.getMinX(), srcBounds.getMaxY(),
                fxBounds.getMinX(), fxBounds.getMinY(), fxBounds.getMaxX(), fxBounds.getMinY(),
                fxBounds.getMaxX(), fxBounds.getMaxY(), fxBounds.getMinX(), fxBounds.getMaxY());
        /**
         * instance a transformed shape throughout a GeneralPath
         */
        final Vector<Map<Integer, float[]>> perspectiveTransformPoly = new Vector<Map<Integer, float[]>>();
        final PathIterator pi = src.getShape().getPathIterator(null);
        final GeneralPath gp = new GeneralPath(pi.getWindingRule());
        while (!pi.isDone()) {
            float[] coords = new float[6];
            float[] fxCoords = new float[6];
            int path = pi.currentSegment(coords);
            perspectiveTransformPoly.add(Collections.singletonMap(path, fxCoords));
            switch (path) {
                case PathIterator.SEG_MOVETO:
                    ptx.transform(coords, 0, fxCoords, 0, 1);
                    break;
                case PathIterator.SEG_CLOSE:
                    break;
                case PathIterator.SEG_LINETO:
                    ptx.transform(coords, 0, fxCoords, 0, 1);
                    break;
                case PathIterator.SEG_CUBICTO:
                    ptx.transform(coords, 0, fxCoords, 0, 3);
                    break;
                case PathIterator.SEG_QUADTO:
                    ptx.transform(coords, 0, fxCoords, 0, 2);
                    break;
                default:
                    break;
            }
            pi.next();
View Full Code Here


     * @param vv the VisualizationViewer to work on
     */
    public PerspectiveLayoutTransformSupport(VisualizationViewer<V,E> vv) {
        super(vv);
        this.perspectiveTransformer =
            new PerspectiveShapeTransformer(new PerspectiveTransform(),
                vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT));
        this.pickSupport = vv.getPickSupport();
   }
View Full Code Here

        this.renderContext = vv.getRenderContext();
        this.pickSupport = renderContext.getPickSupport();
        this.renderer = vv.getRenderer();
        this.transformingRenderer = new BasicRenderer<V,E>();
        this.perspectiveTransformer =
            new PerspectiveShapeTransformer(new PerspectiveTransform(), vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW));
        this.transformingRenderer.setVertexRenderer(new TransformingImageVertexIconRenderer<V,E>());
        this.lensGraphicsDecorator = new TransformingGraphics(perspectiveTransformer);
        this.savedGraphicsDecorator = renderContext.getGraphicsContext();

        this.renderer = vv.getRenderer();
View Full Code Here

      public void stateChanged(ChangeEvent e) {
                int vval = -verticalSlider.getValue();
                int hval = horizontalSlider.getValue();

                Dimension d = vv.getSize();
                 PerspectiveTransform pt = null;
                    pt = PerspectiveTransform.getQuadToQuad(
                            vval,          hval,
                            d.width-vval, -hval,
                            d.width+vval, d.height+hval,
                            -vval,         d.height-hval,
View Full Code Here

        super(vv);
        this.renderer = vv.getRenderer();
        this.renderContext = vv.getRenderContext();
        this.pickSupport = renderContext.getPickSupport();
        this.perspectiveTransformer =
            new PerspectiveShapeTransformer(new PerspectiveTransform(),
                vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW));
        this.savedGraphicsDecorator = renderContext.getGraphicsContext();
        this.lensGraphicsDecorator = new TransformingGraphics(perspectiveTransformer);
    }
View Full Code Here

      public void stateChanged(ChangeEvent e) {
                int vval = -verticalSlider.getValue();
                int hval = horizontalSlider.getValue();

                Dimension d = vv.getSize();
                 PerspectiveTransform pt = null;
                    pt = PerspectiveTransform.getQuadToQuad(
                            vval,          hval,
                            d.width-vval, -hval,
                            d.width+vval, d.height+hval,
                            -vval,         d.height-hval,
View Full Code Here

            srcImage = (RenderedImage)image;
        } else {
            srcImage = getBufferedImage(image);
        }
       
        PerspectiveTransform perspectiveTransform =
            PerspectiveTransform.getQuadToQuad(
                   
                    quadx1, quady1,
                    quadx2, quady2,
                    quadx3, quady3,
                    quadx4, quady4,
                   
                    0, 0,
                    width, 0,
                    width, height,
                    0, height
                    );
       
        double[][] matrix = new double[3][3];
        perspectiveTransform.getMatrix(matrix);
       
        if(matrix[2][2] == 0 || Double.isNaN(matrix[2][2])) {
            System.err.println("matrix[2][2] = "+matrix[2][2]);
            return null;
        }
View Full Code Here

TOP

Related Classes of javax.media.jai.PerspectiveTransform

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.