private static Rectangle clipRegion(PDImage pdImage, Rectangle region) { if (region == null) { return new Rectangle(0, 0, pdImage.getWidth(), pdImage.getHeight()); } else { int x = Math.max(0, region.x); int y = Math.max(0, region.y); int width = Math.min(region.width, pdImage.getWidth() - x); int height = Math.min(region.height, pdImage.getHeight() - y); return new Rectangle(x, y, width, height); } }
/** * Calculated the subsampling frequency for a given PDImage based on the current transformation * and its calculated transform * * @param pdImage PDImage to be drawn * @param at Transform that will be applied to the image when drawing * @return The rounded-down ratio of image pixels to drawn pixels. Returned value will always be * >=1. */ private int getSubsampling(PDImage pdImage, AffineTransform at) { // calculate subsampling according to the resulting image size double scale = Math.abs(at.getDeterminant() * xform.getDeterminant()); int subsampling = (int) Math.floor(Math.sqrt(pdImage.getWidth() * pdImage.getHeight() / scale)); if (subsampling > 8) { subsampling = 8; } if (subsampling < 1) { subsampling = 1; } if (subsampling > pdImage.getWidth() || subsampling > pdImage.getHeight()) { // For very small images it is possible that the subsampling would imply 0 size. // To avoid problems, the subsampling is set to no less than the smallest dimension. subsampling = Math.min(pdImage.getWidth(), pdImage.getHeight()); } return subsampling; }
int width = pdImage.getWidth(); int height = pdImage.getHeight();
boolean isScaledUp = pdImage.getWidth() < Math.round(at.getScaleX()) || pdImage.getHeight() < Math.round(at.getScaleY());
inputWidth = pdImage.getWidth(); startx = clipped.x; starty = clipped.y;
inputWidth = pdImage.getWidth(); startx = clipped.x; starty = clipped.y;
final float[] decode = getDecodeArray(pdImage); if (width <= 0 || height <= 0 || pdImage.getWidth() <= 0 || pdImage.getHeight() <= 0)
inputWidth = pdImage.getWidth(); startx = clipped.x; starty = clipped.y;
private static Rectangle clipRegion(PDImage pdImage, Rectangle region) { if (region == null) { return new Rectangle(0, 0, pdImage.getWidth(), pdImage.getHeight()); } else { int x = Math.max(0, region.x); int y = Math.max(0, region.y); int width = Math.min(region.width, pdImage.getWidth() - x); int height = Math.min(region.height, pdImage.getHeight() - y); return new Rectangle(x, y, width, height); } }
/** * Calculated the subsampling frequency for a given PDImage based on the current transformation * and its calculated transform * * @param pdImage PDImage to be drawn * @param at Transform that will be applied to the image when drawing * @return The rounded-down ratio of image pixels to drawn pixels. Returned value will always be * >=1. */ private int getSubsampling(PDImage pdImage, AffineTransform at) { // calculate subsampling according to the resulting image size double scale = Math.abs(at.getDeterminant() * xform.getDeterminant()); int subsampling = (int) Math.floor(Math.sqrt(pdImage.getWidth() * pdImage.getHeight() / scale)); if (subsampling > 8) { subsampling = 8; } if (subsampling < 1) { subsampling = 1; } if (subsampling > pdImage.getWidth() || subsampling > pdImage.getHeight()) { // For very small images it is possible that the subsampling would imply 0 size. // To avoid problems, the subsampling is set to no less than the smallest dimension. subsampling = Math.min(pdImage.getWidth(), pdImage.getHeight()); } return subsampling; }
int width = pdImage.getWidth(); int height = pdImage.getHeight();
private static BufferedImage from1Bit(PDImage pdImage) throws IOException final int width = pdImage.getWidth(); final int height = pdImage.getHeight(); final float[] decode = getDecodeArray(pdImage);
int width = pdImage.getWidth(); int height = pdImage.getHeight();
boolean isScaledUp = pdImage.getWidth() < Math.round(at.getScaleX()) || pdImage.getHeight() < Math.round(at.getScaleY());
inputWidth = pdImage.getWidth(); startx = clipped.x; starty = clipped.y;
final int width = pdImage.getWidth(); final int height = pdImage.getHeight(); final int numComponents = pdImage.getColorSpace().getNumberOfComponents();
final float[] decode = getDecodeArray(pdImage); if (width <= 0 || height <= 0 || pdImage.getWidth() <= 0 || pdImage.getHeight() <= 0)
inputWidth = pdImage.getWidth(); startx = clipped.x; starty = clipped.y;
final int width = pdImage.getWidth(); final int height = pdImage.getHeight(); final int bitsPerComponent = pdImage.getBitsPerComponent();
final int width = pdImage.getWidth(); final int height = pdImage.getHeight(); final int bitsPerComponent = pdImage.getBitsPerComponent();