diff options
Diffstat (limited to 'test/mandelbrot.h')
| -rw-r--r-- | test/mandelbrot.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/test/mandelbrot.h b/test/mandelbrot.h index 023fa0d73..b946232f5 100644 --- a/test/mandelbrot.h +++ b/test/mandelbrot.h @@ -1,7 +1,7 @@ // // Mandelbrot set header file for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2023 by Bill Spitzak and others. // // 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 @@ -20,11 +20,15 @@ #include <FL/Fl_Double_Window.H> #include <FL/Fl_Input.H> +#define USE_COLORS 0 // change to 1 to start in color mode + class Drawing_Area : public Fl_Box { void draw() FL_OVERRIDE; public: uchar *buffer; + int use_colors; int W,H; + int dx, dy, dw, dh; // drawing box offsets int nextline; int drawn; int julia; @@ -37,23 +41,28 @@ public: int handle(int) FL_OVERRIDE; void resize(int,int,int,int) FL_OVERRIDE; void new_display(); + void new_buffer(); enum { MAX_BRIGHTNESS = 16, DEFAULT_BRIGHTNESS = 16, + DEFAULT_BRIGHTNESS_COLOR = 8, MAX_ITERATIONS = 14, DEFAULT_ITERATIONS = 7 }; Drawing_Area(int x,int y,int w,int h) : Fl_Box(x,y,w,h) { buffer = 0; - W = w-6; - H = h-8; + 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() nextline = 0; drawn = 0; julia = 0; X = Y = 0; scale = 4.0; iterations = 1<<DEFAULT_ITERATIONS; - brightness = DEFAULT_BRIGHTNESS; + brightness = use_colors ? DEFAULT_BRIGHTNESS_COLOR : DEFAULT_BRIGHTNESS; } int idle(); }; |
