/** * Scale the image to the dimensions of the rectangle * * @param rectangle dimensions to scale the Image */ public void scaleAbsolute(final Rectangle rectangle) { scaleAbsolute(rectangle.getWidth(), rectangle.getHeight()); }
/** * Scale the image to the dimensions of the rectangle * * @param rectangle dimensions to scale the Image */ public void scaleAbsolute(final Rectangle rectangle) { scaleAbsolute(rectangle.getWidth(), rectangle.getHeight()); }
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); } } }
private void scaleToOutputResolution(Image image) { float factor = _sharedContext.getDotsPerPixel(); if (factor != 1.0f) { image.scaleAbsolute(image.getPlainWidth() * factor, image.getPlainHeight() * factor); } }
private void scaleToOutputResolution(Image image) { float factor = getSharedContext().getDotsPerPixel(); image.scaleAbsolute(image.getPlainWidth() * factor, image.getPlainHeight() * factor); }
float heightInPoints = HtmlUtilities.parseLength(height, actualFontSize); if (widthInPoints > 0 && heightInPoints > 0) { img.scaleAbsolute(widthInPoints, heightInPoints); } else if (widthInPoints > 0) { heightInPoints = img.getHeight() * widthInPoints / img.getWidth(); img.scaleAbsolute(widthInPoints, heightInPoints); } else if (heightInPoints > 0) { widthInPoints = img.getWidth() * heightInPoints / img.getHeight(); img.scaleAbsolute(widthInPoints, heightInPoints);
float heightInPoints = HtmlUtilities.parseLength(height, actualFontSize); if (widthInPoints > 0 && heightInPoints > 0) { img.scaleAbsolute(widthInPoints, heightInPoints); } else if (widthInPoints > 0) { heightInPoints = img.getHeight() * widthInPoints / img.getWidth(); img.scaleAbsolute(widthInPoints, heightInPoints); } else if (heightInPoints > 0) { widthInPoints = img.getWidth() * heightInPoints / img.getHeight(); img.scaleAbsolute(widthInPoints, heightInPoints);
image.scaleToFit(pageWidth, pageHeight); else image.scaleAbsolute(pageWidth, pageHeight);
public static void adjustOrScaleToFit(Image img, Dimension dim, Rectangle box) { if (dim == null) { scaleToFit(img, box); return; } float width = img.getWidth(); switch (dim.unit()) { case Percent: width = box.getWidth() * dim.amount() / 100f; break; case Px: width = dim.amount(); break; } // W --> w // H --> h •••> h = w * H / W float height = width * img.getHeight() / img.getWidth(); img.scaleAbsolute(width, height); }
backgroundImage.scaleToFit(background); } else { backgroundImage.scaleAbsolute(backgroundImageWidth, backgroundImageHeight);
backgroundImage.scaleToFit(background); } else { backgroundImage.scaleAbsolute(backgroundImageWidth, backgroundImageHeight);
image.setBorder(Image.BOX); image.setBorderWidth(1f); image.scaleAbsolute(119, 158); writer.getDirectContent().addImage(image);
cb.clip(); cb.newPath(); bmp.scaleAbsolute(destWidth * bmp.getWidth() / srcWidth, -destHeight * bmp.getHeight() / srcHeight); bmp.setAbsolutePosition(xDest - destWidth * xSrc / srcWidth, yDest + destHeight * ySrc / srcHeight - bmp.getScaledHeight()); cb.addImage(bmp);
cb.clip(); cb.newPath(); bmp.scaleAbsolute(destWidth * bmp.getWidth() / srcWidth, -destHeight * bmp.getHeight() / srcHeight); bmp.setAbsolutePosition(xDest - destWidth * xSrc / srcWidth, yDest + destHeight * ySrc / srcHeight - bmp.getScaledHeight()); cb.addImage(bmp);