Example #1
0
  public void record(File f, Logger l) {
    stop();
    reset();

    MDThreadRunner mdtr = new MDThreadRunner(this, f, l);
    Thread thr = new Thread(mdtr);
    thr.setPriority(Thread.MIN_PRIORITY);
    thr.start();
    l.init("writing animated gif " + f);
  }
Example #2
0
  protected void threadRecord(File f, Logger l) {
    int delay = (int) (20. / speed);

    AnimatedGifEncoder enc = new AnimatedGifEncoder();

    enc.start(f);
    enc.setDelay(delay);

    int ifr = 0;
    E.info("animated gif - frame " + ifr);
    enc.addFrame(getBufferedImage(1));

    while (canAdvance()) {
      advance();
      ifr += 1;
      E.info("frame " + ifr);
      l.optionalIncrementLog(ifr, "frame");
      enc.addFrame(getBufferedImage(1));
    }
    enc.finish();

    l.end();
  }