/** {@inheritDoc} */ public float getTargetResolution() { return getParentContext().getSourceResolution(); //same as source resolution }
/** * Creates a new hint Map with values from the FOUserAgent. * @param session the session context * @return a Map of hints */ public static Map getDefaultHints(ImageSessionContext session) { java.util.Map hints = new java.util.HashMap(); hints.put(ImageProcessingHints.SOURCE_RESOLUTION, session.getParentContext().getSourceResolution()); hints.put(ImageProcessingHints.TARGET_RESOLUTION, session.getTargetResolution()); hints.put(ImageProcessingHints.IMAGE_SESSION_CONTEXT, session); return hints; }
private ImageSize determineSize(byte[] header, ImageContext context, ImageInputStream in) throws IOException { int [] dim = extractImageMetadata(in); ImageSize size = new ImageSize(dim[0], dim[1], context.getSourceResolution()); size.calcSizeFromPixels(); return size; }
private ImageInfo createImageInfo(String uri, ImageContext context, SVGDocument doc) { Element e = doc.getRootElement(); float pxUnitToMillimeter = UnitConv.IN2MM / context.getSourceResolution(); UserAgent userAg = new SimpleSVGUserAgent(pxUnitToMillimeter, new AffineTransform(), DefaultFontFamilyResolver.SINGLETON) { s, SVGOMDocument.SVG_HEIGHT_ATTRIBUTE, uctx); int widthMpt = (int)Math.round(px2mpt(width, context.getSourceResolution())); int heightMpt = (int)Math.round(px2mpt(height, context.getSourceResolution())); size.setSizeInMillipoints(widthMpt, heightMpt); size.setResolution(context.getSourceResolution()); size.calcPixelsFromSize(); info.setSize(size);
size.setResolution(context.getSourceResolution()); size.calcPixelsFromSize(); info.setSize(size);
public ImageInfo preloadImage(String uri, Source src, ImageContext context) throws ImageException, IOException { if (!ImageUtil.hasImageInputStream(src)) { return null; } ImageInputStream in = ImageUtil.needImageInputStream(src); long bb = ByteBuffer.wrap(getHeader(in, 8)).getLong(); if (bb != PNGConstants.PNG_SIGNATURE) { return null; } in.mark(); ImageSize size = new ImageSize(); //Resolution (first a default, then try to read the metadata) size.setResolution(context.getSourceResolution()); try { PNGImageDecoder.readPNGHeader(in, size); } finally { in.reset(); } ImageInfo info = new ImageInfo(uri, "image/png"); info.setSize(size); return info; }
if (fldx == null || fldy == null) { unit = 2; xRes = context.getSourceResolution(); yRes = xRes; } else { size.setResolution(context.getSourceResolution()); } else if (unit == 2) { size.setResolution(context.getSourceResolution());
(int)Math.round(bbox.getWidth() * 1000), (int)Math.round(bbox.getHeight() * 1000)); size.setResolution(context.getSourceResolution()); size.calcPixelsFromSize(); info.setSize(size);
size.setResolution(context.getSourceResolution()); ImageIOUtil.extractResolution(iiometa, size); if (size.getWidthPx() <= 0 || size.getHeightPx() <= 0) {
double xResDPI = UnitConv.in2mm(xRes / 1000d); if (xResDPI == 0) { xResDPI = context.getSourceResolution(); double yResDPI = UnitConv.in2mm(yRes / 1000d); if (yResDPI == 0) { yResDPI = context.getSourceResolution();
} else { size.setResolution(context.getSourceResolution()); size.setResolution(context.getSourceResolution()); size.setResolution(context.getSourceResolution()); size.calcSizeFromPixels();