Merge from vendor branch TNF:
[pkgsrc.git] / graphics / xv / patches / patch-png2-xvdir.c
1 $NetBSD$
2
3 This patch is based on
4 http://www.mit.edu/afs/athena/contrib/graphics/src/xv/patches/png/xvpng.diff
5 It was edited to fit into the NetBSD Packages Collection! - HF
6
7 ---------------------------------------------------------------------------
8
9
10 --- xvdir.c.patched     Sun Jun 13 03:27:12 1999
11 +++ xvdir.c     Sun Jun 13 03:33:01 1999
12 @@ -62,6 +62,9 @@
13  #ifdef HAVE_TIFF
14                                "TIFF",
15  #endif
16 +#ifdef HAVE_PNG
17 +                               "PNG",
18 +#endif 
19                                "PostScript",
20                                "PBM/PGM/PPM (raw)",
21                                "PBM/PGM/PPM (ascii)",
22 @@ -1123,6 +1126,14 @@
23    }
24  #endif
25  
26 +#ifdef HAVE_PNG
27 +  else if (fmt == F_PNG) {   /* PNG */
28 +    PNGSaveParams(fullname, col);
29 +    PNGDialog(1);                   /* open PNG Dialog box */
30 +    dbut[S_BOK].lit = 0;  BTRedraw(&dbut[S_BOK]);
31 +    return 0;                      /* always 'succeeds' */
32 +  }
33 +#endif
34  
35  
36  
37 @@ -1181,6 +1192,7 @@
38    case F_FITS:
39      rv = WriteFITS  (fp, thepic, ptype, w, h, rp, gp, bp, nc, col, 
40                      picComments);    
41 +    break;
42    case F_MAG:
43      rv = WriteMAG   (fp, thepic, ptype, w, h, rp, gp, bp, nc, col, 
44                      picComments);    break;
45 @@ -1415,19 +1427,26 @@
46        (strcmp(lowsuf,"eps" )==0) ||
47        (strcmp(lowsuf,"rgb" )==0) ||
48        (strcmp(lowsuf,"tga" )==0) ||
49 -      (strcmp(lowsuf,"xpm" )==0) ||
50        (strcmp(lowsuf,"fits")==0) ||
51        (strcmp(lowsuf,"fts" )==0) ||
52 +#ifdef HAVE_JPEG
53        (strcmp(lowsuf,"jpg" )==0) ||
54        (strcmp(lowsuf,"jpeg")==0) ||
55        (strcmp(lowsuf,"jfif")==0) ||
56 +#endif
57 +#ifdef HAVE_TIFF
58        (strcmp(lowsuf,"tif" )==0) ||
59        (strcmp(lowsuf,"tiff")==0) ||
60 +#endif
61 +#ifdef HAVE_PNG
62 +      (strcmp(lowsuf,"png" )==0) ||
63 +#endif
64 +      (strcmp(lowsuf,"xpm" )==0) ||
65        (strcmp(lowsuf,"mag" )==0) ||
66        (strcmp(lowsuf,"pic" )==0) ||
67        (strcmp(lowsuf,"mki" )==0) ||
68        (strcmp(lowsuf,"pi"  )==0) ||
69 -      (strcmp(lowsuf,"p2"  )==0)){
70 +      (strcmp(lowsuf,"p2"  )==0)) {
71  
72      /* found one.  set lowsuf = to the new suffix, and tack on to filename */
73  
74 @@ -1462,6 +1481,9 @@
75  
76  #ifdef HAVE_TIFF
77      case F_TIFF:     strcpy(lowsuf,"tif");  break;
78 +#endif
79 +#ifdef HAVE_PNG
80 +    case F_PNG:      strcpy(lowsuf,"png");  break;
81  #endif
82      case F_MAG:      strcpy(lowsuf,"mag");  break;
83      case F_PIC:      strcpy(lowsuf,"pic");  break;