Ejemplo n.º 1
0
  private static void paintNodeRecursively(PLayer layer, Block node) {
    Rectangle r = node.getBounds();
    PPath rect = PPath.createRectangle(r.x, r.y, r.width, r.height);

    // Color randomColor = new Color(numGen.nextInt(256), numGen.nextInt(256), numGen.nextInt(256));
    // rect.setStrokePaint(randomColor);
    // if (node.isLeaf()){
    if (node.isText()) {
      rect.setStrokePaint(Color.red);
      rect.setPaint(null);
    } else if (node.isLeaf()) {
      rect.setStrokePaint(Color.green);
      // rect.setStrokePaint(Color.red);
      rect.setPaint(Color.green);
      rect.setTransparency(0.3f);
    } else {
      rect.setStrokePaint(Color.cyan);
      rect.setPaint(null);
    }

    layer.addChild(rect);

    for (Block child : node.getChildren()) {
      paintNodeRecursively(layer, child);
    }
  }
Ejemplo n.º 2
0
 private static void paintLeafMaskRecursively(IplImage mask, Block node) {
   if (node.isLeaf()) {
     Rectangle r = node.getBounds();
     CvPoint p1 = cvPoint(r.x, r.y);
     CvPoint p2 = cvPoint(r.x + r.width, r.y + r.height);
     cvRectangle(mask, p1, p2, CvScalar.WHITE, CV_FILLED, 8, 0);
   }
   for (Block child : node.getChildren()) {
     paintLeafMaskRecursively(mask, child);
   }
 }