(BufferedImage bi, int w2)
| 424 | } |
| 425 | |
| 426 | public static BufferedImage scaleImage(BufferedImage bi, int w2) |
| 427 | { |
| 428 | int i = bi.getWidth(); |
| 429 | int j = bi.getHeight(); |
| 430 | int k = j * w2 / i; |
| 431 | BufferedImage bufferedimage = new BufferedImage(w2, k, 2); |
| 432 | Graphics2D graphics2d = bufferedimage.createGraphics(); |
| 433 | Object object = RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR; |
| 434 | |
| 435 | if (w2 < i || w2 % i != 0) |
| 436 | { |
| 437 | object = RenderingHints.VALUE_INTERPOLATION_BILINEAR; |
| 438 | } |
| 439 | |
| 440 | graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, object); |
| 441 | graphics2d.drawImage(bi, 0, 0, w2, k, (ImageObserver)null); |
| 442 | return bufferedimage; |
| 443 | } |
| 444 | |
| 445 | public static int scaleToGrid(int size, int sizeGrid) |
| 446 | { |
no test coverage detected