
gnu.app.displayhack.eraser.Circle Maven / Gradle / Ivy
Show all versions of escher Show documentation
package gnu.app.displayhack.eraser;
/**
* Erase by a circle.
*
* Modified from circle_wipe
of erase.c
in xscreensaver by Johannes
* Keukelaar .
*/
public class Circle extends Eraser {
public Circle () { super ("circle-wipe"); }
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