public override 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.Ceiling((double)(1 + full / delta)); int start = DisplayHack.random.Next(full); // clockwise or counter-clockwise if (DisplayHack.random.Next() % 2 == 0) { delta = -delta; } for (int i = 0; i < step_count; i++) { window.arc(hack.display.default_gc, window.width / 2 - radius, window.height / 2 - radius, 2 * radius, 2 * radius, (start + i * delta) % full, delta, true); if (sleep(hack)) { return; } } hack.sleep(hack.delay / 2); // before next screen }
public override 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 third = full / 3; int start = DisplayHack.random.Next(full); /* 200 = speed in {@link CircleWipe} * 3 = three circles * 2 = converge from two sides */ int delta = (full / 200 / 3 / 2) * hack.eraser_delta; /* 1 to offset rounding error * 3 = three circles * 2 = converge from two sides */ int step_count = 1 + full / delta / 3 / 2; for (int i = 0; i < step_count; i++) { // first circle window.arc(hack.display.default_gc, window.width / 2 - radius, window.height / 2 - radius, 2 * radius, 2 * radius, (start + i * delta) % full, delta, true); window.arc(hack.display.default_gc, window.width / 2 - radius, window.height / 2 - radius, 2 * radius, 2 * radius, (start - i * delta) % full, delta, true); // second circle window.arc(hack.display.default_gc, window.width / 2 - radius, window.height / 2 - radius, 2 * radius, 2 * radius, (start + third + i * delta) % full, delta, true); window.arc(hack.display.default_gc, window.width / 2 - radius, window.height / 2 - radius, 2 * radius, 2 * radius, (start + third - i * delta) % full, delta, true); // third circle window.arc(hack.display.default_gc, window.width / 2 - radius, window.height / 2 - radius, 2 * radius, 2 * radius, (start + 2 * third + i * delta) % full, delta, true); window.arc(hack.display.default_gc, window.width / 2 - radius, window.height / 2 - radius, 2 * radius, 2 * radius, (start + 2 * third - i * delta) % full, delta, true); if (sleep(hack)) { return; } } hack.sleep(hack.delay / 2); // before next screen }