Package java.awt.image

Examples of java.awt.image.BufferedImage


     */
    protected class Rasterizer extends ImageTranscoder {

        public BufferedImage createImage(int w, int h) {

            BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
            ((Graphics2D) bi.getGraphics()).setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                    RenderingHints.VALUE_ANTIALIAS_ON);
            return bi;
        }
View Full Code Here


    if (inImage.getWidth(null) > inImage.getHeight(null)) {
      scale = (double) maxImageSize / (double) inImage.getWidth(null);
    }
    int scaledW = (int) (scale * inImage.getWidth(null));
    int scaledH = (int) (scale * inImage.getHeight(null));
    BufferedImage outImage = new BufferedImage(scaledW, scaledH, BufferedImage.TYPE_INT_RGB);
    AffineTransform tx = new AffineTransform();

    if (scale < 1.0d) {
      tx.scale(scale, scale);
    }

    Color bgColor = null;
    Graphics2D g2d = outImage.createGraphics();
    g2d.setColor(bgColor);
    g2d.fillRect(0, 0, scaledW, scaledH);
    g2d.drawImage(inImage, tx, null);
    g2d.dispose();

View Full Code Here

            sourceImage = null;
            return;
        }

        if (!(image instanceof BufferedImage)) {
            sourceImage = new BufferedImage(image.getWidth(this), image.getHeight(this), BufferedImage.TYPE_INT_ARGB);
            Graphics2D g2D = sourceImage.createGraphics();
            g2D.drawImage(image, 0, 0, this);
        } else {
            sourceImage = (BufferedImage) image;
        }
View Full Code Here

                // Create the transform op.
                AffineTransformOp xformOp = new AffineTransformOp(xform, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
                // Scale clip area -> newImage
                // extract sub-image
                BufferedImage newImage = xformOp.filter(sourceImage.getSubimage(clipRect.x,
                        clipRect.y,
                        clipRect.width,
                        clipRect.height),
                        null);
View Full Code Here

   private void setupCloseLabel()
   {
      if( closeIcon == null )
      {
          BufferedImage closeImage = getImageResource( "close.png" );
          BufferedImage closeHighlightImage = getImageResource( "close-highlight.png" );

          if( closeImage != null ) {
             closeIcon = new ImageIcon( closeImage );
          }
View Full Code Here

   private BufferedImage getImageResource( String imageResourceName )
    {
       InputStream inputStream = getClass().getResourceAsStream(imageResourceName);
       if (inputStream != null) {
          try {
              BufferedImage image = ImageIO.read(inputStream);
             return image;
          }
          catch ( IOException e) {
              LOGGER.error("Reading image " + imageResourceName, e);
          }
View Full Code Here

     * with a specified image type (ARGB, RGB, etc). This will return
     * an empty ImageIcon, and you'd have to do the rendering into its
     * image.
     */
    public static ImageIcon createImageIcon(int width, int height, int imageType) {
        return new ImageIcon(new BufferedImage(width, height, imageType));
    }
View Full Code Here

            if (Debug.debugging("symbology")) {
                Debug.output("BasicSymbolImageMaker: Trying to create "
                        + fileURL);
            }

            BufferedImage bi = BufferedImageHelper.getBufferedImage(fileURL);
            return new ImageIcon(ImageScaler.getOptimalScalingImage(bi, (int) di.getWidth(),
                    (int) di.getHeight()));
        } catch (IOException e) {
            e.printStackTrace();
        } catch (NullPointerException npe) {
View Full Code Here

        }
        if (bufferedRenderingImage != null) {
            bufferedRenderingImage.flush();
        }
        // New images...
        bufferedMapImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
        bufferedRenderingImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
    }
View Full Code Here

        int delta = currentSize - endSize;
        int nextPow2 = currentSize >> 1;
        while (currentSize > 1) {
            if (delta <= nextPow2) {
                if (currentSize != endSize) {
                    BufferedImage tmpImage = new BufferedImage(endSize,
                            endSize, BufferedImage.TYPE_INT_RGB);
                    Graphics g = tmpImage.getGraphics();
                    ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_INTERPOLATION,
                            RenderingHints.VALUE_INTERPOLATION_BILINEAR);
                    g.drawImage(currentImage, 0, 0, tmpImage.getWidth(),
                            tmpImage.getHeight(), null);
                    currentImage = tmpImage;
                }
                return currentImage;
            } else {
                BufferedImage tmpImage = new BufferedImage(currentSize >> 1,
                        currentSize >> 1, BufferedImage.TYPE_INT_RGB);
                Graphics g = tmpImage.getGraphics();
                ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_INTERPOLATION,
                        RenderingHints.VALUE_INTERPOLATION_BILINEAR);
                g.drawImage(currentImage, 0, 0, tmpImage.getWidth(),
                        tmpImage.getHeight(), null);
                currentImage = tmpImage;
                currentSize = currentImage.getWidth(null);
                delta = currentSize - endSize;
                nextPow2 = currentSize >> 1;
            }
View Full Code Here

TOP

Related Classes of java.awt.image.BufferedImage

Copyright © 2015 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.