Rectangle clipped = clipRegion(pdImage, region); final int height = (int) Math.ceil(clipped.getHeight() / subsampling); final int bitsPerComponent = pdImage.getBitsPerComponent(); final float[] decode = getDecodeArray(pdImage); return from1Bit(pdImage, clipped, subsampling, width, height); return from8bit(pdImage, raster, clipped, subsampling, width, height); return fromAny(pdImage, raster, colorKey, clipped, subsampling, width, height);
/** * Returns an RGB buffered image containing the opaque image stream without any masks applied. * If this Image XObject is a mask then the buffered image will contain the raw mask. * @return the image without any masks applied * @throws IOException if the image cannot be read */ public BufferedImage getOpaqueImage() throws IOException { return SampledImageReader.getRGBImage(this, null); }
@Override public BufferedImage getStencilImage(Paint paint) throws IOException { if (!isStencil()) { throw new IllegalStateException("Image is not a stencil"); } return SampledImageReader.getStencilImage(this, paint); }
final int numComponents = colorSpace.getNumberOfComponents(); final int bitsPerComponent = pdImage.getBitsPerComponent(); final float[] decode = getDecodeArray(pdImage); return applyColorKeyMask(rgbImage, colorKeyMask);
final float[] decode = getDecodeArray(pdImage); int value = decode[0] < decode[1] ? 1 : 0; int rowLen = width / 8;
final int height = pdImage.getHeight(); final int bitsPerComponent = pdImage.getBitsPerComponent(); final float[] decode = getDecodeArray(pdImage); return applyColorKeyMask(rgbImage, colorKeyMask);
final float[] decode = getDecodeArray(pdImage); BufferedImage bim = null; WritableRaster raster;
Rectangle clipped = clipRegion(pdImage, region); final int height = (int) Math.ceil(clipped.getHeight() / subsampling); final int bitsPerComponent = pdImage.getBitsPerComponent(); final float[] decode = getDecodeArray(pdImage); return from1Bit(pdImage, clipped, subsampling, width, height); return from8bit(pdImage, raster, clipped, subsampling, width, height); return fromAny(pdImage, raster, colorKey, clipped, subsampling, width, height);
@Override public BufferedImage getImage(Rectangle region, int subsampling) throws IOException { return SampledImageReader.getRGBImage(this, region, subsampling, null); }
final int numComponents = colorSpace.getNumberOfComponents(); final int bitsPerComponent = pdImage.getBitsPerComponent(); final float[] decode = getDecodeArray(pdImage); return applyColorKeyMask(rgbImage, colorKeyMask);
/** * {@inheritDoc} * The returned images are not cached. */ @Override public BufferedImage getStencilImage(Paint paint) throws IOException { if (!isStencil()) { throw new IllegalStateException("Image is not a stencil"); } return SampledImageReader.getStencilImage(this, paint); }
final float[] decode = getDecodeArray(pdImage); int value = decode[0] < decode[1] ? 1 : 0; int rowLen = width / 8;
final int height = pdImage.getHeight(); final int bitsPerComponent = pdImage.getBitsPerComponent(); final float[] decode = getDecodeArray(pdImage); return from1Bit(pdImage); return from8bit(pdImage, raster); return fromAny(pdImage, raster, colorKey);
@Override public BufferedImage getImage() throws IOException { return SampledImageReader.getRGBImage(this, null); }
@Override public BufferedImage getStencilImage(Paint paint) throws IOException { if (!isStencil()) { throw new IllegalStateException("Image is not a stencil"); } return SampledImageReader.getStencilImage(this, paint); }
final int width = pdImage.getWidth(); final int height = pdImage.getHeight(); final float[] decode = getDecodeArray(pdImage); BufferedImage bim = null; WritableRaster raster;
/** * Returns the content of the given image as an AWT buffered image with an RGB color space. * If a color key mask is provided then an ARGB image is returned instead. * This method never returns null. * @param pdImage the image to read * @param colorKey an optional color key mask * @return content of this image as an RGB buffered image * @throws IOException if the image cannot be read */ public static BufferedImage getRGBImage(PDImage pdImage, COSArray colorKey) throws IOException { return getRGBImage(pdImage, null, 1, colorKey); }
@Override public BufferedImage getStencilImage(Paint paint) throws IOException { if (!isStencil()) { throw new IllegalStateException("Image is not a stencil"); } return SampledImageReader.getStencilImage(this, paint); }
final float[] decode = getDecodeArray(pdImage); int value = decode[0] < decode[1] ? 1 : 0; int rowLen = width / 8;
BufferedImage image = SampledImageReader.getRGBImage(this, region, subsampling, getColorKeyMask());