/** * Get a region which is a scaled version of the current region. * IMPORTANT: This also scales the LOCATION(!!) of the region (not just its size). * @param scaleRatio The ratio by which to scale the region. * @return A new region which is a scaled version of the current region. */ public Region scale(double scaleRatio) { return new Region(getLocation().scale(scaleRatio), getSize().scale(scaleRatio), getCoordinatesType()); }
/** * Get a region which is a scaled version of the current region. * IMPORTANT: This also scales the LOCATION(!!) of the region (not just its size). * @param scaleRatio The ratio by which to scale the region. * @return A new region which is a scaled version of the current region. */ public Region scale(double scaleRatio) { return new Region(getLocation().scale(scaleRatio), getSize().scale(scaleRatio), getCoordinatesType()); }
private ScreenshotType updateScreenshotType(ScreenshotType screenshotType, BufferedImage image) { if (screenshotType == null) { RectangleSize viewportSize = driver.getEyes().getViewportSize(); boolean scaleViewport = driver.getEyes().shouldStitchContent(); if (scaleViewport) { double pixelRatio = driver.getEyes().getDevicePixelRatio(); viewportSize = viewportSize.scale(pixelRatio); } if (image.getWidth() <= viewportSize.getWidth() && image.getHeight() <= viewportSize.getHeight()) { screenshotType = ScreenshotType.VIEWPORT; } else { screenshotType = ScreenshotType.ENTIRE_FRAME; } } return screenshotType; }
RectangleSize viewportSize = originalViewportSize.scale(scaleRatio);