diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-09-17 20:27:19 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-09-17 20:27:19 +0000 |
| commit | 0792860a57d4185a22ea9e0e0646a9b14c27b444 (patch) | |
| tree | ea35fa6b846d885522237c00ab0a112d18d2fcb4 /src | |
| parent | 11bf9b28da63ee26632b6cf72aeba16115daf9b3 (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')
| -rw-r--r-- | src/Fl_PNM_Image.cxx | 16 | ||||
| -rw-r--r-- | src/fl_images_core.cxx | 6 |
2 files changed, 17 insertions, 5 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 $". // diff --git a/src/fl_images_core.cxx b/src/fl_images_core.cxx index e83b22b26..8f6b6a26f 100644 --- a/src/fl_images_core.cxx +++ b/src/fl_images_core.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_images_core.cxx,v 1.1.2.3 2002/08/09 01:09:49 easysw Exp $" +// "$Id: fl_images_core.cxx,v 1.1.2.4 2002/09/17 20:27:19 easysw Exp $" // // FLTK images library core. // @@ -75,7 +75,7 @@ fl_check_images(const char *name, // I - Filename if (memcmp(header, "BM", 2) == 0) // BMP file return new Fl_BMP_Image(name); - if (header[0] == 'P' && header[1] >= '1' && header[1] <= '6') + if (header[0] == 'P' && header[1] >= '1' && header[1] <= '7') // Portable anymap return new Fl_PNM_Image(name); @@ -97,5 +97,5 @@ fl_check_images(const char *name, // I - Filename // -// End of "$Id: fl_images_core.cxx,v 1.1.2.3 2002/08/09 01:09:49 easysw Exp $". +// End of "$Id: fl_images_core.cxx,v 1.1.2.4 2002/09/17 20:27:19 easysw Exp $". // |
