コード例 #1
0
ファイル: PDFGraphics2D.java プロジェクト: jfree/orsonpdf
 /**
  * Returns {@code true} if the rectangle (in device space) intersects with the shape (the
  * interior, if {@code onStroke} is false, otherwise the stroked outline of the shape).
  *
  * @param rect a rectangle (in device space).
  * @param s the shape.
  * @param onStroke test the stroked outline only?
  * @return A boolean.
  */
 @Override
 public boolean hit(Rectangle rect, Shape s, boolean onStroke) {
   Shape ts;
   if (onStroke) {
     ts = this.transform.createTransformedShape(this.stroke.createStrokedShape(s));
   } else {
     ts = this.transform.createTransformedShape(s);
   }
   if (!rect.getBounds2D().intersects(ts.getBounds2D())) {
     return false;
   }
   Area a1 = new Area(rect);
   Area a2 = new Area(ts);
   a1.intersect(a2);
   return !a1.isEmpty();
 }