Changeset 323 in josm
- Timestamp:
- 2007-09-16T04:37:42+02:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/GeoImageLayer.java
r319 r323 10 10 import java.awt.Cursor; 11 11 import java.awt.Graphics; 12 import java.awt.Graphics2D; 12 13 import java.awt.GridBagLayout; 13 14 import java.awt.Image; … … 20 21 import java.awt.event.MouseEvent; 21 22 import java.awt.event.KeyEvent; 23 import java.awt.image.BufferedImage; 22 24 import java.io.File; 23 25 import java.io.IOException; … … 509 511 h = maxSize; 510 512 } 511 return new ImageIcon(img.getScaledInstance(w, h, Image.SCALE_SMOOTH)); 513 return new ImageIcon(createResizedCopy(img, w, h)); 514 } 515 516 private static BufferedImage createResizedCopy(Image originalImage, 517 int scaledWidth, int scaledHeight) 518 { 519 BufferedImage scaledBI = new BufferedImage(scaledWidth, scaledHeight, BufferedImage.TYPE_INT_RGB); 520 Graphics2D g = scaledBI.createGraphics(); 521 522 g.drawImage(originalImage, 0, 0, scaledWidth, scaledHeight, null); 523 g.dispose(); 524 return scaledBI; 512 525 } 513 526 }
Note:
See TracChangeset
for help on using the changeset viewer.