source: java/installer2/src/net/oni2/aeinstaller/backend/ImageResizer.java@ 908

Last change on this file since 908 was 671, checked in by alloc, 12 years ago

AEI2 0.99p:

  • Resize tool-icons for menu
  • Fix readme-parser bug for Mod_Info.cfg
File size: 726 bytes
Line 
1package net.oni2.aeinstaller.backend;
2
3import java.awt.Graphics;
4import java.awt.Image;
5import java.awt.image.BufferedImage;
6
7import javax.swing.ImageIcon;
8
9/**
10 * @author Christian Illy
11 */
12public class ImageResizer {
13 /**
14 * @param src
15 * Source image
16 * @param width
17 * New width
18 * @param height
19 * New height
20 * @return Resized image icon
21 */
22 public static ImageIcon resizeImage(ImageIcon src, int width, int height) {
23 Image img = src.getImage();
24 BufferedImage bi = new BufferedImage(img.getWidth(null),
25 img.getHeight(null), BufferedImage.TYPE_INT_ARGB);
26 Graphics g = bi.createGraphics();
27 g.drawImage(img, 0, 0, width, height, null);
28 return new ImageIcon(bi);
29 }
30}
Note: See TracBrowser for help on using the repository browser.