public ImageTypeSpecifier getImageType() throws IOException { getSampleModel(); getColorModel(); return new ImageTypeSpecifier(colorModel, sampleModel); }
public Iterator getImageTypes(int imageIndex) throws IOException { checkIndex(imageIndex); readHeader(); if (readState != null) { ArrayList list = new ArrayList(); list.add(new ImageTypeSpecifier(readState.getColorModel(), readState.getSampleModel())); return list.iterator(); } return null; }
private ImageTypeSpecifier getImageType(int imageIndex) throws IOException { checkIndex(imageIndex); readHeader(); if (readState != null) { return new ImageTypeSpecifier(readState.getColorModel(), readState.getSampleModel()); } return null; }
public J2KRenderedImage(J2KReadState readState) { this.readState = readState; HeaderDecoder hd = readState.getHeader(); //determnined by destination Rectangle destinationRegion = readState.getDestinationRegion(); width = destinationRegion.width; height = destinationRegion.height; minX = destinationRegion.x; minY = destinationRegion.y; Rectangle tile0Rect = readState.getTile0Rect(); tileWidth = tile0Rect.width; tileHeight = tile0Rect.height; tileGridXOffset = tile0Rect.x; tileGridYOffset = tile0Rect.y; sampleModel = readState.getSampleModel(); colorModel = readState.getColorModel(); }
public BufferedImage readBufferedImage() throws IOException { colorModel = getColorModel(); sampleModel = getSampleModel(); WritableRaster raster = null; BufferedImage image = j2krparam.getDestination(); int x = destinationRegion.x; int y = destinationRegion.y; destinationRegion.setLocation(j2krparam.getDestinationOffset()); if (image == null) { // If the destination type is specified, use the color model of it. ImageTypeSpecifier type = j2krparam.getDestinationType(); if (type != null) colorModel = type.getColorModel(); raster = Raster.createWritableRaster( sampleModel.createCompatibleSampleModel(destinationRegion.x + destinationRegion.width, destinationRegion.y + destinationRegion.height), new Point(0, 0)); image = new BufferedImage(colorModel, raster, colorModel.isAlphaPremultiplied(), new Hashtable()); } else raster = image.getWritableTile(0, 0); destImage = image; readSubsampledRaster(raster); destinationRegion.setLocation(x, y); destImage = null; return image; }