summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-03-27 08:15:44 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-03-27 08:15:44 +0100
commitc88a67ce878890138dfc5a16d7d834a2f0cce8fc (patch)
treee75eecac944468a9344ab48f211609b112017629
parent9b3494d95ce96d87bac6b1b159a17ebc2bbcff5d (diff)
make ScreenDump work on OutputImage
-rw-r--r--src/ScreenDump.H5
-rw-r--r--src/ScreenDump.cxx12
-rw-r--r--src/gipfel.cxx3
3 files changed, 10 insertions, 10 deletions
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 <FL/x.H>
#include <FL/fl_draw.H>
-#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*) {