From c88a67ce878890138dfc5a16d7d834a2f0cce8fc Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Fri, 27 Mar 2009 08:15:44 +0100 Subject: make ScreenDump work on OutputImage --- src/ScreenDump.H | 5 +++-- src/ScreenDump.cxx | 12 +++++------- src/gipfel.cxx | 3 ++- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/ScreenDump.H b/src/ScreenDump.H index c0c9d21..d99a72d 100644 --- a/src/ScreenDump.H +++ b/src/ScreenDump.H @@ -8,6 +8,7 @@ #define SCREENDUMP_H #include "GipfelWidget.H" +#include "OutputImage.H" class ScreenDump { private: @@ -15,10 +16,10 @@ class ScreenDump { unsigned char * rgb; public: - ScreenDump(GipfelWidget *g); + ScreenDump(GipfelWidget *gipf); ~ScreenDump(); - int save(const char *file); + int save(OutputImage *out); }; #endif diff --git a/src/ScreenDump.cxx b/src/ScreenDump.cxx index 3bfd483..7a3447a 100644 --- a/src/ScreenDump.cxx +++ b/src/ScreenDump.cxx @@ -2,7 +2,6 @@ #include #include -#include "JPEGOutputImage.H" #include "ScreenDump.H" ScreenDump::ScreenDump(GipfelWidget *gipf) { @@ -27,18 +26,17 @@ ScreenDump::~ScreenDump() { } int -ScreenDump::save(const char *file) { - JPEGOutputImage out(file, 95); +ScreenDump::save(OutputImage *out) { - out.init(w, h); + out->init(w, h); for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { unsigned char *px = &rgb[(y * w + x) * 3]; - out.set_pixel(x, px[0] * 255, px[1] * 255, px[2] * 255); + out->set_pixel(x, px[0] * 255, px[1] * 255, px[2] * 255); } - out.next_line(); + out->next_line(); } - return out.done(); + return out->done(); } diff --git a/src/gipfel.cxx b/src/gipfel.cxx index 2b665b5..368d6ae 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -139,8 +139,9 @@ void save_cb() { void dump_cb(Fl_Widget * o, void*) { ScreenDump dmp(gipf); + JPEGOutputImage out("/tmp/dmp.jpg"); - dmp.save("/tmp/dmp.jpg"); + dmp.save(&out); } void focal_length_cb(Fl_Slider* o, void*) { -- cgit v1.2.3