Java Draw Image drawScaledImage(Graphics graphics, BufferedImage image, int x, int y, int w, int h, int left, int right)

Here you can find the source of drawScaledImage(Graphics graphics, BufferedImage image, int x, int y, int w, int h, int left, int right)

Description

draw Scaled Image

License

Open Source License

Declaration

public static void drawScaledImage(Graphics graphics,
            BufferedImage image, int x, int y, int w, int h, int left,
            int right) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.Graphics;
import java.awt.image.BufferedImage;

public class Main {
    public static void drawScaledImage(Graphics graphics,
            BufferedImage image, int x, int y, int w, int h, int left,
            int right) {
        int tw = image.getWidth();
        int th = image.getHeight();

        graphics.drawImage(image, x, y, x + left, y + h, 0, 0, left, th,
                null);/*www  . java2 s.  co m*/
        graphics.drawImage(image, x + left, y, x + w - right, y + h, left,
                0, tw - right, th, null);
        graphics.drawImage(image, x + w - right, y, x + w, y + h, tw
                - right, 0, tw, th, null);
    }
}

Related

  1. drawLabel(BufferedImage image, String text)
  2. drawNormalImage(Rectangle2D bounds, Graphics2D g2, Image image, ImageObserver observer, int imageWidth, int imageHeight)
  3. drawOnto(final BufferedImage pDestination, final Image pSource)
  4. drawPixel(BufferedImage img, int x, int y, int color)
  5. drawPixel(int x, int y, Color color, BufferedImage displayMap)
  6. drawScaledImage(Image image, Component canvas, Graphics g)
  7. drawSquare(BufferedImage image, int x, int y, int size, int pixel)
  8. drawStretchedImage(Rectangle2D bounds, Graphics2D g2, Image image, ImageObserver observer)
  9. drawTiledImage(Rectangle2D bounds, Graphics2D g2, Image image, ImageObserver observer, int imageWidth, int imageHeight, int tilePadding)