Esempio 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);
    }
  }
Esempio n. 2
0
  ///////////////////////////////////////////////////////////////////////////
  /// Marquee
  protected void initializeMarquee(PInputEvent e) {
    marquee = PPath.createRectangle((float) presspt.getX(), (float) presspt.getY(), 0, 0);
    marquee.setPaint(marqueePaint);
    marquee.setTransparency(marqueePaintTransparency);
    marquee.setStrokePaint(marqueeStrokePaint);
    marquee.setStroke(strokes[0]);

    marqueeParent.getPiccolo().addChild(marquee);

    marqueeObjects.clear();
  }