public Object clone() { return new ITextFSImage(Image.getInstance(_image)); } }
public void scale(int width, int height) { int targetWidth = width; int targetHeight = height; if (targetWidth == -1) { targetWidth = (int)(getWidth() * ((double)targetHeight / getHeight())); } if (targetHeight == -1) { targetHeight = (int)(getHeight() * ((double)targetWidth / getWidth())); } _image.scaleAbsolute(targetWidth, targetHeight); }
/** * @see org.xhtmlrenderer.swing.NaiveUserAgent#getImageResource(java.lang.String) */ @SuppressWarnings("unchecked") @Override public ImageResource getImageResource(String uri) { ImageResource resource = null; resource = (ImageResource)_imageCache.get(uri); if (resource == null) { byte[] imageData = readImage(uri); if (imageData != null) { try { Image image = Image.getInstance(imageData); scaleToOutputResolution(image); resource = new ImageResource(uri, new ITextFSImage(image)); _imageCache.put(uri, resource); } catch (Exception e) { LOG.error("Problem with getting image resource " + uri, e); } } } if (resource != null) { resource = new ImageResource(resource.getImageUri(), (FSImage)((ITextFSImage)resource.getImage()).clone()); } else { resource = new ImageResource(uri, null); } return resource; }
public void drawImage(FSImage fsImage, int x, int y) { if (fsImage instanceof PDFAsImage) { drawPDFAsImage((PDFAsImage) fsImage, x, y); } else { Image image = ((ITextFSImage) fsImage).getImage(); if (fsImage.getHeight() <= 0 || fsImage.getWidth() <= 0) { return; } AffineTransform at = AffineTransform.getTranslateInstance(x, y); at.translate(0, fsImage.getHeight()); at.scale(fsImage.getWidth(), fsImage.getHeight()); AffineTransform inverse = normalizeMatrix(_transform); AffineTransform flipper = AffineTransform.getScaleInstance(1, -1); inverse.concatenate(at); inverse.concatenate(flipper); double[] mx = new double[6]; inverse.getMatrix(mx); try { _currentPage.addImage(image, (float) mx[0], (float) mx[1], (float) mx[2], (float) mx[3], (float) mx[4], (float) mx[5]); } catch (DocumentException e) { throw new XRRuntimeException(e.getMessage(), e); } } }
Image image = Image.getInstance(readStream(is)); scaleToOutputResolution(image); resource = new ImageResource(uri, new ITextFSImage(image)); resource = new ImageResource(resource.getImageUri(), (FSImage)((ITextFSImage)resource.getImage()).clone()); } else { resource = new ImageResource(uri, null);
public void drawImage(FSImage fsImage, int x, int y) { if (fsImage instanceof PDFAsImage) { drawPDFAsImage((PDFAsImage)fsImage, x, y); } else { Image image = ((ITextFSImage)fsImage).getImage(); if (fsImage.getHeight() <= 0 || fsImage.getWidth() <= 0) { return; } AffineTransform at = AffineTransform.getTranslateInstance(x,y); at.translate(0, fsImage.getHeight()); at.scale(fsImage.getWidth(), fsImage.getHeight()); AffineTransform inverse = normalizeMatrix(_transform); AffineTransform flipper = AffineTransform.getScaleInstance(1,-1); inverse.concatenate(at); inverse.concatenate(flipper); double[] mx = new double[6]; inverse.getMatrix(mx); try { _currentPage.addImage(image, (float)mx[0], (float)mx[1], (float)mx[2], (float)mx[3], (float)mx[4], (float)mx[5]); } catch (DocumentException e) { throw new XRRuntimeException(e.getMessage(), e); } } }
Image image = Image.getInstance(readStream(is)); scaleToOutputResolution(image); resource = new ImageResource(uriStr, new ITextFSImage(image)); FSImage image = resource.getImage(); if (image instanceof ITextFSImage) { image = (FSImage) ((ITextFSImage) resource.getImage()).clone();
public Object clone() { return new ITextFSImage(Image.getInstance(_image)); } }
public void scale(int width, int height) { int targetWidth = width; int targetHeight = height; if (targetWidth == -1) { targetWidth = (int)(getWidth() * ((double)targetHeight / getHeight())); } if (targetHeight == -1) { targetHeight = (int)(getHeight() * ((double)targetWidth / getWidth())); } _image.scaleAbsolute(targetWidth, targetHeight); }
public void drawImage(FSImage fsImage, int x, int y) { if (fsImage instanceof PDFAsImage) { drawPDFAsImage((PDFAsImage) fsImage, x, y); } else { Image image = ((ITextFSImage) fsImage).getImage(); if (fsImage.getHeight() <= 0 || fsImage.getWidth() <= 0) { return; } AffineTransform at = AffineTransform.getTranslateInstance(x, y); at.translate(0, fsImage.getHeight()); at.scale(fsImage.getWidth(), fsImage.getHeight()); AffineTransform inverse = normalizeMatrix(_transform); AffineTransform flipper = AffineTransform.getScaleInstance(1, -1); inverse.concatenate(at); inverse.concatenate(flipper); double[] mx = new double[6]; inverse.getMatrix(mx); try { _currentPage.addImage(image, (float) mx[0], (float) mx[1], (float) mx[2], (float) mx[3], (float) mx[4], (float) mx[5]); } catch (DocumentException e) { throw new XRRuntimeException(e.getMessage(), e); } } }
Image image = Image.getInstance(readStream(is)); scaleToOutputResolution(image); resource = new ImageResource(uriStr, new ITextFSImage(image)); FSImage image = resource.getImage(); if (image instanceof ITextFSImage) { image = (FSImage) ((ITextFSImage) resource.getImage()).clone();
public Object clone() { return new ITextFSImage(Image.getInstance(_image)); } }
public void scale(int width, int height) { if (width > 0 || height > 0) { int currentWith = getWidth(); int currentHeight = getHeight(); int targetWidth = width; int targetHeight = height; if (targetWidth == -1) { targetWidth = (int)(currentWith * ((double)targetHeight / currentHeight)); } if (targetHeight == -1) { targetHeight = (int)(currentHeight * ((double)targetWidth / currentWith)); } if (currentWith != targetWidth || currentHeight != targetHeight) { _image.scaleAbsolute(targetWidth, targetHeight); } } }
public void drawImage(FSImage fsImage, int x, int y) { if (fsImage instanceof PDFAsImage) { drawPDFAsImage((PDFAsImage) fsImage, x, y); } else { Image image = ((ITextFSImage) fsImage).getImage(); if (fsImage.getHeight() <= 0 || fsImage.getWidth() <= 0) { return; } AffineTransform at = AffineTransform.getTranslateInstance(x, y); at.translate(0, fsImage.getHeight()); at.scale(fsImage.getWidth(), fsImage.getHeight()); AffineTransform inverse = normalizeMatrix(_transform); AffineTransform flipper = AffineTransform.getScaleInstance(1, -1); inverse.concatenate(at); inverse.concatenate(flipper); double[] mx = new double[6]; inverse.getMatrix(mx); try { _currentPage.addImage(image, (float) mx[0], (float) mx[1], (float) mx[2], (float) mx[3], (float) mx[4], (float) mx[5]); } catch (DocumentException e) { throw new XRRuntimeException(e.getMessage(), e); } } }
Image image = Image.getInstance(readStream(is)); scaleToOutputResolution(image); resource = new ImageResource(uriStr, new ITextFSImage(image)); FSImage image = resource.getImage(); if (image instanceof ITextFSImage) { image = (FSImage) ((ITextFSImage) resource.getImage()).clone();
public Object clone() { return new ITextFSImage(Image.getInstance(_image)); } }
public void scale(int width, int height) { if (width > 0 || height > 0) { int currentWith = getWidth(); int currentHeight = getHeight(); int targetWidth = width; int targetHeight = height; if (targetWidth == -1) { targetWidth = (int)(currentWith * ((double)targetHeight / currentHeight)); } if (targetHeight == -1) { targetHeight = (int)(currentHeight * ((double)targetWidth / currentWith)); } if (currentWith != targetWidth || currentHeight != targetHeight) { _image.scaleAbsolute(targetWidth, targetHeight); } } }
drawPDFAsImage((PDFAsImage)fsImage, x, y); } else { Image image = ((ITextFSImage)fsImage).getImage();
protected ImageResource createImageResource(String uri) { ImageResource imageResource = null; try { // Gets the image with its url URL source = new URI(uri).toURL(); Image image = Image.getInstance(source); // Sets the scale of the image scaleToOutputResolution(image); // Creation of the image for IText ITextFSImage iTextFSImage = new ITextFSImage(image); imageResource = new ImageResource(uri, iTextFSImage); } catch (Exception eee) { log.error("Failed to create image resource", eee); } return imageResource; }
public void scale(int width, int height) { if (width > 0 || height > 0) { int currentWith = getWidth(); int currentHeight = getHeight(); int targetWidth = width; int targetHeight = height; if (targetWidth == -1) { targetWidth = (int)(currentWith * ((double)targetHeight / currentHeight)); } if (targetHeight == -1) { targetHeight = (int)(currentHeight * ((double)targetWidth / currentWith)); } if (currentWith != targetWidth || currentHeight != targetHeight) { _image.scaleAbsolute(targetWidth, targetHeight); } } }