本文整理了Java中java.awt.Rectangle.intersect
方法的一些代码示例,展示了Rectangle.intersect
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rectangle.intersect
方法的具体详情如下:
包路径:java.awt.Rectangle
类名称:Rectangle
方法名:intersect
[英]Computes the intersection of this Rectangle
with the specified Rectangle
. Returns a new Rectangle
that represents the intersection of the two rectangles. If the two rectangles do not intersect, the result will be an empty rectangle.
[中]计算此Rectangle
与指定Rectangle
的交集。返回表示两个矩形相交的新Rectangle
。如果两个矩形不相交,结果将是一个空矩形。
代码示例来源:origin: geotools/geotools
/**
* Checks that the provided <code>dimensions</code> when intersected with the source region used
* by the provided {@link ImageReadParam} instance does not result in an empty {@link
* Rectangle}.
*
* <p>Input parameters cannot be null.
*
* @param readParameters an instance of {@link ImageReadParam} for which we want to check the
* source region element.
* @param dimensions an instance of {@link Rectangle} to use for the check.
* @return <code>true</code> if the intersection is not empty, <code>false</code> otherwise.
*/
public static final boolean checkEmptySourceRegion(
final ImageReadParam readParameters, final Rectangle dimensions) {
Utilities.ensureNonNull("readDimension", dimensions);
Utilities.ensureNonNull("readP", readParameters);
final Rectangle sourceRegion = readParameters.getSourceRegion();
Rectangle.intersect(sourceRegion, dimensions, sourceRegion);
if (sourceRegion.isEmpty()) return true;
readParameters.setSourceRegion(sourceRegion);
return false;
}
代码示例来源:origin: geotools/geotools
/**
* Checks that the provided {@code dimensions} when intersected with the source region used by
* the provided {@link ImageReadParam} instance does not result in an empty {@link Rectangle}.
* Finally, in case the region intersection is not empty, set it as new source region for the
* provided {@link ImageReadParam}.
*
* <p>Input parameters cannot be null.
*
* @param readParameters an instance of {@link ImageReadParam} for which we want to check the
* source region element.
* @param dimensions an instance of {@link Rectangle} to use for the check.
* @return {@code true} if the intersection is not empty, {@code false} otherwise.
*/
public static boolean checkEmptySourceRegion(
final ImageReadParam readParameters, final Rectangle dimensions) {
Utilities.ensureNonNull("readDimension", dimensions);
Utilities.ensureNonNull("readP", readParameters);
final Rectangle sourceRegion = readParameters.getSourceRegion();
Rectangle.intersect(sourceRegion, dimensions, sourceRegion);
if (sourceRegion.isEmpty()) {
return true;
}
readParameters.setSourceRegion(sourceRegion);
return false;
}
代码示例来源:origin: stackoverflow.com
Rectangle r1 = new Rectangle(x,y,width,height);
Rectangle r2 = new Rectangle(other.getX(),other.getY(),other.getWidth(),other.getHeight());
return r1.intersect(r2);
代码示例来源:origin: senbox-org/s2tbx
/**
* Gets the intersection area for the given rectangle and this cell.
*
* @param rectangle The rectangle to test
* @return A <code>java.awt.Rectangle</code> if the intersection area between this cell and the given rectangle
* has positive width and height, <code>null</code> otherwise.
*/
public Rectangle intersection(Rectangle rectangle) {
Rectangle result = new Rectangle();
Rectangle.intersect(new Rectangle(cellStartPixelX + cellOffsetX, cellStartPixelY + cellOffsetY, cellPixelWidth - cellOffsetX, cellPixelHeight - cellOffsetY),
rectangle,
result);
return (result.width > 0 && result.height > 0) ? result : null;
}
代码示例来源:origin: geotools/geotools
Rectangle.intersect(finalRasterArea, sourceGridRange, finalRasterArea);
if (finalRasterArea.isEmpty()) {
throw new EmptyIntersectionException(
Rectangle.intersect(bounds, sourceGridRange, bounds);
if (bounds.isEmpty())
throw new CannotCropException(Errors.format(ErrorKeys.CANT_CROP));
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
bounds.x = screenBounds.x + (screenBounds.width - bounds.width) / 2;
bounds.y = screenBounds.y + (screenBounds.height - bounds.height) / 2;
Rectangle.intersect(screenBounds, bounds, bounds);
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
bounds.x = screenBounds.x + (screenBounds.width - bounds.width) / 2;
bounds.y = screenBounds.y + (screenBounds.height - bounds.height) / 3;
Rectangle.intersect(screenBounds, bounds, bounds);
代码示例来源:origin: markiewb/nb-codeoutline
Rectangle.intersect(lineClip, clip, lineClip);
g.setClip(lineClip);
lh.paintLayeredHighlights(g, line.getStartOffset(), line.getEndOffset() - 1, allocation, host, this);
代码示例来源:origin: org.geotools/gt-coverage
/**
* Checks that the provided {@code dimensions} when intersected with the source region used by
* the provided {@link ImageReadParam} instance does not result in an empty {@link Rectangle}.
* Finally, in case the region intersection is not empty, set it as new source region for the
* provided {@link ImageReadParam}.
* <p>
* Input parameters cannot be null.
*
* @param readParameters an instance of {@link ImageReadParam} for which we want to check
* the source region element.
* @param dimensions an instance of {@link Rectangle} to use for the check.
* @return {@code true} if the intersection is not empty, {@code false} otherwise.
*/
public static boolean checkEmptySourceRegion(final ImageReadParam readParameters,
final Rectangle dimensions) {
Utilities.ensureNonNull("readDimension", dimensions);
Utilities.ensureNonNull("readP", readParameters);
final Rectangle sourceRegion = readParameters.getSourceRegion();
Rectangle.intersect(sourceRegion, dimensions, sourceRegion);
if (sourceRegion.isEmpty()) {
return true;
}
readParameters.setSourceRegion(sourceRegion);
return false;
}
代码示例来源:origin: org.geotools/gt-coverage
/**
* Checks that the provided <code>dimensions</code> when intersected with
* the source region used by the provided {@link ImageReadParam} instance
* does not result in an empty {@link Rectangle}.
*
* <p>
* Input parameters cannot be null.
*
* @param readParameters
* an instance of {@link ImageReadParam} for which we want to
* check the source region element.
* @param dimensions
* an instance of {@link Rectangle} to use for the check.
* @return <code>true</code> if the intersection is not empty,
* <code>false</code> otherwise.
*/
public final static boolean checkEmptySourceRegion(final ImageReadParam readParameters,
final Rectangle dimensions) {
Utilities.ensureNonNull("readDimension", dimensions);
Utilities.ensureNonNull("readP", readParameters);
final Rectangle sourceRegion = readParameters.getSourceRegion();
Rectangle.intersect(sourceRegion, dimensions, sourceRegion);
if (sourceRegion.isEmpty())
return true;
readParameters.setSourceRegion(sourceRegion);
return false;
}
代码示例来源:origin: google/sagetv
currEffectClip.intersect(currEffectClip, op.destRect, currEffectClip);
currEffectClip.intersect(currEffectClip, op.destRect, currEffectClip);
if (baseClip != null)
currEffectClip.intersect(currEffectClip, baseClip, currEffectClip);
代码示例来源:origin: google/sagetv
MathUtils.transformRectCoords(intRectd, currXform, intRectd);
if (currEffectClip != null)
intRectd.intersect(intRectd, currEffectClip, intRectd);
if (ANIM_DEBUG) System.out.println("Clearing the graphics area for the YUV video image surface");
usedHiResSurf = true;
代码示例来源:origin: google/sagetv
java.awt.Rectangle.intersect(currRenderRect, rootComp.getBounds(), currRenderRect);
currentlyScrolling = hasScrollAnimsStill;
代码示例来源:origin: google/sagetv
MathUtils.transformRectCoords(cr, currXform, cr);
if (currEffectClip != null)
cr.intersect(cr, currEffectClip, cr);
if (cr.getWidth() <= 0 || cr.getHeight() <= 0)
return;
代码示例来源:origin: org.geotools/gt-coverage
Rectangle.intersect(finalRasterArea, sourceGridRange, finalRasterArea);
if(finalRasterArea.isEmpty())
throw new CannotCropException(Errors.format(ErrorKeys.CANT_CROP));
Rectangle.intersect(bounds, sourceGridRange, bounds);
if(bounds.isEmpty())
throw new CannotCropException(Errors.format(ErrorKeys.CANT_CROP));
内容来源于网络,如有侵权,请联系作者删除!