+ let Ci_min = -1.5;
+ let Ci_max = 1.5;
+ try {
+ Ci_min = parseFloat(gPref.getCharPref("mandelbrot.last_image.Ci_min"));
+ Ci_max = parseFloat(gPref.getCharPref("mandelbrot.last_image.Ci_max"));
+ }
+ catch (e) { }
+ if ((Ci_min < -2) || (Ci_min > 2) ||
+ (Ci_max < -2) || (Ci_max > 2) || (Ci_min >= Ci_max)) {
+ Ci_min = -2.0; Ci_max = 1.0;
+ }
+ gPref.setCharPref("mandelbrot.last_image.Ci_min", Ci_min);
+ gPref.setCharPref("mandelbrot.last_image.Ci_max", Ci_max);
+
+ let iterMax = gPref.getIntPref("mandelbrot.iteration_max");
+ let algorithm = gPref.getCharPref("mandelbrot.use_algorithm");
+
+ let iWidth = 0;
+ try {
+ iWidth = gPref.getIntPref("mandelbrot.image.width");
+ }
+ catch (e) { }
+ if ((iWidth < 10) || (iWidth > 5000)) {
+ iWidth = 300;
+ gPref.setIntPref("mandelbrot.image.width", iWidth);
+ }
+ let iHeight = 0;
+ try {
+ iHeight = gPref.getIntPref("mandelbrot.image.height");
+ }
+ catch (e) { }
+ if ((iHeight < 10) || (iHeight > 5000)) {
+ iHeight = 300;
+ gPref.setIntPref("mandelbrot.image.height", iHeight);
+ }
+
+ canvas.width = iWidth;
+ canvas.height = iHeight;
+
+ context.fillStyle = "rgba(255, 255, 255, 127)";
+ context.fillRect(0, 0, canvas.width, canvas.height);
+
+ gStartTime = new Date();
+
+ drawLine(0, [Cr_min, Cr_max, Ci_min, Ci_max],
+ canvas, context, iterMax, algorithm);
+}