summaryrefslogtreecommitdiff
path: root/splash
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2007-08-22 21:29:32 +0000
committerAlbert Astals Cid <aacid@kde.org>2007-08-22 21:29:32 +0000
commit3ba088d8caee3c40c2aba0cd85adcf9195ae88a3 (patch)
tree0256b768b673d3aa1c3459e2d39ef0ef4284a2ac /splash
parent567e82c13aace4f40c7a555a62a3a4d223a46d92 (diff)
* splash/SplashBitmap.cc:
* splash/SplashBitmap.h: * utils/pdftoppm.cc: Add the following features to pdftoppm - if omitting input filename or using - for input filename reads pdf from stdin - if omitting output filename, prints output to stdout - create image of a cropped rectangle of the pdf - scale pdf to fit in a square of wanted size Patch by Ilmari Heikkinen <ilmari.heikkinen@gmail.com>
Diffstat (limited to 'splash')
-rw-r--r--splash/SplashBitmap.cc18
-rw-r--r--splash/SplashBitmap.h2
2 files changed, 16 insertions, 4 deletions
diff --git a/splash/SplashBitmap.cc b/splash/SplashBitmap.cc
index 814350a6..e51893c5 100644
--- a/splash/SplashBitmap.cc
+++ b/splash/SplashBitmap.cc
@@ -69,15 +69,26 @@ SplashBitmap::~SplashBitmap() {
gfree(alpha);
}
+
SplashError SplashBitmap::writePNMFile(char *fileName) {
FILE *f;
- SplashColorPtr row, p;
- int x, y;
+ SplashError e;
if (!(f = fopen(fileName, "wb"))) {
return splashErrOpenFile;
}
+ e = this->writePNMFile(f);
+
+ fclose(f);
+ return e;
+}
+
+
+SplashError SplashBitmap::writePNMFile(FILE *f) {
+ SplashColorPtr row, p;
+ int x, y;
+
switch (mode) {
case splashModeMono1:
@@ -158,11 +169,10 @@ SplashError SplashBitmap::writePNMFile(char *fileName) {
break;
#endif
}
-
- fclose(f);
return splashOk;
}
+
void SplashBitmap::getPixel(int x, int y, SplashColorPtr pixel) {
SplashColorPtr p;
diff --git a/splash/SplashBitmap.h b/splash/SplashBitmap.h
index 37022d77..01e217bd 100644
--- a/splash/SplashBitmap.h
+++ b/splash/SplashBitmap.h
@@ -12,6 +12,7 @@
#endif
#include "SplashTypes.h"
+#include <stdio.h>
//------------------------------------------------------------------------
// SplashBitmap
@@ -39,6 +40,7 @@ public:
Guchar *getAlphaPtr() { return alpha; }
SplashError writePNMFile(char *fileName);
+ SplashError writePNMFile(FILE *f);
void getPixel(int x, int y, SplashColorPtr pixel);
Guchar getAlpha(int x, int y);