/** * Saves the given BufferedImage to the current file. The BufferedImage * may represent a subsection of the full image to be saved. * * @param no the image index within the current file, starting from 0. * @param image the BufferedImage to save. * @param x the X coordinate of the upper-left corner of the image. * @param y the Y coordinate of the upper-left corner of the image. * @param w the width (in pixels) of the image. * @param h the height (in pixels) of the image. */ public void saveImage(int no, BufferedImage image, int x, int y, int w, int h) throws FormatException, IOException { Class dataType = getNativeDataType(); if (BufferedImage.class.isAssignableFrom(dataType)) { // native data type is compatible with BufferedImage savePlane(no, image, x, y, w, h); } else { // must convert BufferedImage to byte array byte[] buf = toBytes(image, this); saveBytes(no, buf, x, y, w, h); } }
/** * Saves the given BufferedImage to the current file. The BufferedImage * may represent a subsection of the full image to be saved. * * @param no the image index within the current file, starting from 0. * @param image the BufferedImage to save. * @param x the X coordinate of the upper-left corner of the image. * @param y the Y coordinate of the upper-left corner of the image. * @param w the width (in pixels) of the image. * @param h the height (in pixels) of the image. */ public void saveImage(int no, BufferedImage image, int x, int y, int w, int h) throws FormatException, IOException { Class dataType = getNativeDataType(); if (BufferedImage.class.isAssignableFrom(dataType)) { // native data type is compatible with BufferedImage savePlane(no, image, x, y, w, h); } else { // must convert BufferedImage to byte array byte[] buf = toBytes(image, this); saveBytes(no, buf, x, y, w, h); } }