From 85751141b5705dba503b507ab34cc4ee734a9e6a Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Thu, 4 Jun 2015 22:33:05 +0200 Subject: Started own version --- Week15 Mandelbrot/src/mandelbrot/GridFiller.java | 59 ------------------------ 1 file changed, 59 deletions(-) delete mode 100644 Week15 Mandelbrot/src/mandelbrot/GridFiller.java (limited to 'Week15 Mandelbrot/src/mandelbrot/GridFiller.java') diff --git a/Week15 Mandelbrot/src/mandelbrot/GridFiller.java b/Week15 Mandelbrot/src/mandelbrot/GridFiller.java deleted file mode 100644 index 1e741a2..0000000 --- a/Week15 Mandelbrot/src/mandelbrot/GridFiller.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package mandelbrot; - -import java.awt.Color; -import java.awt.Graphics; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.swing.SwingWorker; - -/** - * - * @author Sjaak - */ -public class GridFiller { - - private Area area; - private Grid grid; - public static final int MAX_ITERATIONS = 400; - private static final RGBColors rgbColors = new RGBColors(MAX_ITERATIONS); - private static final ColorChooser colorChooser = new ColorChooser(); - - public GridFiller(Grid grid, Area area) { - this.grid = grid; - this.area = area; - colorChooser.setMaxIndex(MAX_ITERATIONS); - } - - public Area getArea() { - return area; - } - - public void fill() { - int grid_w = grid.getWidth(), grid_h = grid.getHeight(); - double area_w = area.getWidth(), area_h = area.getHeight(); - double dx = area_w / grid_w, dy = area_h / grid_h; - - double x = area.getX(); - for (int i = 0; i < grid_w; i++) { - double y = area.getY(); - for (int j = 0; j < grid_h; j++) { - int color = colorChooser.getColorIndex(x, y); - grid.setPixel(i, j, - color == -1 ? RGBColors.BLACK : rgbColors.getColor(color)); - - y -= dy; - } - try { - Thread.sleep( 2 ); - } catch (InterruptedException e) { - System.out.println("Sleeping thread interrupted"); - } - x += dx; - } - } -} -- cgit v1.2.3