Package java.awt

Examples of java.awt.Graphics2D.scale()


                dx = (double)dim.width / (double)h;
                dy = (double)dim.height / (double)w;
                d = Math.min(dx, dy);
                g2d.rotate(Math.PI/2);
                g2d.translate(0, -h*d);
                g2d.scale(d, d);
                if ((int)(h*d + .5) < dim.width)
                    xOffset = (int)((dim.width - h*d)/(2.0*d) + 0.5);
                if ((int)(w*d + .5) < dim.height)
                    yOffset = (int)((dim.height - w*d)/(2.0*d) + 0.5);
                g2d.translate(yOffset, -xOffset);
View Full Code Here


                dx = (double)dim.width / (double)h;
                dy = (double)dim.height / (double)w;
                d = Math.min(dx, dy);
                g2d.rotate(-Math.PI/2);
                g2d.translate(-w*d, h*d);
                g2d.scale(d, -d);
                if ((int)(h*d + .5) < dim.width)
                    xOffset = (int)((dim.width - h*d)/(2.0*d) + 0.5);
                if ((int)(w*d + .5) < dim.height)
                    yOffset = (int)((dim.height - w*d)/(2.0*d) + 0.5);
                g2d.translate(-yOffset, -xOffset);
View Full Code Here

                dx = (double)dim.width / (double)h;
                dy = (double)dim.height / (double)w;
                d = Math.min(dx, dy);
                g2d.rotate(-Math.PI/2);
                g2d.translate(-w*d, 0);
                g2d.scale(d, d);
                if ((int)(h*d + .5) < dim.width)
                    xOffset = (int)((dim.width - h*d)/(2.0*d) + 0.5);
                if ((int)(w*d + .5) < dim.height)
                    yOffset = (int)((dim.height - w*d)/(2.0*d) + 0.5);
                g2d.translate(yOffset, xOffset);
View Full Code Here

        BufferedImage retval =
            new BufferedImage( width*scaling, height*scaling, BufferedImage.TYPE_BYTE_INDEXED );
        Graphics2D graphics = (Graphics2D)retval.getGraphics();
        graphics.setColor( Color.WHITE );
        graphics.fillRect(0,0,width*scaling, height*scaling);
        graphics.scale( scaling, scaling );
        PageDrawer drawer = new PageDrawer();
        drawer.drawPage( graphics, this, pageDimension );
       
       
        return retval;
View Full Code Here

        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            setCurrentDimension();
            Graphics2D g2d = (Graphics2D) g;
            g2d.translate(0, currentHeight);
            g2d.scale(1, -1);
            drawHisto(g2d);
            g2d.dispose();
        }

        private void drawHisto(Graphics2D g2d) {
View Full Code Here

            if (dim == null) dim = new Dimension(w, h);

            dx = (double)dim.width / (double)w;
            dy = (double)dim.height / (double)h;
            d = Math.min(dx, dy);
            g2d.scale(d, d);
            g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, m_interpolation);
            Rectangle rect = g2d.getClipBounds();
            if (rect != null)
                g2d.drawImage(m_img, (int)rect.getX(), (int)rect.getY(), (int)(rect.getX() + rect.getWidth()), (int)(rect.getY() + rect.getHeight()), (int)rect.getX(), (int)rect.getY(), (int)(rect.getX() + rect.getWidth()), (int)(rect.getY() + rect.getHeight()), this);
        }
View Full Code Here

          //          root.build();

          SimpleImage imgMap = new SimpleImage(imgWidth, imgHeight);

          Graphics2D g = imgMap.getBufferedImg().createGraphics();
          g.scale(resolution_multiplier, resolution_multiplier);
          if (pre_antialias != 0) {
            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
          }
          else {
View Full Code Here

        double sclX = (double) imgWidth / diagram.getWidth();
        double sclY = (double) imgHeight / diagram.getHeight();
        double scl = sclX < sclY ? sclX : sclY;

        g.scale(scl, scl);

        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
        diagram.render(g);
View Full Code Here

      // Optimisation for limitating the painting to the visible part only.
      final double clipStart = (int)(getClippingGap()/zoom/ppc)*ppc;

      // Settings the parameters of the graphics.
      adaptGraphicsToViewpoint(g2);
      g2.scale(zoom, zoom);
      g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    g2.setStroke(STROKE);
      g2.setColor(Color.BLACK);

View Full Code Here

            double ph = pageFormat.getImageableHeight();
            if (cw > pw || ch > ph) {
                double scaleX = pw / cw;
                double scaleY = ph / ch;
                double scale = scaleX < scaleY ? scaleX : scaleY;
                g2d.scale(scale, scale);
            }

            editorPane.printAll((Graphics) g2d);
            return Printable.PAGE_EXISTS;
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.