Package org.joshy.gfx.stage.swing

Examples of org.joshy.gfx.stage.swing.SwingGFX


            Bounds bounds = node.getTransformedBounds();
            BufferedImage img = new BufferedImage((int)bounds.getWidth()+1,(int)bounds.getHeight()+1,BufferedImage.TYPE_INT_ARGB);
            Graphics2D g2 = img.createGraphics();
            g2.translate(-bounds.getX(), -bounds.getY());
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            SwingGFX gfx = new SwingGFX(g2);
            double[] metrics = node.getExportMetrics(gfx);
            g2.translate(node.getTranslateX(), node.getTranslateY());

            double[] totals = new double[metrics.length];
            for(int i=0; i<key.length(); i++) {
View Full Code Here


        //composite using a boolean op to mask out the bg
        buf = g.createBuffer(
                (int)b.getWidth()+blurRadius*2,
                (int)b.getHeight()+blurRadius*2);
        SwingGFX gx =(SwingGFX)buf.getGFX();
        Graphics2D graphics2D = (Graphics2D) gx.getNative();
        graphics2D.setComposite(AlphaComposite.SrcOver);

        initPaint(gx);
        fillShape(gx);
        graphics2D.setComposite(AlphaComposite.SrcAtop);
        gx.draw(bufx, -5, -5);
        gx.dispose();

    }
View Full Code Here

            cb = out.getDirectContent();
            template = cb.createTemplate((int)page.getDocument().getWidth(), (int)page.getDocument().getHeight());
            g = template.createGraphics((int)page.getDocument().getWidth(), (int)page.getDocument().getHeight(),mapper);

            //fill in the background
            SwingGFX gfx = new SwingGFX(g);
            org.joshy.gfx.draw.Paint fill = page.getDocument().getBackgroundFill();
            if(fill != null) {
                gfx.setPaint(fill);
                gfx.fillRect(0,0,(int)page.getDocument().getWidth(), (int) page.getDocument().getHeight());
            }

            //draw everything on the page
            ExportProcessor.processFragment(new SavePNGAction.PNGExporter(), g, page.getNodes());
        }
View Full Code Here

    public static class PNGExporter implements ShapeExporter<Graphics2D> {
        private boolean useDocBg = true;

        public void docStart(Graphics2D g2, SketchDocument doc) {
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            SwingGFX gfx = new SwingGFX(g2);
            Paint fill = doc.getBackgroundFill();
            if(fill != null && useDocBg) {
                gfx.setPaint(fill);
                gfx.fillRect(0,0,(int)doc.getWidth(), (int) doc.getHeight());
            }
        }
View Full Code Here

            g2.translate(shape.getAnchorX(),shape.getAnchorY());
            g2.rotate(Math.toRadians(shape.getRotate()));
            g2.scale(shape.getScaleX(), shape.getScaleY());
            g2.translate(-shape.getAnchorX(),-shape.getAnchorY());
            if(shape instanceof SelfDrawable) {
                SwingGFX gfx = new SwingGFX(g2);
                ((SelfDrawable)shape).draw(gfx);
                return;
            }
        }
View Full Code Here

TOP

Related Classes of org.joshy.gfx.stage.swing.SwingGFX

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.