ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/AE/installer2/src/net/oni2/aeinstaller/backend/ImageResizer.java
Revision: 671
Committed: Sun Feb 10 17:58:13 2013 UTC (12 years, 8 months ago) by alloc
Content type: text/x-java
File size: 726 byte(s)
Log Message:
AEI2 0.99p:
- Resize tool-icons for menu
- Fix readme-parser bug for Mod_Info.cfg

File Contents

# Content
1 package net.oni2.aeinstaller.backend;
2
3 import java.awt.Graphics;
4 import java.awt.Image;
5 import java.awt.image.BufferedImage;
6
7 import javax.swing.ImageIcon;
8
9 /**
10 * @author Christian Illy
11 */
12 public 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 }