Source code: com/arranger/jarl/test/frac/Drawing.java
1 ////////////////////////////////////////////////////////////////////////////////
2 // Drawing Class ///////////////////////////////////////////////////////////////
3 ////////////////////////////////////////////////////////////////////////////////
4 // Copyright 2000 - David Leberknight - Anyone may use this code for any reason
5 // at any time, provided that they give an appropriate reference to this source,
6 // and send David some email ( david@leberknight.com ).
7 //
8 // Drawing is a simple class to hold Drawing data. There are three kinds of
9 // Drawings: Mandelbrot, Julia, and Help. This class is not abstract, but
10 // rather, holds the data to define a Mandelbrot Drawing.
11
12 package com.arranger.jarl.test.frac;
13
14
15 import java.awt.*;
16
17 public class Drawing {
18 protected int[][] colorNumbers; // Used by the FastColorsCalculator.
19 protected String color;
20 protected ComplexRectangle complexRect;
21 protected Image image;
22 protected int maxIterations;
23 protected Rectangle zoom;
24
25 public Drawing(ComplexRectangle complexRect, int maxIterations,
26 Image image, Rectangle zoom, String color) {
27 this.complexRect = complexRect;
28 this.maxIterations = maxIterations;
29 this.image = image;
30 this.zoom = zoom;
31 this.color = color;
32 colorNumbers = null;
33 }
34
35 /*protected void dump() {
36 System.out.println(getConsoleOutputString());
37 System.out.println("Max Iterations = " + maxIterations);
38 System.out.println("Color scheme = " + color);
39 System.out.println("Real Min = " +
40 FracTest.doubleAsString(complexRect.getRMin()));
41 System.out.println("Real Max = " +
42 FracTest.doubleAsString(complexRect.getRMax()));
43 System.out.println("Imaginary Min = " +
44 FracTest.doubleAsString(complexRect.getIMin()));
45 System.out.println("Imaginary Max = " +
46 FracTest.doubleAsString(complexRect.getIMax()));
47 }*/
48
49 public void finalize() {
50 // Called automatically by the system's garbage collector.
51 // This helps free up resources quickly when a drawing gets deleted.
52 image.flush();
53 }
54
55 protected int[][] getColorNumbers() {
56 return colorNumbers;
57 }
58
59 protected String getColor() {
60 return color;
61 }
62
63 protected ComplexRectangle getComplexRect() {
64 return complexRect;
65 }
66
67 protected String getConsoleOutputString() {
68 return new String("Mandelbrot Set Drawing:");
69 }
70
71 protected Image getImage() {
72 return image;
73 }
74
75 protected int getMaxIterations() {
76 return maxIterations;
77 }
78
79 protected Rectangle getZoom() {
80 return zoom;
81 }
82
83 protected boolean hasZoom() {
84 return (zoom != null);
85 }
86
87 protected void setComplexRect(ComplexRectangle cr) {
88 complexRect = cr;
89 }
90
91 protected void setImage(Image i) {
92 image = i;
93 }
94
95 protected void setColorNumbers(int[][] colors) {
96 colorNumbers = colors;
97 }
98
99 protected void setMaxIterations(int mi) {
100 maxIterations = mi;
101 }
102
103 protected void setZoom(Rectangle z) {
104 zoom = z;
105 }
106 }
107