summaryrefslogtreecommitdiff
path: root/graphics/xv/patches/patch-ao
blob: de9aed5b99a41a6b1429931e4213c036354c86bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
$NetBSD: patch-ao,v 1.2 2004/03/29 00:50:41 dillo Exp $

This patch is based on
http://www.mit.edu/afs/athena/contrib/graphics/src/xv/patches/png/xvpng.diff
It was edited to fit into the NetBSD Packages Collection! - HF

It is also based on
ftp://ftp.trilon.com/pub/xv/patches/longname.patch

---------------------------------------------------------------------------


--- xvdir.c.orig	Sun Mar 21 21:18:09 2004
+++ xvdir.c
@@ -62,6 +62,9 @@ static char *saveFormats[] = { "GIF",
 #ifdef HAVE_TIFF
 			       "TIFF",
 #endif
+#ifdef HAVE_PNG
+                               "PNG",
+#endif 
 			       "PostScript",
 			       "PBM/PGM/PPM (raw)",
 			       "PBM/PGM/PPM (ascii)",
@@ -1123,6 +1126,14 @@ int DoSave()
   }
 #endif
 
+#ifdef HAVE_PNG
+  else if (fmt == F_PNG) {   /* PNG */
+    PNGSaveParams(fullname, col);
+    PNGDialog(1);                   /* open PNG Dialog box */
+    dbut[S_BOK].lit = 0;  BTRedraw(&dbut[S_BOK]);
+    return 0;                      /* always 'succeeds' */
+  }
+#endif
 
 
 
@@ -1181,6 +1192,7 @@ int DoSave()
   case F_FITS:
     rv = WriteFITS  (fp, thepic, ptype, w, h, rp, gp, bp, nc, col, 
 		     picComments);    
+    break;
   case F_MAG:
     rv = WriteMAG   (fp, thepic, ptype, w, h, rp, gp, bp, nc, col, 
 		     picComments);    break;
@@ -1416,19 +1428,26 @@ static void changeSuffix()
       (strcmp(lowsuf,"eps" )==0) ||
       (strcmp(lowsuf,"rgb" )==0) ||
       (strcmp(lowsuf,"tga" )==0) ||
-      (strcmp(lowsuf,"xpm" )==0) ||
       (strcmp(lowsuf,"fits")==0) ||
       (strcmp(lowsuf,"fts" )==0) ||
+#ifdef HAVE_JPEG
       (strcmp(lowsuf,"jpg" )==0) ||
       (strcmp(lowsuf,"jpeg")==0) ||
       (strcmp(lowsuf,"jfif")==0) ||
+#endif
+#ifdef HAVE_TIFF
       (strcmp(lowsuf,"tif" )==0) ||
       (strcmp(lowsuf,"tiff")==0) ||
+#endif
+#ifdef HAVE_PNG
+      (strcmp(lowsuf,"png" )==0) ||
+#endif
+      (strcmp(lowsuf,"xpm" )==0) ||
       (strcmp(lowsuf,"mag" )==0) ||
       (strcmp(lowsuf,"pic" )==0) ||
       (strcmp(lowsuf,"mki" )==0) ||
       (strcmp(lowsuf,"pi"  )==0) ||
-      (strcmp(lowsuf,"p2"  )==0)){
+      (strcmp(lowsuf,"p2"  )==0)) {
 
     /* found one.  set lowsuf = to the new suffix, and tack on to filename */
 
@@ -1463,6 +1482,9 @@ static void changeSuffix()
 
 #ifdef HAVE_TIFF
     case F_TIFF:     strcpy(lowsuf,"tif");  break;
+#endif
+#ifdef HAVE_PNG
+    case F_PNG:      strcpy(lowsuf,"png");  break;
 #endif
     case F_MAG:      strcpy(lowsuf,"mag");  break;
     case F_PIC:      strcpy(lowsuf,"pic");  break;