Example usage for java.awt Image SCALE_SMOOTH

List of usage examples for java.awt Image SCALE_SMOOTH

Introduction

In this page you can find the example usage for java.awt Image SCALE_SMOOTH.

Prototype

int SCALE_SMOOTH

To view the source code for java.awt Image SCALE_SMOOTH.

Click Source Link

Document

Choose an image-scaling algorithm that gives higher priority to image smoothness than scaling speed.

Usage

From source file:Main.java

public static ImageIcon createImageIcon(Class<?> bezugsklasse, String path, int width, int height) {
    final URL imgURL = bezugsklasse.getResource(path);
    if (imgURL != null) {
        return new ImageIcon(
                new ImageIcon(imgURL).getImage().getScaledInstance(width, height, Image.SCALE_SMOOTH));
    }/*from   w  w w .  jav  a 2s.c  o m*/
    System.err.println("Couldn't find file: " + path);
    return null;
}

From source file:Main.java

public LoadImage() {
    super(new GridLayout());
    try {//from   ww w.  j  av a 2  s.  c o  m
        image = ImageIO.read(new URL("http://www.java2s.com/style/download.png"));
    } catch (Exception ex) {
        ex.printStackTrace(System.err);
    }
    int w = image.getWidth(null) / 2;
    int h = image.getHeight(null) / 2;
    this.add(new JLabel(new ImageIcon(image.getScaledInstance(w, h, Image.SCALE_SMOOTH))));
}

From source file:Main.java

public void actionPerformed(ActionEvent e) {
    String file = "a.png";
    if (file != null) {
        Toolkit kit = Toolkit.getDefaultToolkit();
        img = kit.getImage(file);/*  ww  w  .j  av  a 2 s  .c  om*/
        img = img.getScaledInstance(300, -1, Image.SCALE_SMOOTH);
        this.repaint();
    }
}

From source file:Main.java

public void actionPerformed(ActionEvent e) {
    String file = "a.png";
    if (file != null) {
        Toolkit kit = Toolkit.getDefaultToolkit();
        img = kit.getImage(file);//from www  .  ja va  2  s .co m
        img = img.getScaledInstance(300, -1, Image.SCALE_SMOOTH);
        img.flush();
        this.repaint();
    }
}

From source file:Main.java

public void actionPerformed(ActionEvent e) {
    String file = "a.png";
    if (file != null) {
        Toolkit kit = Toolkit.getDefaultToolkit();
        img = kit.getImage(file);/*w  ww .j av a 2 s.c  om*/
        img = img.getScaledInstance(300, -1, Image.SCALE_SMOOTH);
        System.out.println(img.UndefinedProperty);
        this.repaint();
    }
}

From source file:ThumbnailTools.java

/**
 * Create a thumbnail for the current image
 * @param size the size//  w w  w .  ja  v a  2s.  c o m
 * @param dir the direction, Horizontal or Vertical
 * @return the thumbnail image
 */
public Image getThumbnail(int size, int dir) {
    if (dir == HORIZONTAL) {
        thumb = new ImageIcon(image.getImage().getScaledInstance(size, -1, Image.SCALE_SMOOTH));
    } else {
        thumb = new ImageIcon(image.getImage().getScaledInstance(-1, size, Image.SCALE_SMOOTH));
    }
    return thumb.getImage();
}

From source file:Main.java

public void actionPerformed(ActionEvent e) {
    String file = "a.png";
    if (file != null) {
        Toolkit kit = Toolkit.getDefaultToolkit();
        img = kit.getImage(file);//from  w ww. j av a2  s  . c o m
        img = img.getScaledInstance(300, -1, Image.SCALE_SMOOTH);
        ImageProducer pro = img.getSource();
        this.repaint();
    }
}

From source file:Main.java

public void actionPerformed(ActionEvent e) {
    String file = "a.png";
    if (file != null) {
        Toolkit kit = Toolkit.getDefaultToolkit();
        img = kit.getImage(file);/*from   ww w.  j a va 2s .c o m*/
        img = img.getScaledInstance(300, -1, Image.SCALE_SMOOTH);
        img.setAccelerationPriority(0.5F);
        System.out.println(img.getAccelerationPriority());

        this.repaint();
    }
}

From source file:Main.java

public void actionPerformed(ActionEvent e) {
    String file = "a.png";
    if (file != null) {
        Toolkit kit = Toolkit.getDefaultToolkit();
        img = kit.getImage(file);//from w w w  .j a v  a2 s .co  m
        img = img.getScaledInstance(300, -1, Image.SCALE_SMOOTH);

        Graphics g = img.getGraphics();

        this.repaint();
    }
}

From source file:ImageFileFilterImageScale.java

public void actionPerformed(ActionEvent e) {
    String file = getImageFile();
    if (file != null) {
        Toolkit kit = Toolkit.getDefaultToolkit();
        img = kit.getImage(file);//  w  w  w  . j ava  2s.  c o  m
        img = img.getScaledInstance(300, -1, Image.SCALE_SMOOTH);
        this.repaint();
    }
}