diff options
| author | Matthias Melcher <github@matthiasm.com> | 2023-01-05 14:10:46 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-05 14:10:46 +0100 |
| commit | 9ef9bbe80ed20cbcb05f58327ca4f61297c7899f (patch) | |
| tree | 307c45de0cca5d363c53485256fd27b4dc967d0c /test/mandelbrot.h | |
| parent | 8826dca1066361b474139bcc5aeed2e3a5246ed0 (diff) | |
Adding color to test/mandelbrot (#634)
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(); }; |
