/** * @return true if the region's size is 0, false otherwise. */ public boolean isSizeEmpty() { return this.getWidth() <= 0 || this.getHeight() <= 0; }
/** * @return true if the region's size is 0, false otherwise. */ public boolean isSizeEmpty() { return this.getWidth() <= 0 || this.getHeight() <= 0; }
@Override public Region compensateRegionPosition(Region region, double pixelRatio) { if (pixelRatio == 1.0) { return region; } if (region.getWidth() <= 0 || region.getHeight() <= 0) { return Region.EMPTY; } return region.offset(0, (int) Math.ceil(pixelRatio)); }
protected void makeEmpty() { left = EMPTY.getLeft(); top = EMPTY.getTop(); width = EMPTY.getWidth(); height = EMPTY.getHeight(); }
private void saveDebugScreenshotPart(BufferedImage image, Region region, String name) { String suffix = String.format("part-%s-%d_%d_%dx%d", name, region.getLeft(), region.getTop(), region.getWidth(), region.getHeight()); debugScreenshotsProvider.save(image, suffix); }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (!(obj instanceof Region)) { return false; } Region other = (Region) obj; return (this.getLeft() == other.getLeft()) && (this.getTop() == other.getTop()) && (this.getWidth() == other.getWidth()) && (this.getHeight() == other.getHeight()); }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (!(obj instanceof Region)) { return false; } Region other = (Region) obj; return (this.getLeft() == other.getLeft()) && (this.getTop() == other.getTop()) && (this.getWidth() == other.getWidth()) && (this.getHeight() == other.getHeight()); }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (!(obj instanceof Region)) { return false; } Region other = (Region) obj; return (this.getLeft() == other.getLeft()) && (this.getTop() == other.getTop()) && (this.getWidth() == other.getWidth()) && (this.getHeight() == other.getHeight()); }
/** * Check if a region is intersected with the current region. * @param other The region to check intersection with. * @return True if the regions are intersected, false otherwise. */ public boolean isIntersected(Region other) { int right = left + width; int bottom = top + height; int otherLeft = other.getLeft(); int otherTop = other.getTop(); int otherRight = otherLeft + other.getWidth(); int otherBottom = otherTop + other.getHeight(); return (((left <= otherLeft && otherLeft <= right) || (otherLeft <= left && left <= otherRight)) && ((top <= otherTop && otherTop <= bottom) || (otherTop <= top && top <= otherBottom))); }
protected void makeEmpty() { left = EMPTY.getLeft(); top = EMPTY.getTop(); width = EMPTY.getWidth(); height = EMPTY.getHeight(); this.coordinatesType = EMPTY.getCoordinatesType(); }
public Region(Region other) { ArgumentGuard.notNull(other, "other"); left = other.getLeft(); top = other.getTop(); width = other.getWidth(); height = other.getHeight(); }
protected void makeEmpty() { left = EMPTY.getLeft(); top = EMPTY.getTop(); width = EMPTY.getWidth(); height = EMPTY.getHeight(); this.coordinatesType = EMPTY.getCoordinatesType(); }
public Region(Region other) { ArgumentGuard.notNull(other, "other"); left = other.getLeft(); top = other.getTop(); width = other.getWidth(); height = other.getHeight(); coordinatesType = other.getCoordinatesType(); }
public Region(Region other) { ArgumentGuard.notNull(other, "other"); left = other.getLeft(); top = other.getTop(); width = other.getWidth(); height = other.getHeight(); coordinatesType = other.getCoordinatesType(); }
/** * Check if a region is contained within the current region. * @param other The region to check if it is contained within the current * region. * @return True if {@code other} is contained within the current region, * false otherwise. */ @SuppressWarnings("UnusedDeclaration") public boolean contains(Region other) { int right = left + width; int otherRight = other.getLeft() + other.getWidth(); int bottom = top + height; int otherBottom = other.getTop() + other.getHeight(); return top <= other.getTop() && left <= other.getLeft() && bottom >= otherBottom && right >= otherRight; }
/** * Check if a region is contained within the current region. * @param other The region to check if it is contained within the current * region. * @return True if {@code other} is contained within the current region, * false otherwise. */ @SuppressWarnings("UnusedDeclaration") public boolean contains(Region other) { int right = left + width; int otherRight = other.getLeft() + other.getWidth(); int bottom = top + height; int otherBottom = other.getTop() + other.getHeight(); return top <= other.getTop() && left <= other.getLeft() && bottom >= otherBottom && right >= otherRight; }
/** * Check if a region is contained within the current region. * @param other The region to check if it is contained within the current * region. * @return True if {@code other} is contained within the current region, * false otherwise. */ @SuppressWarnings("UnusedDeclaration") public boolean contains(Region other) { int right = left + width; int otherRight = other.getLeft() + other.getWidth(); int bottom = top + height; int otherBottom = other.getTop() + other.getHeight(); return top <= other.getTop() && left <= other.getLeft() && bottom >= otherBottom && right >= otherRight; }