예제 #1
0
  protected void arcImpl(float x, float y, float w, float h, float start, float stop) {
    // 0 to 90 in java would be 0 to -90 for p5 renderer
    // but that won't work, so -90 to 0?

    start = -start * RAD_TO_DEG;
    stop = -stop * RAD_TO_DEG;

    // ok to do this because already checked for NaN
    //    while (start < 0) {
    //      start += 360;
    //      stop += 360;
    //    }
    //    if (start > stop) {
    //      float temp = start;
    //      start = stop;
    //      stop = temp;
    //    }
    float sweep = stop - start;

    // stroke as Arc2D.OPEN, fill as Arc2D.PIE
    if (fill) {
      // System.out.println("filla");
      arc.setArc(x, y, w, h, start, sweep, Arc2D.PIE);
      fillShape(arc);
    }
    if (stroke) {
      // System.out.println("strokey");
      arc.setArc(x, y, w, h, start, sweep, Arc2D.OPEN);
      strokeShape(arc);
    }
  }
예제 #2
0
 public void line(float x1, float y1, float x2, float y2) {
   line.setLine(x1, y1, x2, y2);
   strokeShape(line);
 }