public BufferedImageRaster(int width, int height, int transparency, Sector sector) { super(width, height, sector); if (width < 1) { String message = Logging.getMessage("generic.InvalidWidth", width); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (height < 1) { String message = Logging.getMessage("generic.InvalidHeight", height); Logging.logger().severe(message); throw new IllegalArgumentException(message); } this.bufferedImage = ImageUtil.createCompatibleImage(width, height, transparency); }
@Override public BufferedImage composeImageForSector( Sector sector, int canvasWidth, int canvasHeight, double aspectRatio, int levelNumber, String mimeType, boolean abortOnError, BufferedImage image, int timeout) throws Exception { if (sector == null) { String message = Logging.getMessage("nullValue.SectorIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } ComposeImageTile tile = new ComposeImageTile( sector, mimeType, this.getLevels().getLastLevel(), canvasWidth, canvasHeight); try { if (image == null) image = new BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_RGB); downloadImage(tile, mimeType, timeout); Thread.sleep(1); // generates InterruptedException if thread has been interupted BufferedImage tileImage = ImageIO.read(tile.getFile()); Thread.sleep(1); // generates InterruptedException if thread has been interupted ImageUtil.mergeImage(sector, tile.getSector(), aspectRatio, tileImage, image); Thread.sleep(1); // generates InterruptedException if thread has been interupted this.firePropertyChange(AVKey.PROGRESS, 0d, 1d); } catch (InterruptedIOException e) { throw e; } catch (Exception e) { if (abortOnError) throw e; String message = Logging.getMessage("generic.ExceptionWhileRequestingImage", tile.getPath()); Logging.logger().log(java.util.logging.Level.WARNING, message, e); } return image; }