CoordinatesType.CONTEXT_RELATIVE, CoordinatesType.SCREENSHOT_AS_IS); if (control.isEmpty()) { logger.verbose(String.format("Ignoring '%s' (out of bounds)", text));
CoordinatesType.CONTEXT_RELATIVE, CoordinatesType.SCREENSHOT_AS_IS); if (control.isEmpty()) { logger.verbose(String.format("Ignoring '%s' (out of bounds)", text));
CoordinatesType.CONTEXT_RELATIVE, CoordinatesType.SCREENSHOT_AS_IS); if (control.isEmpty()) { logger.verbose(String.format("Ignoring '%s' (out of bounds)", text));
public EyesWebDriverScreenshot getSubScreenshotForRegion(Region region, boolean throwIfClipped) { logger.verbose(String.format("getSubScreenshot([%s], %b)", region, throwIfClipped)); ArgumentGuard.notNull(region, "region"); // We calculate intersection based on as-is coordinates. Region asIsSubScreenshotRegion = getIntersectedRegion(region, CoordinatesType.SCREENSHOT_AS_IS); if (asIsSubScreenshotRegion.isEmpty() || (throwIfClipped && !asIsSubScreenshotRegion.getSize().equals( region.getSize()))) { throw new OutOfBoundsException(String.format( "Region [%s] is out of screenshot bounds [%s]", region, frameWindow)); } BufferedImage subScreenshotImage = ImageUtils.getImagePart(image, asIsSubScreenshotRegion); EyesWebDriverScreenshot result = new EyesWebDriverScreenshot(logger, driver, subScreenshotImage, new Region(region.getLocation(), new RectangleSize(subScreenshotImage.getWidth(), subScreenshotImage.getHeight()))); logger.verbose("Done!"); return result; }
@Override public EyesScreenshot getSubScreenshot(Region region, CoordinatesType coordinatesType, boolean throwIfClipped) { ArgumentGuard.notNull(region, "region"); ArgumentGuard.notNull(coordinatesType, "coordinatesType"); // We want to get the sub-screenshot in as-is coordinates type. Region subScreenshotRegion = getIntersectedRegion(region, coordinatesType, CoordinatesType.SCREENSHOT_AS_IS); if (subScreenshotRegion.isEmpty() || (throwIfClipped && !subScreenshotRegion.getSize().equals(region.getSize()))) { throw new OutOfBoundsException(String.format( "Region [%s, (%s)] is out of screenshot bounds [%s]", region, coordinatesType, bounds)); } BufferedImage subScreenshotImage = ImageUtils.getImagePart(image, subScreenshotRegion); // Notice that we need the bounds-relative coordinates as parameter // for new sub-screenshot. Region relativeSubScreenshotRegion = convertRegionLocation(subScreenshotRegion, CoordinatesType.SCREENSHOT_AS_IS, CoordinatesType.CONTEXT_RELATIVE); return new EyesImagesScreenshot(subScreenshotImage, relativeSubScreenshotRegion.getLocation()); }
/** * Converts a region's location coordinates with the {@code from} * coordinates type to the {@code to} coordinates type. * * @param region The region which location's coordinates needs to be * converted. * @param from The current coordinates type for {@code region}. * @param to The target coordinates type for {@code region}. * @return A new region which is the transformation of {@code region} to * the {@code to} coordinates type. */ protected Region convertRegionLocation(Region region, CoordinatesType from, CoordinatesType to) { ArgumentGuard.notNull(region, "region"); if (region.isEmpty()) { return new Region(region); } ArgumentGuard.notNull(from, "from"); ArgumentGuard.notNull(to, "to"); Location updatedLocation = convertLocation(region.getLocation(), from, to); return new Region(updatedLocation, region.getSize()); } }
if (!controlScreenshotIntersect.isEmpty()) { Location l = controlScreenshotIntersect.getLocation(); cursorInScreenshot.offset(-l.getX(), -l.getY());
if (!controlScreenshotIntersect.isEmpty()) { Location l = controlScreenshotIntersect.getLocation(); cursorInScreenshot.offset(-l.getX(), -l.getY());
if (!controlScreenshotIntersect.isEmpty()) { Location l = controlScreenshotIntersect.getLocation(); cursorInScreenshot.offset(-l.getX(), -l.getY());
if (fullArea == null || fullArea.isEmpty()) { RectangleSize entireSize; try {
if (!region.isEmpty()) { screenshot = screenshot.getSubScreenshot(region, regionProvider.getCoordinatesType(), false);
if (!region.isEmpty()) { screenshot = screenshot.getSubScreenshot(region, regionProvider.getCoordinatesType(), false);
if (!region.isEmpty()) { screenshot = screenshot.getSubScreenshot(region, regionProvider.getCoordinatesType(), false);