diff options
| author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2008-09-07 17:26:28 +0200 |
|---|---|---|
| committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2008-09-07 17:26:28 +0200 |
| commit | 7be4bae40736f364d65cfb56067203451da053a0 (patch) | |
| tree | abd21d91cfcaa3fa5cc1621b2467502e3806f6e5 /src/pnmcurvedit.cxx | |
| parent | 23efce14f047a27f99aa05b8c3596e198d972c19 (diff) | |
finish pnmcurvedit
Diffstat (limited to 'src/pnmcurvedit.cxx')
| -rw-r--r-- | src/pnmcurvedit.cxx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/pnmcurvedit.cxx b/src/pnmcurvedit.cxx new file mode 100644 index 0000000..bb93099 --- /dev/null +++ b/src/pnmcurvedit.cxx @@ -0,0 +1,46 @@ +// +// Copyright 2008 Johannes Hofmann <Johannes.Hofmann@gmx.de> +// +// This software may be used and distributed according to the terms +// of the GNU General Public License, incorporated herein by reference. + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> + +#include <FL/Fl.H> +#include <FL/Fl_Double_Window.H> + +#include "CurveEditor.H" + +static CurveEditor *ce; + +static void editor_cb(Fl_Widget* o, void* d) { + double x, y; + + printf("pnmcurve -c "); + for (int i = 0; i<ce->get_n(); i++) { + if (i != 0) + printf(","); + ce->get_point(i, &x, &y); + printf("%g:%g", x, y); + } + printf("\n"); + fflush(stdout); +} + +int +main(int argc, char **argv) { + Fl_Double_Window window(800, 600, "pnmcurvedit"); + ce = new CurveEditor(0, 0, 800, 600); + ce->add_point(0.0, 0.0); + ce->add_point(0.5, 0.4); + ce->add_point(1.0, 1.0); + ce->callback(editor_cb, NULL); + + window.resizable(ce); + window.show(); + + return Fl::run(); +} |
