Changeset 13434
- Timestamp:
- May 18, 2007, 10:10:41 AM (19 years ago)
- Location:
- branches/kapa-mods-2007-05/Ohana/src
- Files:
-
- 2 added
- 35 edited
-
kapa2/Makefile (modified) (1 diff)
-
kapa2/include/prototypes.h (modified) (1 diff)
-
kapa2/include/structures.h (modified) (2 diffs)
-
kapa2/src/CheckPipe.c (modified) (2 diffs)
-
kapa2/src/Graphs.c (modified) (1 diff)
-
kapa2/src/LoadPicture.c (modified) (1 diff)
-
kapa2/src/SetGraphData.c (added)
-
kapa2/src/SetImageData.c (added)
-
kapa2/src/UpdateStatusBox.c (modified) (1 diff)
-
kapa2/src/bDrawIt.c (modified) (1 diff)
-
libkapa/doc/api.txt (modified) (1 diff)
-
libkapa/include/kapa.h (modified) (4 diffs)
-
libkapa/src/KapaWindow.c (modified) (2 diffs)
-
libkapa/src/KiiPicture.c (modified) (7 diffs)
-
opihi/cmd.astro/gauss.c (modified) (3 diffs)
-
opihi/cmd.astro/objload.c (modified) (1 diff)
-
opihi/cmd.astro/outline.c (modified) (1 diff)
-
opihi/cmd.astro/outline2.c (modified) (1 diff)
-
opihi/cmd.data/center.c (modified) (1 diff)
-
opihi/cmd.data/cursor.c (modified) (5 diffs)
-
opihi/cmd.data/device.c (modified) (1 diff)
-
opihi/cmd.data/erase.c (modified) (1 diff)
-
opihi/cmd.data/jpeg.c (modified) (2 diffs)
-
opihi/cmd.data/load.c (modified) (3 diffs)
-
opihi/cmd.data/point.c (modified) (3 diffs)
-
opihi/cmd.data/ps.c (modified) (1 diff)
-
opihi/cmd.data/resize.c (modified) (1 diff)
-
opihi/cmd.data/save.c (modified) (1 diff)
-
opihi/cmd.data/style.c (modified) (2 diffs)
-
opihi/cmd.data/tv.c (modified) (5 diffs)
-
opihi/cmd.data/tvcontour.c (modified) (1 diff)
-
opihi/cmd.data/tvgrid.c (modified) (2 diffs)
-
opihi/cmd.data/vload.c (modified) (1 diff)
-
opihi/dvo/cmpload.c (modified) (1 diff)
-
opihi/include/display.h (modified) (1 diff)
-
opihi/lib.data/open_kapa.c (modified) (7 diffs)
-
opihi/lib.shell/BufferOps.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/Makefile
r13432 r13434 65 65 $(SRC)/CreatePicture.$(ARCH).o $(SRC)/CreateColorbar.$(ARCH).o \ 66 66 $(SRC)/MakeColormap.$(ARCH).o $(SRC)/SetColormap.$(ARCH).o \ 67 $(SRC)/PaintOverlay.$(ARCH).o $(SRC)/SetGraph Style.$(ARCH).o\67 $(SRC)/PaintOverlay.$(ARCH).o $(SRC)/SetGraphData.$(ARCH).o \ 68 68 $(SRC)/LoadOverlay.$(ARCH).o $(SRC)/EraseOverlay.$(ARCH).o \ 69 $(SRC)/SaveOverlay.$(ARCH).o \69 $(SRC)/SaveOverlay.$(ARCH).o $(SRC)/SetImageData.$(ARCH).o \ 70 70 $(SRC)/CSaveOverlay.$(ARCH).o $(SRC)/EraseOverlay.$(ARCH).o \ 71 71 $(SRC)/CheckVisual.$(ARCH).o $(SRC)/CursorOps.$(ARCH).o \ -
branches/kapa-mods-2007-05/Ohana/src/kapa2/include/prototypes.h
r13432 r13434 63 63 int EraseSections PROTO((void)); 64 64 int EraseImage PROTO((void)); 65 int SetGraphStyle PROTO((int sock)); 66 int GetGraphStyle PROTO((int sock)); 65 int SetGraphData PROTO((int sock)); 66 int GetGraphData PROTO((int sock)); 67 int SetImageData PROTO((int sock)); 68 int GetImageData PROTO((int sock)); 67 69 68 70 int LoadVectorData PROTO((int sock, KapaGraphWidget *graph, int N, char *type)); -
branches/kapa-mods-2007-05/Ohana/src/kapa2/include/structures.h
r13432 r13434 116 116 Axis axis[4]; /* coordinate axes */ 117 117 Label label[8]; /* fixed axis labels */ 118 Graphdata style; /* current graph style*/118 Graphdata data; /* current graph data */ 119 119 120 120 Gobjects *objects; /* graphic objects */ … … 161 161 Coords coords; 162 162 char file[1024]; /* name of file */ 163 char buffer_name[1024]; /* name of buffer */163 char name[1024]; /* name of buffer */ 164 164 } KapaImageWidget; 165 165 -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/CheckPipe.c
r13432 r13434 132 132 133 133 if (!strcmp (word, "GSTY")) { 134 GetGraph Style(sock);134 GetGraphData (sock); 135 135 KiiSendCommand (sock, 4, "DONE"); 136 136 FINISHED (TRUE); … … 138 138 139 139 if (!strcmp (word, "SSTY")) { 140 status = SetGraphStyle (sock); 140 status = SetGraphData (sock); 141 KiiSendCommand (sock, 4, "DONE"); 142 FINISHED (TRUE); 143 } 144 145 if (!strcmp (word, "GIMD")) { 146 GetImageData (sock); 147 KiiSendCommand (sock, 4, "DONE"); 148 FINISHED (TRUE); 149 } 150 151 if (!strcmp (word, "SIMD")) { 152 status = SetImageData (sock); 141 153 KiiSendCommand (sock, 4, "DONE"); 142 154 FINISHED (TRUE); -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Graphs.c
r13433 r13434 21 21 } 22 22 23 graph[0]. style.xmin = 0.0;24 graph[0]. style.xmax = 1.0;25 graph[0]. style.ymin = 0.0;26 graph[0]. style.ymax = 1.0;23 graph[0].data.xmin = 0.0; 24 graph[0].data.xmax = 1.0; 25 graph[0].data.ymin = 0.0; 26 graph[0].data.ymax = 1.0; 27 27 28 28 graph[0].Nobjects = 0; -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadPicture.c
r13409 r13434 23 23 KiiScanMessage (sock, "%d %d %d %d %lf %lf", &header.Naxis[0], &header.Naxis[1]); 24 24 KiiScanMessage (sock, "%d %d %d %d %lf %lf", &header.bitpix, &header.unsign, &header.bzero, &header.bscale); 25 KiiScanMessage (sock, "%lf %lf ", &image[0].zero, &image[0].range);25 KiiScanMessage (sock, "%lf %lf %s", &image[0].zero, &image[0].range, image[0].name, image[0].file); 26 26 KiiScanMessage (sock, "%lf %lf %d", &image[0].min, &image[0].max, &header.size); 27 27 KiiScanMessage (sock, "%lf %f %f %f %f", &image[0].coords.crval1, &image[0].coords.crpix1, &image[0].coords.cdelt1, &image[0].coords.pc1_1, &image[0].coords.pc1_2); 28 28 KiiScanMessage (sock, "%lf %f %f %f %f", &image[0].coords.crval2, &image[0].coords.crpix2, &image[0].coords.cdelt2, &image[0].coords.pc2_1, &image[0].coords.pc2_2); 29 30 KiiScanMessage (sock, "%s %s %s", image[0].coords.ctype, image[0].file, image[0].buffer_name); 29 KiiScanMessage (sock, "%s", image[0].coords.ctype); 31 30 32 31 gfits_free_matrix (&image[0].matrix); -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/UpdateStatusBox.c
r13401 r13434 31 31 32 32 bzero (line, 100); 33 sprintf (line, "(%s) ", image[0]. buffer_name);33 sprintf (line, "(%s) ", image[0].name); 34 34 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, 35 35 image[0].text_x + PAD1, image[0].text_y + 6*textpad + 6*PAD1, line, 25); -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/bDrawIt.c
r13320 r13434 22 22 section = GetSectionByNumber (i); 23 23 bDrawGraph (section->graph); 24 // bDrawImage (section-> graph);24 // bDrawImage (section->image); 25 25 } 26 26 -
branches/kapa-mods-2007-05/Ohana/src/libkapa/doc/api.txt
r13404 r13434 31 31 SAVE | SaveOverlay | KiiOverlay.c | KiiSaveOverlay 32 32 CSVE | CSaveOverlay | KiiOverlay.c | KiiSaveOverlay 33 LIMS | GetLimits | KapaWindow.c | KapaGetLimits 34 35 TICK | LoadTickmarks | XXX not used 36 NPIX | GetPixelCount | XXX not used? 33 SLIM | GetLimits | KapaWindow.c | KapaGetLimits 34 SSTY | SetGraphData | KapaWindow.c | KapaSetGraphData 35 GSTY | GetGraphData | KapaWindow.c | KapaGetGraphData 36 SIMD | SetImageData | KapaWindow.c | KapaSetImageData 37 GIMD | GetImageData | KapaWindow.c | KapaGetImageData -
branches/kapa-mods-2007-05/Ohana/src/libkapa/include/kapa.h
r13432 r13434 20 20 int Nx; 21 21 int Ny; 22 char *file;23 char *name;24 22 } KiiImage; 25 26 typedef struct {27 double zero;28 double range;29 int logflux;30 } KiiDisplayMode;31 23 32 24 typedef struct { … … 90 82 91 83 typedef struct { 84 int logflux; 85 double zero, range; 86 char name[1024]; 87 char file[1024]; 88 } KapaImageData; 89 90 typedef struct { 92 91 int dx, dy, ascent; 93 92 unsigned char *bits; … … 123 122 124 123 /* KiiPicture.c */ 125 int KiiNewPicture1D (int fd, KiiImage *image, K iiDisplayMode *mode, Coords *coords);126 int KiiNewPicture2D (int fd, KiiImage *image, K iiDisplayMode *mode, Coords *coords);124 int KiiNewPicture1D (int fd, KiiImage *image, KapaImageData *data, Coords *coords); 125 int KiiNewPicture2D (int fd, KiiImage *image, KapaImageData *data, Coords *coords); 127 126 128 127 /* KiiOverlay.c */ … … 164 163 int KapaGetSection (int fd, char *name); 165 164 int KapaMoveSection (int fd, char *name, char *direction); 166 int KapaSetGraphStyle (int fd, Graphdata *graphmode); 167 int KapaGetGraphStyle (int fd, Graphdata *graphmode); 165 int KapaSetGraphData (int fd, Graphdata *graphmode); 166 int KapaGetGraphData (int fd, Graphdata *graphmode); 167 int KapaSetImageData (int fd, KapaImageData *graphmode); 168 int KapaGetImageData (int fd, KapaImageData *graphmode); 168 169 169 170 /* KapaColors */ -
branches/kapa-mods-2007-05/Ohana/src/libkapa/src/KapaWindow.c
r13432 r13434 91 91 } 92 92 93 int KapaPrepPlot (int fd, int Npts, Graphdata * graphmode) {93 int KapaPrepPlot (int fd, int Npts, Graphdata *data) { 94 94 95 95 /* tell kapa to look for the incoming image */ 96 96 KiiSendCommand (fd, 4, "PLOT"); 97 97 98 /* send Xgraphthe plot details */98 /* send kapa the plot details */ 99 99 KiiSendMessage (fd, "%8d %8d %d %d %d %d %d %f %f", 100 Npts, graphmode[0].style,101 graphmode[0].ptype, graphmode[0].ltype,102 graphmode[0].etype, graphmode[0].ebar, graphmode[0].color,103 graphmode[0].lweight, graphmode[0].size);100 Npts, data[0].style, 101 data[0].ptype, data[0].ltype, 102 data[0].etype, data[0].ebar, data[0].color, 103 data[0].lweight, data[0].size); 104 104 KiiSendMessage (fd, "%g %g %g %g", 105 graphmode[0].xmin, graphmode[0].xmax,106 graphmode[0].ymin, graphmode[0].ymax);107 KiiWaitAnswer (fd, "DONE"); 108 return (TRUE); 109 } 110 111 int KapaSetGraph Style (int fd, Graphdata *graphmode) {105 data[0].xmin, data[0].xmax, 106 data[0].ymin, data[0].ymax); 107 KiiWaitAnswer (fd, "DONE"); 108 return (TRUE); 109 } 110 111 int KapaSetGraphData (int fd, Graphdata *data) { 112 112 113 113 /* tell kapa to look for the incoming image */ 114 114 KiiSendCommand (fd, 4, "SSTY"); 115 115 116 /* send Xgraphthe plot details */116 /* send kapa the plot details */ 117 117 KiiSendMessage (fd, "%8d %d %d %d %d %d %f %f", 118 graphmode[0].style,119 graphmode[0].ptype, graphmode[0].ltype,120 graphmode[0].etype, graphmode[0].ebar, graphmode[0].color,121 graphmode[0].lweight, graphmode[0].size);118 data[0].style, 119 data[0].ptype, data[0].ltype, 120 data[0].etype, data[0].ebar, data[0].color, 121 data[0].lweight, data[0].size); 122 122 KiiSendMessage (fd, "%g %g %g %g", 123 graphmode[0].xmin, graphmode[0].xmax,124 graphmode[0].ymin, graphmode[0].ymax);125 KiiWaitAnswer (fd, "DONE"); 126 return (TRUE); 127 } 128 129 int KapaGetGraph Style (int fd, Graphdata *graphmode) {123 data[0].xmin, data[0].xmax, 124 data[0].ymin, data[0].ymax); 125 KiiWaitAnswer (fd, "DONE"); 126 return (TRUE); 127 } 128 129 int KapaGetGraphData (int fd, Graphdata *data) { 130 130 131 131 /* tell kapa to look for the incoming image */ 132 132 KiiSendCommand (fd, 4, "GSTY"); 133 133 134 /* send Xgraphthe plot details */134 /* send kapa the plot details */ 135 135 KiiScanMessage (fd, "%d %d %d %d %d %d %lf %lf", 136 & graphmode[0].style,137 & graphmode[0].ptype, &graphmode[0].ltype,138 & graphmode[0].etype, &graphmode[0].ebar, &graphmode[0].color,139 & graphmode[0].lweight, &graphmode[0].size);136 &data[0].style, 137 &data[0].ptype, &data[0].ltype, 138 &data[0].etype, &data[0].ebar, &data[0].color, 139 &data[0].lweight, &data[0].size); 140 140 KiiScanMessage (fd, "%lf %lf %lf %lf", 141 &graphmode[0].xmin, &graphmode[0].xmax, 142 &graphmode[0].ymin, &graphmode[0].ymax); 141 &data[0].xmin, &data[0].xmax, 142 &data[0].ymin, &data[0].ymax); 143 KiiWaitAnswer (fd, "DONE"); 144 return (TRUE); 145 } 146 147 int KapaSetImageData (int fd, KapaImageData *data) { 148 149 /* tell kapa to look for the incoming image */ 150 KiiSendCommand (fd, 4, "SIMD"); 151 152 /* send kapa the plot details */ 153 KiiSendMessage (fd, "%g %g %s %s", 154 data[0].zero, data[0].range, data[0].name, data[0].file); 155 156 KiiWaitAnswer (fd, "DONE"); 157 return (TRUE); 158 } 159 160 int KapaGetImageData (int fd, KapaImageData *data) { 161 162 /* tell kapa to look for the incoming image */ 163 KiiSendCommand (fd, 4, "GIMD"); 164 165 KiiScanMessage (fd, "%lf %lf %s %s", 166 &data[0].zero, &data[0].range, data[0].name, data[0].file); 167 143 168 KiiWaitAnswer (fd, "DONE"); 144 169 return (TRUE); … … 203 228 } 204 229 205 int KapaSetLimits (int fd, Graphdata * graphmode) {230 int KapaSetLimits (int fd, Graphdata *data) { 206 231 207 232 KiiSendCommand (fd, 4, "SLIM"); 208 KiiSendMessage (fd, "%g %g %g %g ", graphmode[0].xmin, graphmode[0].xmax, graphmode[0].ymin, graphmode[0].ymax);233 KiiSendMessage (fd, "%g %g %g %g ", data[0].xmin, data[0].xmax, data[0].ymin, data[0].ymax); 209 234 KiiWaitAnswer (fd, "DONE"); 210 235 return (TRUE); -
branches/kapa-mods-2007-05/Ohana/src/libkapa/src/KiiPicture.c
r13409 r13434 1 1 # include <kapa_internal.h> 2 2 3 int KiiNewPicture1D (int fd, KiiImage *image, K iiDisplayMode *mode, Coords *coords) {3 int KiiNewPicture1D (int fd, KiiImage *image, KapaImageData *data, Coords *coords) { 4 4 5 5 int i; 6 6 int Npix, Ncolors, NNcolors, size; 7 7 float *in, min, max; 8 char *out, *outbuffer , *root, extra[1024];8 char *out, *outbuffer; 9 9 double a1, a2; 10 10 11 11 Npix = image[0].Nx*image[0].Ny; 12 12 13 KiiSendCommand (fd, 4, "READ"); /* tell Ximageto look for the incoming image */13 KiiSendCommand (fd, 4, "READ"); /* tell kapa to look for the incoming image */ 14 14 KiiScanMessage (fd, "%d", &Ncolors); 15 15 … … 22 22 /* define color table, */ 23 23 NNcolors = Ncolors - 1; 24 if ( mode[0].logflux) {25 mode[0].range = MAX (2, mode[0].range);26 a1 = Ncolors / log10 ( mode[0].range);27 a2 = mode[0].zero;24 if (data[0].logflux) { 25 data[0].range = MAX (2, data[0].range); 26 a1 = Ncolors / log10 (data[0].range); 27 a2 = data[0].zero; 28 28 for (i = 0; i < Npix; i++, in++, out++) { 29 29 *out = (char) MIN (a1 * log10 (MAX (*in - a2, 1.0)), NNcolors); 30 30 } 31 31 } else { 32 a1 = Ncolors / mode[0].range;33 a2 = Ncolors * mode[0].zero / mode[0].range;32 a1 = Ncolors / data[0].range; 33 a2 = Ncolors * data[0].zero / data[0].range; 34 34 for (i = 0; i < Npix; i++, in++, out++) { 35 35 *out = (char) MIN (MAX (a1 * *in - a2, 0), NNcolors); … … 41 41 size = Npix*sizeof(char); 42 42 43 /* done with the conversion, now send Ximagethe converted picture */43 /* done with the conversion, now send kapa the converted picture */ 44 44 KiiSendMessage (fd, "%8d %8d", image[0].Nx, image[0].Ny); 45 45 KiiSendMessage (fd, "8 1 0.0 1.0"); 46 KiiSendMessage (fd, "%f %f ", mode[0].zero, mode[0].range);46 KiiSendMessage (fd, "%f %f %s %s", data[0].zero, data[0].range, data[0].name, data[0].file); 47 47 KiiSendMessage (fd, "%f %f %d ", min, max, size); 48 48 KiiSendMessage (fd, "%f %f %g %g %g ", coords[0].crval1, coords[0].crpix1, coords[0].cdelt1, coords[0].pc1_1, coords[0].pc1_2); 49 49 KiiSendMessage (fd, "%f %f %g %g %g ", coords[0].crval2, coords[0].crpix2, coords[0].cdelt2, coords[0].pc2_1, coords[0].pc2_2); 50 51 /* send the filename */ 52 root = filerootname (image[0].file); 53 KiiSendMessage (fd, "%s %s %s ", coords[0].ctype, root, image[0].name); 54 free (root); 50 KiiSendMessage (fd, "%s", coords[0].ctype); 55 51 56 52 /* send the image data */ … … 62 58 } 63 59 64 int KiiNewPicture2D (int fd, KiiImage *image, K iiDisplayMode *mode, Coords *coords) {60 int KiiNewPicture2D (int fd, KiiImage *image, KapaImageData *data, Coords *coords) { 65 61 66 62 int i, j; 67 63 int Npix, Ncolors, NNcolors, size; 68 64 float *in, min, max; 69 char *out, *outbuffer, *root; 70 char buffer[1024]; 65 char *out, *outbuffer; 71 66 double a1, a2; 72 67 73 68 Npix = image[0].Nx*image[0].Ny; 74 69 75 KiiSendCommand (fd, 4, "READ"); /* tell Ximage to look for the incoming image */ 76 77 /* convert from (float *) to 1 byte chars -- depends on how many colors Kii owns */ 78 /* use this response as a handshake test */ 79 read (fd, buffer, 16); 80 sscanf (buffer, "%*s %d", &Ncolors); 70 KiiSendCommand (fd, 4, "READ"); /* tell kapa to look for the incoming image */ 71 KiiScanMessage (fd, "%d", &Ncolors); 81 72 82 73 ALLOCATE (outbuffer, char, Npix); … … 87 78 /* define color table, */ 88 79 NNcolors = Ncolors - 1; 89 if ( mode[0].logflux) {90 mode[0].range = MAX (2, mode[0].range);91 a1 = Ncolors / log10 ( mode[0].range);92 a2 = mode[0].zero;80 if (data[0].logflux) { 81 data[0].range = MAX (2, data[0].range); 82 a1 = Ncolors / log10 (data[0].range); 83 a2 = data[0].zero; 93 84 for (j = 0; j < image[0].Ny; j++) { 94 85 in = image[0].data2d[j]; … … 98 89 } 99 90 } else { 100 a1 = Ncolors / mode[0].range;101 a2 = Ncolors * mode[0].zero / mode[0].range;91 a1 = Ncolors / data[0].range; 92 a2 = Ncolors * data[0].zero / data[0].range; 102 93 for (j = 0; j < image[0].Ny; j++) { 103 94 in = image[0].data2d[j]; … … 112 103 size = Npix*sizeof(char); 113 104 114 /* done with the conversion, now send Ximage the converted picture */ 115 KiiSendMessage (fd, "%8d %8d 8 1 %f %f", image[0].Nx, image[0].Ny, 0.0, 1.0); 116 KiiSendMessage (fd, "%f %f %f %f %d ", mode[0].zero, mode[0].range, min, max, size); 105 /* done with the conversion, now send kapa the converted picture */ 106 KiiSendMessage (fd, "%8d %8d", image[0].Nx, image[0].Ny); 107 KiiSendMessage (fd, "8 1 0.0 1.0"); 108 KiiSendMessage (fd, "%f %f %s %s", data[0].zero, data[0].range, data[0].name, data[0].file); 109 KiiSendMessage (fd, "%f %f %d ", min, max, size); 117 110 KiiSendMessage (fd, "%f %f %g %g %g ", coords[0].crval1, coords[0].crpix1, coords[0].cdelt1, coords[0].pc1_1, coords[0].pc1_2); 118 111 KiiSendMessage (fd, "%f %f %g %g %g ", coords[0].crval2, coords[0].crpix2, coords[0].cdelt2, coords[0].pc2_1, coords[0].pc2_2); 119 120 /* send the filename */ 121 root = filerootname (image[0].file); 122 KiiSendMessage (fd, "%s %s %s ", coords[0].ctype, root, image[0].name); 112 KiiSendMessage (fd, "%s", coords[0].ctype); 123 113 124 114 /* send the image data */ -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.astro/gauss.c
r13391 r13434 9 9 char *name; 10 10 Buffer *buf; 11 KapaImageData data; 11 12 12 13 name = NULL; … … 16 17 remove_argument (N, &argc, argv); 17 18 } 18 if (!GetImage (&kapa, name)) return (FALSE);19 if (!GetImageData (&data, &kapa, name)) return (FALSE); 19 20 FREE (name); 20 21 … … 50 51 } 51 52 52 if ((buf = SelectBuffer ( GetImageName(), OLDBUFFER, TRUE)) == NULL) return (FALSE);53 if ((buf = SelectBuffer (data.name, OLDBUFFER, TRUE)) == NULL) return (FALSE); 53 54 54 55 KiiCursorOn (kapa); -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.astro/objload.c
r13391 r13434 17 17 remove_argument (N, &argc, argv); 18 18 } 19 if (!GetImage ( &kapa, name)) return (FALSE);19 if (!GetImage (NULL, &kapa, name)) return (FALSE); 20 20 FREE (name); 21 21 -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.astro/outline.c
r13391 r13434 151 151 KiiOverlay *overlay; 152 152 153 if (!GetImage ( &kapa, NULL)) return (FALSE);153 if (!GetImage (NULL, &kapa, NULL)) return (FALSE); 154 154 155 155 Noverlay = 0; -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.astro/outline2.c
r13391 r13434 309 309 KiiOverlay *overlay; 310 310 311 if (!GetImage ( &kapa, NULL)) return (FALSE);311 if (!GetImage (NULL, &kapa, NULL)) return (FALSE); 312 312 313 313 Noverlay = 0; -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/center.c
r13391 r13434 14 14 remove_argument (N, &argc, argv); 15 15 } 16 if (!GetImage ( &kapa, name)) return (FALSE);16 if (!GetImage (NULL, &kapa, name)) return (FALSE); 17 17 FREE (name); 18 18 -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/cursor.c
r13391 r13434 4 4 5 5 char string[20], key[20], *name; 6 int i, N, kapa , IsImage;6 int i, N, kapa; 7 7 double X, Y, R, D, Z; 8 8 void *oldsignal; … … 10 10 Buffer *buf; 11 11 12 /* need to be able to specify graph vs image coords 13 if ((N = get_argument (argc, argv, "-g"))) { 14 remove_argument (N, &argc, argv); 15 SetImageDevice (FALSE); 16 } 17 if ((N = get_argument (argc, argv, "-i"))) { 18 remove_argument (N, &argc, argv); 19 SetImageDevice (TRUE); 20 } 21 */ 12 // XXX need to be able to specify graph vs image coords 13 // currently, if only one exists, that frame will be used 14 // if both exist, defaults to ?? 15 // if ((N = get_argument (argc, argv, "-g"))) { 16 // if ((N = get_argument (argc, argv, "-i"))) { 22 17 23 18 name = NULL; … … 39 34 40 35 buf = NULL; 41 if (IsImage) buf = SelectBuffer (GetImageName(), OLDBUFFER, FALSE); 36 // if (IsImage) buf = SelectBuffer (GetImageName(), OLDBUFFER, FALSE); 37 // XXX this stuff will go away with 32bit image data 42 38 43 39 KiiCursorOn (kapa); … … 47 43 Z = -1.0; 48 44 for (i = 0; ((i < N) || (N == 0)) && !interrupt; i++) { 45 46 // XXX have kapa return x,y,z,ra,dec for all options 49 47 KiiCursorRead (kapa, &X, &Y, key); 50 48 … … 55 53 set_str_variable ("KEY", key); 56 54 57 if (IsImage) { 58 if (buf != NULL) { 59 Z = gfits_get_matrix_value (&buf[0].matrix, (int) X, (int) Y); 60 } 61 gprint (GP_LOG, "%s %f %f %f\n", key, X, Y, Z); 55 if (buf != NULL) { 56 Z = gfits_get_matrix_value (&buf[0].matrix, (int) X, (int) Y); 57 // gprint (GP_LOG, "%s %f %f %f\n", key, X, Y, Z); 62 58 } else { 63 59 XY_to_RD (&R, &D, X, Y, &graphmode.coords); -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/device.c
r13391 r13434 15 15 16 16 if (name == NULL) { 17 name = Get GraphName ();17 name = GetKapaName (); 18 18 if (name == NULL) { 19 19 gprint (GP_ERR, "no device defined\n"); -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/erase.c
r13391 r13434 13 13 remove_argument (N, &argc, argv); 14 14 } 15 if (!GetImage ( &kapa, name)) return (FALSE);15 if (!GetImage (NULL, &kapa, name)) return (FALSE); 16 16 FREE (name); 17 17 -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/jpeg.c
r13391 r13434 22 22 IsPNG = TRUE; 23 23 } 24 if (!strcmp (argv[0], "png")) IsPNG = TRUE; 25 if (!strcmp (argv[0], "ppm")) IsPPM = TRUE; 24 26 25 27 /* file name */ … … 38 40 remove_argument (N, &argc, argv); 39 41 } 40 /* need to figure out what this implies 42 43 /* XXX output png / jpeg needs to include both graph and image 44 if available. this is a poor mix of data representations 45 (png for image / jpeg for plots) 41 46 if ((N = get_argument (argc, argv, "-g"))) { 42 remove_argument (N, &argc, argv);43 SetImageDevice (FALSE);44 }45 47 if ((N = get_argument (argc, argv, "-i"))) { 46 remove_argument (N, &argc, argv);47 SetImageDevice (TRUE);48 }49 48 */ 50 49 51 50 if (!GetGraph (NULL, &kapa, name)) return (FALSE); 52 51 if (!IsPNG && !IsPPM) { 53 if (!filename[0]) strcpy (filename, "kapa. png");52 if (!filename[0]) strcpy (filename, "kapa.jpg"); 54 53 KiiJPEG (kapa, filename); 55 54 } -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/load.c
r13391 r13434 13 13 Buffer *buf; 14 14 KiiOverlay *overlay; 15 KapaImageData data; 15 16 16 17 name = NULL; … … 20 21 remove_argument (N, &argc, argv); 21 22 } 22 if (!GetImage (&kapa, name)) return (FALSE);23 if (!GetImageData (&data, &kapa, name)) return (FALSE); 23 24 FREE (name); 24 25 … … 46 47 47 48 if (ISCEL) { 48 if ((buf = SelectBuffer ( GetImageName(), OLDBUFFER, TRUE)) == NULL) return (FALSE);49 if ((buf = SelectBuffer (data.name, OLDBUFFER, TRUE)) == NULL) return (FALSE); 49 50 GetCoords (&coords, &buf[0].header); 50 51 } -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/point.c
r13391 r13434 11 11 Buffer *buf; 12 12 KiiOverlay overlay; 13 KapaImageData data; 13 14 14 15 name = NULL; … … 18 19 remove_argument (N, &argc, argv); 19 20 } 20 if (!GetImage (&kapa, name)) return (FALSE);21 if (!GetImageData (&data, &kapa, name)) return (FALSE); 21 22 FREE (name); 22 23 … … 39 40 40 41 if (celestial) { 41 if ((buf = SelectBuffer ( GetImageName(), OLDBUFFER, TRUE)) == NULL) return (FALSE);42 if ((buf = SelectBuffer (data.name, OLDBUFFER, TRUE)) == NULL) return (FALSE); 42 43 GetCoords (&coords, &buf[0].header); 43 44 } -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/ps.c
r13391 r13434 55 55 if (argc > 1) strcpy (filename, argv[1]); 56 56 57 if (!GetImage (&kapa, name)) return (FALSE); 57 // get the connection to kapa, false if none available 58 if (!GetGraphData (NULL, &kapa, name)) return (FALSE); 58 59 FREE (name); 59 60 -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/resize.c
r13391 r13434 15 15 remove_argument (N, &argc, argv); 16 16 } 17 if (!GetImage ( &kapa, name)) return (FALSE);17 if (!GetImage (NULL, &kapa, name)) return (FALSE); 18 18 FREE (name); 19 19 -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/save.c
r13391 r13434 13 13 remove_argument (N, &argc, argv); 14 14 } 15 if (!GetImage ( &kapa, name)) return (FALSE);15 if (!GetImage (NULL, &kapa, name)) return (FALSE); 16 16 FREE (name); 17 17 -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/style.c
r13432 r13434 4 4 5 5 int kapa; 6 Graphdata graphmode;6 Graphdata data; 7 7 8 if (!style_args (& graphmode, &argc, argv, &kapa)) return FALSE;8 if (!style_args (&data, &argc, argv, &kapa)) return FALSE; 9 9 10 10 if (argc > 1) { … … 12 12 return (FALSE); 13 13 } 14 KapaSetGraph Style (kapa, &graphmode);14 KapaSetGraphData (kapa, &data); 15 15 16 16 return (TRUE); -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/tv.c
r13391 r13434 4 4 5 5 int N, kapa; 6 char *name ;6 char *name, *file; 7 7 Coords coords; 8 8 Buffer *buf; 9 9 KiiImage image; 10 K iiDisplayMode mode;10 KapaImageData data; 11 11 12 12 name = NULL; … … 16 16 remove_argument (N, &argc, argv); 17 17 } 18 if (!GetImage (& kapa, name)) return (FALSE);18 if (!GetImage (&data, &kapa, name)) return (FALSE); 19 19 FREE (name); 20 20 … … 25 25 } 26 26 27 mode.logflux = FALSE;27 data.logflux = FALSE; 28 28 if ((N = get_argument (argc, argv, "-log"))) { 29 29 remove_argument (N, &argc, argv); 30 mode.logflux = TRUE;30 data.logflux = TRUE; 31 31 } 32 32 33 // use the currently-set zero,range values if not supplied 33 34 if ((argc != 2) && (argc != 4)) { 34 35 gprint (GP_ERR, "USAGE: tv <buffer> [zero range] [-n Nimage] [-log] [-kill]\n"); … … 36 37 } 37 38 38 GetImageScale (&mode.zero, &mode.range);39 39 if (argc == 4) { 40 mode.zero = atof (argv[2]); 41 mode.range = atof (argv[3]); 42 if (mode.range == 0.0) mode.range = 0.001; 43 SetImageScale (mode.zero, mode.range); 40 data.zero = atof (argv[2]); 41 data.range = atof (argv[3]); 42 if (data.range == 0.0) data.range = 0.001; 44 43 } 45 44 … … 50 49 image.Nx = buf[0].matrix.Naxis[0]; 51 50 image.Ny = buf[0].matrix.Naxis[1]; 52 image.file = buf[0].file;53 image.name = buf[0].name;54 51 55 KiiNewPicture1D (kapa, &image, &mode, &coords); 52 // send only the root of the file, not the full path 53 file = filerootname (buf[0].file); 54 strcpy (data.file, file); 55 free (file); 56 56 57 SetImageName (argv[1]); 57 strcpy (data.name, argv[1]); 58 59 KiiNewPicture1D (kapa, &image, &data, &coords); 60 58 61 set_str_variable ("TV", argv[1]); 59 62 return (TRUE); 60 63 } 61 62 63 /*64 projections and coordinates:65 66 IRAS:67 CTYPE1 = 'LL ' /TANGENT PLANE (L)68 CRVAL1 = 0.100000D+02 /R.A. OF MAP CENTER *** SEE COMMENT69 CDELT1 = -0.133333D-01 /SEPARATION IN L (DEG)70 CRPIX1 = 128 /MAPCENTER IN L71 CROTA1 = 0.000000E+00 /NO ROTATION72 73 CTYPE2 = 'MM ' /TANGENT PLANE (M)74 CRVAL2 = 0.410000D+02 /DEC. OF MAP CENTER *** SEE COMMENT75 CDELT2 = 0.133333D-01 /SEPARATION IN M (DEG)76 CRPIX2 = 128 /MAP CENTER IN M77 CROTA2 = 0.000000E+00 /NO ROTATION78 79 HIRAS:80 CTYPE1 = 'RA---TAN ' / PRIMARY AXIS NAME81 CRVAL1 = 1.000000000000E+01 / PRIMARY REFERENCE VALUE82 CDELT1 = -5.555555555556E-03 / PRIMARY PIXEL SEPARATION83 CRPIX1 = 2.560000000000E+02 / PRIMARY REFERENCE PIXEL84 CUNIT1 = 'DEGREE ' / PRIMARY AXIS UNITS85 86 CDELT2 = 5.555555555556E-03 / PRIMARY PIXEL SEPARATION87 CRPIX2 = 2.560000000000E+02 / PRIMARY REFERENCE PIXEL88 CRVAL2 = 4.100000000000E+01 / PRIMARY REFERENCE VALUE89 CTYPE2 = 'DEC--TAN ' / PRIMARY AXIS NAME90 CUNIT2 = 'DEGREE ' / PRIMARY AXIS UNITS91 92 PROJTYPE= 'GNOMON '93 COORDSYS= 'EQUATORIAL '94 95 gene (small FOV linear):96 RA_O97 RA_X98 RA_Y99 DEC_O100 DEC_X101 DEC_Y102 103 104 */105 106 # ifdef NEWTVMODE107 {108 double *pixvalues, slope;109 110 ALLOCATE (pixvalues, double, Ncolors + 1);111 range = fabs (range);112 for (i = 0; i < Ncolors + 1; i++) {113 if (ISLOG) {114 pixvalues[i] = i*range / NNcol + zero;115 }116 if (!ISLOG) {117 pixvalues[i] = pow (10.0, i*log10(range - 1.0) / NNcol) + zero - 1.0;118 }119 }120 for (j = 0; j < Npix; j++, in++, out++) {121 if (*in < pixvalues[0]) {122 i = 0;123 } else {124 if (*in > pixvalues[NNcol]) {125 i = NNcol;126 } else {127 for (i = 0; (*in < pixvalues[i]) || (*in > pixvalues[i+1]); ) {128 slope = 1.0 / (pixvalues[i+1] - pixvalues[i]);129 i = MIN (MAX (0, i + (*in - pixvalues[i]) * slope), NNcol);130 }131 }132 }133 /* for (i = 0; (i < Ncolors - 1) && (pixvalues[i] < *in); i++); */134 *out = i;135 }136 free (pixvalues);137 }138 # endif -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/tvcontour.c
r13391 r13434 69 69 remove_argument (N, &argc, argv); 70 70 } 71 if (!GetImage ( &kapa, name)) return (FALSE);71 if (!GetImage (NULL, &kapa, name)) return (FALSE); 72 72 FREE (name); 73 73 -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/tvgrid.c
r13391 r13434 22 22 remove_argument (N, &argc, argv); 23 23 } 24 if (!GetImage ( &kapa, name)) return (FALSE);24 if (!GetImage (NULL, &kapa, name)) return (FALSE); 25 25 FREE (name); 26 26 … … 146 146 } 147 147 148 # if (0)149 /* write the labels on the axes */150 dDEC = fabs(dec1 - dec0) / 100;151 for (ra = dRA * ((int)(MIN(ra0, ra1)/dRA) + 1); ra < MAX(ra0, ra1); ra += dRA) {152 RD_to_XY (&x0, &y0, ra + 0.1*dRA, MIN(dec0, dec1), &coords);153 sprintf (label, format, ra);154 sprintf (buffer, "%15s %20.10f %20.10f %20.10f %20.10f ", "TEXT", x0, y0, (double)(strlen(label) + 1), 0.0);155 write (kapa, buffer, 128);156 write (kapa, label, strlen(label) + 1);157 RD_to_XY (&x0, &y0, ra, MIN(dec0, dec1), &coords);158 for (dec = MIN(dec0, dec1) + dDEC; dec < MAX(dec0,dec1); dec += dDEC) {159 RD_to_XY (&x1, &y1, ra, dec, &coords);160 sprintf (buffer, "%15s %20.10f %20.10f %20.10f %20.10f ", "LINE", x0, y0, (x1 - x0), (y1 - y0));161 write (kapa, buffer, 128);162 x0 = x1;163 y0 = y1;164 }165 }166 # endif167 168 148 KiiLoadOverlay (kapa, overlay, Noverlay, argv[1]); 169 149 free (overlay); -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/vload.c
r13391 r13434 16 16 remove_argument (N, &argc, argv); 17 17 } 18 if (!GetImage ( &kapa, name)) return (FALSE);18 if (!GetImage (NULL, &kapa, name)) return (FALSE); 19 19 FREE (name); 20 20 -
branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/cmpload.c
r13391 r13434 22 22 remove_argument (N, &argc, argv); 23 23 } 24 if (!GetImage ( &kapa, name)) return (FALSE);24 if (!GetImage (NULL, &kapa, name)) return (FALSE); 25 25 FREE (name); 26 26 -
branches/kapa-mods-2007-05/Ohana/src/opihi/include/display.h
r13432 r13434 5 5 # define DISPLAY_H 6 6 7 /*** plotting functions ***/ 8 int GetCurrentDevice PROTO((void)); 7 /*** kapa graph functions ***/ 9 8 int PlotVectorPair PROTO((int kapa, int Npts, float *xValues, float *yValues, Graphdata *graphmode)); 10 9 int PlotVectorTriplet PROTO((int kapa, int Npts, float *xValues, float *yValues, float *zValues, Graphdata *graphmode)); 11 10 int GetGraphData PROTO((Graphdata *data, int *kapa, char *name)); 12 11 int GetGraph PROTO((Graphdata *data, int *kapa, char *name)); 13 void InitGraph PROTO((void)); 14 int open_graph PROTO((int N)); 15 int close_graph PROTO((int N)); 16 void QuitGraph PROTO((void)); 17 void SetGraph PROTO((Graphdata *data)); 18 void XGraphDead PROTO((int input)); 19 int GetColor PROTO((char *name)); 12 int SetGraph PROTO((Graphdata *data)); 20 13 21 /* image (tv) functions */ 22 int GetImage PROTO((int *kapa, char *name)); 23 char *GetImageName PROTO((void)); 24 void GetImageScale PROTO((double *zero, double *range)); 25 void InitImage PROTO((void)); 26 int open_image PROTO((int N)); 27 int close_image PROTO((int N)); 28 void QuitImage PROTO((void)); 29 void SetImageDevice PROTO((int state)); 30 void SetImageName PROTO((char *name)); 31 void SetImageScale PROTO((double zero, double range)); 32 void XImageDead PROTO((int input)); 33 int SelectOverlay PROTO((char *name, int *number)); 14 /*** kapa image functions */ 15 int GetImageData PROTO((KapaImageData *data, int *kapa, char *name)); 16 int GetImage PROTO((KapaImageData *data, int *kapa, char *name)); 17 int SetImage PROTO((KapaImageData *data)); 34 18 35 void QuitKapa ();36 void InitKapa ();37 int open_kapa (int entry);38 int close_kapa (char *name);39 int AddKapaDevice (char *name);40 int DelKapaDevice (char *name);41 int FindKapaDevice (char *name);42 char *GetGraphName ();19 void QuitKapa PROTO(()); 20 void InitKapa PROTO(()); 21 int open_kapa PROTO((int entry)); 22 int close_kapa PROTO((char *name)); 23 int AddKapaDevice PROTO((char *name)); 24 int DelKapaDevice PROTO((char *name)); 25 int FindKapaDevice PROTO((char *name)); 26 char *GetKapaName PROTO(()); 43 27 44 28 /* calling program need to define a function 'get_variable' which -
branches/kapa-mods-2007-05/Ohana/src/opihi/lib.data/open_kapa.c
r13433 r13434 22 22 ALLOCATE (Device, char *, 1); // for future REALLOCATE calls 23 23 ALLOCATE (Socket, int, 1); // for future REALLOCATE calls 24 25 InitGraph ();26 InitImage ();27 24 } 28 25 … … 117 114 } 118 115 119 /**************** graph ops */ 120 121 # if (0) 122 // XXX for now, use a local variable. later: get from kapa 123 static Graphdata graphdata; 124 125 void InitGraph () { 126 graphdata.xmin = graphdata.ymin = 0.0; 127 graphdata.xmax = graphdata.ymax = 1.0; 128 graphdata.style = graphdata.ptype = 0; 129 graphdata.ltype = graphdata.color = 0; 130 graphdata.etype = graphdata.ebar = 0; 131 graphdata.lweight = graphdata.size = 1.0; 132 133 graphdata.coords.pc1_1 = graphdata.coords.pc2_2 = 1.0; 134 graphdata.coords.pc1_2 = graphdata.coords.pc2_1 = 0.0; 135 strcpy (graphdata.coords.ctype, "RA---LIN"); 136 graphdata.coords.crval1 = 0.0; 137 graphdata.coords.crval2 = 0.0; 138 graphdata.coords.crpix1 = 0.0; 139 graphdata.coords.crpix2 = 0.0; 140 graphdata.coords.cdelt1 = graphdata.coords.cdelt2 = 1.0; 141 graphdata.flipeast = TRUE; 142 graphdata.flipnorth = FALSE; 143 strcpy (graphdata.axis, "2222"); 144 strcpy (graphdata.ticks, "2222"); 145 strcpy (graphdata.labels, "2222"); 146 } 147 148 /* test Xgraph[0], flush junk from pipe */ 149 signal (SIGPIPE, XGraphDead); 150 fcntl (Socket[n], F_SETFL, O_NONBLOCK); 151 for (i = 0; (read (Socket[n], buffer, 64) > 0) && (i < 20); i++); 152 fcntl (Socket[n], F_SETFL, !O_NONBLOCK); 153 # endif 116 /**************** graph specific ops *******************/ 154 117 155 118 // return the current device name, if set 156 char *Get GraphName () {119 char *GetKapaName () { 157 120 if (Active < 0) return NULL; 158 121 return Device[Active]; … … 166 129 int entry; 167 130 168 SetImageDevice (FALSE);169 131 if (name == NULL) { 170 132 if (Active < 0) { … … 181 143 } 182 144 183 if (data != NULL) KapaGetGraph Style(Socket[Active], data);145 if (data != NULL) KapaGetGraphData (Socket[Active], data); 184 146 if (fd != NULL) *fd = Socket[Active]; 185 147 … … 187 149 } 188 150 189 /* return pointers for given Xgraph, don't set or open */151 /* return pointers for given kapa, don't set or open */ 190 152 int GetGraphData (Graphdata *data, int *fd, char *name) { 191 153 … … 207 169 208 170 if (fd != NULL) *fd = Socket[entry]; 209 if (data != NULL) KapaGetGraph Style(Socket[entry], data);210 return (TRUE); 211 } 212 213 /* assign given values to current Xgraph*/214 voidSetGraph (Graphdata *data) {171 if (data != NULL) KapaGetGraphData (Socket[entry], data); 172 return (TRUE); 173 } 174 175 /* assign given values to current kapa */ 176 int SetGraph (Graphdata *data) { 215 177 if (Active < 0) { 216 178 gprint (GP_ERR, "no active kapa window\n"); … … 221 183 return (FALSE); 222 184 } 223 KapaSetGraphStyle (Socket[Active], data); 224 } 225 226 /** internal tracking of current active device type **/ 227 /* drop this stuff */ 228 static int IsImage = FALSE; 229 230 int GetCurrentDevice () { 231 return (IsImage); 232 } 233 234 void SetImageDevice (int state) { 235 IsImage = state; 185 KapaSetGraphData (Socket[Active], data); 236 186 } 237 187 238 188 /************* image ops ***********/ 239 // XXX for now, use local static:240 241 static char Ximbuffer[512];242 static double Xzero;243 static double Xrange;244 245 void InitImage () {246 Xzero = 0;247 Xrange = 1024;248 strcpy (Ximbuffer, "none");249 }250 189 251 190 /* return pointers for current Ximage, set if desired, test, open if needed */ 252 int GetImage (int *fd, char *name) { 253 int status; 254 status = GetGraph (NULL, fd, name); 255 return (status); 256 } 257 258 void SetImageName (char *name) { 259 strcpy (Ximbuffer, name); 260 } 261 262 char *GetImageName () { 263 return (Ximbuffer); 264 } 265 266 // leave this information on kapa, request when needed? 267 void SetImageScale (double zero, double range) { 268 Xzero = zero; 269 Xrange = range; 270 } 271 void GetImageScale (double *zero, double *range) { 272 *zero = Xzero; 273 *range = Xrange; 191 int GetImage (KapaImageData *data, int *fd, char *name) { 192 193 int entry; 194 195 if (name == NULL) { 196 if (Active < 0) { 197 entry = AddKapaDevice ("0"); 198 } else { 199 entry = Active; 200 } 201 } else { 202 entry = AddKapaDevice (name); 203 } 204 205 if (!open_kapa (entry)) { 206 return (FALSE); 207 } 208 209 if (data != NULL) KapaGetImageData (Socket[Active], data); 210 if (fd != NULL) *fd = Socket[Active]; 211 212 return (TRUE); 213 } 214 215 /* return pointers for given kapa, don't set or open */ 216 int GetImageData (KapaImageData *data, int *fd, char *name) { 217 218 int entry; 219 220 if (name == NULL) { 221 if (Active < 0) { 222 gprint (GP_ERR, "no active kapa window\n"); 223 return (FALSE); 224 } 225 entry = Active; 226 } else { 227 entry = FindKapaDevice (name); 228 if (entry < 0) { 229 gprint (GP_ERR, "invalid kapa window %s\n", name); 230 return (FALSE); 231 } 232 } 233 234 if (fd != NULL) *fd = Socket[entry]; 235 if (data != NULL) KapaGetImageData (Socket[entry], data); 236 return (TRUE); 237 } 238 239 /* assign given values to current kapa */ 240 int SetImage (KapaImageData *data) { 241 if (Active < 0) { 242 gprint (GP_ERR, "no active kapa window\n"); 243 return (FALSE); 244 } 245 if (Socket[Active] == -1) { 246 gprint (GP_ERR, "no active kapa window\n"); 247 return (FALSE); 248 } 249 KapaSetImageData (Socket[Active], data); 274 250 } 275 251 -
branches/kapa-mods-2007-05/Ohana/src/opihi/lib.shell/BufferOps.c
r9275 r13434 195 195 } 196 196 197 int SelectOverlay (char *name, int *number) {198 199 *number = -1;200 if (!strcmp (name, "red") || !strcmp (name, "0"))201 *number = 0;202 if (!strcmp (name, "green") || !strcmp (name, "1"))203 *number = 1;204 if (!strcmp (name, "blue") || !strcmp (name, "2"))205 *number = 2;206 if (!strcmp (name, "yellow") || !strcmp (name, "3"))207 *number = 3;208 209 if (*number < 0) {210 gprint (GP_ERR, "valid overlays may be: red (0), green (1), blue (2), yellow (3)\n");211 return (FALSE);212 }213 else {214 return (TRUE);215 }216 }217 218 197 void dump_buffers (int n) { 219 198
Note:
See TracChangeset
for help on using the changeset viewer.
