summaryrefslogtreecommitdiff
path: root/src/Fl_PNM_Image.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2002-09-17 20:27:19 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2002-09-17 20:27:19 +0000
commit0792860a57d4185a22ea9e0e0646a9b14c27b444 (patch)
treeea35fa6b846d885522237c00ab0a112d18d2fcb4 /src/Fl_PNM_Image.cxx
parent11bf9b28da63ee26632b6cf72aeba16115daf9b3 (diff)
Add support for XV/GIMP thumbnail format (P7)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2626 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_PNM_Image.cxx')
-rw-r--r--src/Fl_PNM_Image.cxx16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/Fl_PNM_Image.cxx b/src/Fl_PNM_Image.cxx
index c6de8ba15..5742357fe 100644
--- a/src/Fl_PNM_Image.cxx
+++ b/src/Fl_PNM_Image.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_PNM_Image.cxx,v 1.1.2.8 2002/05/27 21:16:47 easysw Exp $"
+// "$Id: Fl_PNM_Image.cxx,v 1.1.2.9 2002/09/17 20:27:18 easysw Exp $"
//
// Fl_PNM_Image routines.
//
@@ -83,6 +83,8 @@ Fl_PNM_Image::Fl_PNM_Image(const char *name) // I - File to read
format = atoi(lineptr);
while (isdigit(*lineptr)) lineptr ++;
+ if (format == 7) lineptr = "";
+
while (lineptr != NULL && w() == 0) {
if (*lineptr == '\0' || *lineptr == '#') {
lineptr = fgets(line, sizeof(line), fp);
@@ -155,6 +157,16 @@ Fl_PNM_Image::Fl_PNM_Image(const char *name) // I - File to read
case 6 :
fread(ptr, w(), d(), fp);
break;
+
+ case 7 : /* XV 3:3:2 thumbnail format */
+ for (x = w(); x > 0; x --) {
+ byte = getc(fp);
+
+ *ptr++ = 255 * ((byte >> 5) & 7) / 7;
+ *ptr++ = 255 * ((byte >> 2) & 7) / 7;
+ *ptr++ = 255 * (byte & 3) / 3;
+ }
+ break;
}
}
@@ -163,5 +175,5 @@ Fl_PNM_Image::Fl_PNM_Image(const char *name) // I - File to read
//
-// End of "$Id: Fl_PNM_Image.cxx,v 1.1.2.8 2002/05/27 21:16:47 easysw Exp $".
+// End of "$Id: Fl_PNM_Image.cxx,v 1.1.2.9 2002/09/17 20:27:18 easysw Exp $".
//