Last change
on this file since 1193 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 | |
---|
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 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.