/** * Save list of Charts into a given stream. Does not close the target stream automatically at the * end of the operation. Function assumes that all charts are the same size (width, height). * Number of charts should equal rows multiplied by cols. * * @param charts * @param rows number of rows * @param cols number of columns * @param targetStream * @param bitmapFormat * @throws IOException */ public static void saveBitmap( List<Chart> charts, Integer rows, Integer cols, OutputStream targetStream, BitmapEncoder.BitmapFormat bitmapFormat) throws IOException { List<BufferedImage> chartImages = new LinkedList<BufferedImage>(); for (Chart c : charts) chartImages.add(getBufferedImage(c)); BufferedImage bufferedImage = mergeImages(chartImages, rows, cols); ImageIO.write(bufferedImage, bitmapFormat.toString().toLowerCase(), targetStream); }
/** * Save list of Charts into a given stream. Does not close the target stream automatically at the * end of the operation. Function assumes that all charts are the same size (width, height). * Number of charts should equal rows multiplied by cols. * * @param charts * @param rows number of rows * @param cols number of columns * @param targetStream * @param bitmapFormat * @throws IOException */ public static void saveBitmap( List<Chart> charts, Integer rows, Integer cols, OutputStream targetStream, BitmapEncoder.BitmapFormat bitmapFormat) throws IOException { List<BufferedImage> chartImages = new LinkedList<BufferedImage>(); for (Chart c : charts) chartImages.add(getBufferedImage(c)); BufferedImage bufferedImage = mergeImages(chartImages, rows, cols); ImageIO.write(bufferedImage, bitmapFormat.toString().toLowerCase(), targetStream); }