Ejemplo n.º 1
0
  public void erase(gnu.app.displayhack.DisplayHack hack) {
    gnu.x11.Window window = hack.window;

    /* Minimum radius = L/sqrt(2) ~= 0.707*L,
     *   where L = max(width, heigth)
     *         sqrt(2) = 1.414213562373095
     *
     * Take radius = L for faster (easier) computation.
     */
    int radius = Math.max(window.width, window.height);

    int full = 360 * 64;
    int delta = (full / 200) * hack.eraser_delta;
    int step_count = (int) Math.ceil(1 + full / delta);
    int start = hack.random.nextInt(full);

    // clockwise or counter-clockwise
    if (hack.random.nextBoolean()) delta = -delta;

    for (int i = 0; i < step_count; i++) {
      window.fill_arc(
          hack.display.default_gc,
          window.width / 2 - radius,
          window.height / 2 - radius,
          2 * radius,
          2 * radius,
          (start + i * delta) % full,
          delta);

      if (sleep(hack)) return;
    }

    hack.sleep(hack.delay / 2); // before next screen
  }
Ejemplo n.º 2
0
Archivo: DBE.java Proyecto: st33v3/J11
    /** @see <a href="XdbeGetBackBufferAttributes.html">XdbeGetBackBufferAttributes</a> */
    public Window attributes() {

      int atts;
      RequestOutputStream o = display.out;
      synchronized (o) {
        o.begin_request(major_opcode, 7, 2);
        o.write_int32(id);
        ResponseInputStream i = display.in;
        synchronized (i) {
          i.read_reply(o);
          i.skip(8);
          atts = i.read_int32();
          i.skip(20);
        }
      }
      return (Window) Window.intern(this.display, atts);
    }