1998-10-20 17:25:25 +04:00
|
|
|
//
|
|
|
|
// Mandelbrot set header file for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
2023-01-05 16:10:46 +03:00
|
|
|
// Copyright 1998-2023 by Bill Spitzak and others.
|
1998-10-20 17:25:25 +04:00
|
|
|
//
|
2011-07-19 08:49:30 +04:00
|
|
|
// This library is free software. Distribution and use rights are outlined in
|
|
|
|
// the file "COPYING" which should have been included with this file. If this
|
|
|
|
// file is missing or damaged, see the license at:
|
1998-10-20 17:25:25 +04:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// https://www.fltk.org/COPYING.php
|
1998-10-20 17:25:25 +04:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// Please see the following page on how to report bugs and issues:
|
2005-04-16 04:13:17 +04:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// https://www.fltk.org/bugs.php
|
1998-10-20 17:25:25 +04:00
|
|
|
//
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
#include <FL/Fl.H>
|
|
|
|
#include <FL/Fl_Box.H>
|
|
|
|
#include <FL/Fl_Slider.H>
|
2009-04-21 13:09:37 +04:00
|
|
|
#include <FL/Fl_Double_Window.H>
|
1998-10-06 22:21:25 +04:00
|
|
|
#include <FL/Fl_Input.H>
|
|
|
|
|
2023-01-05 16:10:46 +03:00
|
|
|
#define USE_COLORS 0 // change to 1 to start in color mode
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
class Drawing_Area : public Fl_Box {
|
2022-12-30 21:14:36 +03:00
|
|
|
void draw() FL_OVERRIDE;
|
1998-10-06 22:21:25 +04:00
|
|
|
public:
|
|
|
|
uchar *buffer;
|
2023-01-05 16:10:46 +03:00
|
|
|
int use_colors;
|
1998-10-06 22:21:25 +04:00
|
|
|
int W,H;
|
2023-01-05 16:10:46 +03:00
|
|
|
int dx, dy, dw, dh; // drawing box offsets
|
1998-10-06 22:21:25 +04:00
|
|
|
int nextline;
|
|
|
|
int drawn;
|
|
|
|
int julia;
|
|
|
|
int iterations;
|
|
|
|
int brightness;
|
|
|
|
double jX, jY;
|
|
|
|
double X,Y,scale;
|
|
|
|
int sx, sy, sw, sh; // selection box
|
|
|
|
void erase_box();
|
2022-12-30 21:14:36 +03:00
|
|
|
int handle(int) FL_OVERRIDE;
|
|
|
|
void resize(int,int,int,int) FL_OVERRIDE;
|
1998-10-06 22:21:25 +04:00
|
|
|
void new_display();
|
2023-01-05 16:10:46 +03:00
|
|
|
void new_buffer();
|
1998-10-06 22:21:25 +04:00
|
|
|
enum {
|
|
|
|
MAX_BRIGHTNESS = 16,
|
|
|
|
DEFAULT_BRIGHTNESS = 16,
|
2023-01-05 16:10:46 +03:00
|
|
|
DEFAULT_BRIGHTNESS_COLOR = 8,
|
1998-10-06 22:21:25 +04:00
|
|
|
MAX_ITERATIONS = 14,
|
|
|
|
DEFAULT_ITERATIONS = 7
|
|
|
|
};
|
|
|
|
Drawing_Area(int x,int y,int w,int h) : Fl_Box(x,y,w,h) {
|
|
|
|
buffer = 0;
|
2023-01-05 16:10:46 +03:00
|
|
|
use_colors = USE_COLORS;
|
|
|
|
W = w;
|
|
|
|
H = h;
|
|
|
|
dx = dy = 0; // NOTE: as the box type is set *after* the constructor
|
|
|
|
dw = dh = 0; // the actual offsets are determined in draw()
|
1998-10-06 22:21:25 +04:00
|
|
|
nextline = 0;
|
|
|
|
drawn = 0;
|
|
|
|
julia = 0;
|
|
|
|
X = Y = 0;
|
|
|
|
scale = 4.0;
|
|
|
|
iterations = 1<<DEFAULT_ITERATIONS;
|
2023-01-05 16:10:46 +03:00
|
|
|
brightness = use_colors ? DEFAULT_BRIGHTNESS_COLOR : DEFAULT_BRIGHTNESS;
|
2023-01-14 22:07:30 +03:00
|
|
|
sx = sy = sw = sh = 0;
|
1998-10-06 22:21:25 +04:00
|
|
|
}
|
|
|
|
int idle();
|
|
|
|
};
|