Package java.awt

Examples of java.awt.Graphics2D.drawImage()


       * Render the resultant image to our new rotatedImage buffer,
       * applying the AffineTransform that we calculated above during
       * rendering so the pixels from the old position to the new
       * transposed positions are mapped correctly.
       */
      g2d.drawImage(result, tx, null);
      g2d.dispose();

      /*
       * Before re-assigning the new result to be returned to our rotated
       * image, explicitly notify the VM that you are done with any
View Full Code Here


    Graphics2D resultGraphics = result.createGraphics();

    // Scale the image to the new buffer using the specified rendering hint.
    resultGraphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
        interpolationHintValue);
    resultGraphics.drawImage(src, 0, 0, targetWidth, targetHeight, null);

    // Just to be clean, explicitly dispose our temporary graphics object
    resultGraphics.dispose();

    // Return the scaled image to the caller.
View Full Code Here

                treetable.paintImmediately(ghostImageRect.getBounds());
                // And remember where we are about to draw the new ghost image
                ghostImageRect.setRect(pt.x - offsetPoint.x, pt.y
                        - offsetPoint.y, ghostImage.getWidth(), ghostImage
                        .getHeight());
                g2.drawImage(ghostImage, AffineTransform.getTranslateInstance(
                        ghostImageRect.getX(), ghostImageRect.getY()), null);
            } else {
                // Just rub out the last cue line
                treetable.paintImmediately(cueLineRect.getBounds());
            }
View Full Code Here

    Graphics2D g2 = (Graphics2D) result.getGraphics();

    g2.setColor(Color.WHITE);
    g2.fillRect(0, 0, result.getWidth(), result.getHeight());
   
    g2.drawImage(image, scaleTransform, null);

    return result;
  }

  private static BufferedImage scale(BufferedImage image, int height, int width, int quality, int imageType) {
View Full Code Here

    g2.fillRect(0, 0, width, height);
   
    Canvas canvas = new Canvas();
    Image tImage = image.getScaledInstance(width, height, quality);

    g2.drawImage(tImage, 0, 0, canvas);

    return result;
  }

  /*public static void scaleAndWriteImage(String inImgURL, String outImgURL, String format, double xFactor, double yFactor ) throws IOException{
View Full Code Here

                     BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB;                 
               BufferedImage bImg = new BufferedImage(width, height, imageType);
               Graphics2D g2d = bImg.createGraphics();
               g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
                     RenderingHints.VALUE_INTERPOLATION_BICUBIC);
               g2d.drawImage(icon.getImage(), 0, 0, width, height, null);
               g2d.dispose();
  
               String formatName = "";
               if (contentType != null && contentType.indexOf("png") != -1)
                  formatName = "png";
View Full Code Here

        BufferedImage subimage = image.getSubimage(leftx, topy, width, height);
        int h = (int) (subimage.getHeight() / reduceFactor);
        int w = (int) (subimage.getWidth() / reduceFactor);

        g2d.drawImage(subimage, 0, 0, w, h, null);
        // int imgw = (int)pageFormat.getImageableWidth();
        // int imgh = (int)pageFormat.getImageableHeight();
        //   
        // int width=imgw+x<image.getWidth()?imgw:image.getWidth()-x;
        // int height=imgh+y<image.getHeight()?imgh:image.getHeight()-y;
View Full Code Here

      // Center the 3D view in component
      g2D.translate(pageFormat.getImageableX() + (pageFormat.getImageableWidth() - printSize) / 2,
          pageFormat.getImageableY() + (pageFormat.getImageableHeight() - printSize) / 2);
      double scale = printSize / printedImageSize;
      g2D.scale(scale, scale);
      g2D.drawImage(this.printedImage, 0, 0, this);
      g2D.dispose();

      return PAGE_EXISTS;
    } else {
      return NO_SUCH_PAGE;
View Full Code Here

     
      if (composite != null) {
        g2D.setComposite(composite);
      }
      // Draw image with composite
      g2D.drawImage(this.image, 0, 0, this);
      g2D.setComposite(oldComposite);
      g2D.setTransform(oldTransform);
    }
  }
 
View Full Code Here

        throw new IllegalArgumentException("Can't read pattern image " + pattern.getName());
      }
    }
    // Draw the pattern image with foreground color
    final int foregroundColorRgb = foregroundColor.getRGB() & 0xFFFFFF;
    imageGraphics.drawImage(Toolkit.getDefaultToolkit().createImage(
        new FilteredImageSource(patternImage.getSource(),
        new RGBImageFilter() {
          {
            this.canFilterIndexColorModel = true;
          }
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.