Debian Codegraph @

libsrc/idi/cidi/x11/iig.c

raw
1 /* @(#)iig.c 19.1 (ESO-DMD) 02/25/03 13:54:48 */
2 /*===========================================================================
3 Copyright (C) 1995 European Southern Observatory (ESO)
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of
8 the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public
16 License along with this program; if not, write to the Free
17 Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
18 MA 02139, USA.
19
20 Correspondence concerning ESO-MIDAS should be addressed as follows:
21 Internet e-mail: [email protected]
22 Postal address: European Southern Observatory
23 Data Management Division
24 Karl-Schwarzschild-Strasse 2
25 D 85748 Garching bei Muenchen
26 GERMANY
27 ===========================================================================*/
28
29
30
31 /* ----------------------------------------------------------------- */
32 /* --------- IIG -------------------------------------------------- */
33 /* ----------------------------------------------------------------- */
34
35 /*
36 ***********************************************************************
37 * IIGPLY_C: Polyline *
38 * IIGTXT_C: Plot Text *
39 * IIGCPY_C: Copy graphics + text
40 * *
41 * V 1.1 871201: P. Santin - Trieste Astronomical Observatory *
42 * V 2.0 881223: K. Banse - ESO Garching *
43
44 010514 last modif
45
46 ***********************************************************************
47 */
48
49
50 # include <idi.h>
51 # include <idistruct.h>
52 # include <proto_idi.h>
53
54 static int i, dysiz;
55
56 static CONF_DATA *conf;
57 static MEM_DATA *mem, *dmem;
58
59 /*
60
61 */
62
63 /************************************************************************
64 * IIGPLY_C routine : polyline *
65 * *
66 * synopsis IIGPLY_C (display , memid , x , y , np , color , style) *
67 * *
68 * int display; input display identifier *
69 * int memid; input memory identifier *
70 * int x[]; input X position list *
71 * int y[]; input Y position list *
72 * int np; input number of points *
73 * int color; input pixel color value *
74 * int style input line style *
75 ************************************************************************/
76
77 int IIGPLY_C (display,memid,x,y,np,color,style)
78
79 int display, memid, np, color, style;
80 int *x, *y;
81
82 {
83
84 if (ididev[display].opened == 0) return(DEVNOTOP);
85
86 conf = ididev[display].confptr;
87 if (conf->RGBmode == 1)
88 {
89 if (memid == 3)
90 memid = conf->overlay;
91 else
92 memid = 0;
93 }
94 else
95 {
96 if ((memid < 0) || (memid >= conf->nmem)) return(ILLMEMID);
97 }
98
99 mem = conf->memory[memid];
100 if (mem->mmbm == (char *) 0) /* allocate memory if necessary */
101 i = allo_mem(display,mem,memid);
102
103 dysiz = ididev[display].ysize - 1;
104
105 /* erase old polylines */
106
107 if (color <= 0)
108 {
109 if (memid != conf->overlay) /* if not overlay, display chan again */
110 allrefr (display,mem,memid,1);
111
112 else
113 {
114 for (i=0; i<conf->nmem; i++)
115 {
116 if (i != memid)
117 {
118 dmem = conf->memory[i];
119 if (dmem->visibility == 1)
120 {
121 allrefr(display,dmem,i,1);
122 goto clear_poly;
123 }
124 }
125 }
126 }
127
128 clear_poly:
129 polyclear(display,mem,x,y,np);
130 }
131
132
133 /* or draw new polyline */
134
135 else
136 polyline(display,dysiz,mem,color,style,x,y,np);
137
138 return(II_SUCCESS);
139 }
140 /*
141
142 */
143
144 /************************************************************************
145 * IIGTXT_C routine : plot text *
146 * *
147 * synopsis IIGTXT_C (display , memid , txt , x0 , y0 , path , orient ,*
148 * color , txtsize); *
149 * *
150 * int display; input display identifier *
151 * int memid; input memory identifier *
152 * char txt[]; input text string *
153 * int x0; input X position *
154 * int y0; input Y position *
155 * int path; input text path *
156 * int orient; input text orientation *
157 * int color; input pixel color value *
158 * int txtsize; input text size *
159 ************************************************************************/
160
161 int IIGTXT_C (display , memid , txt , x0 , y0 , path , orient , color ,
162 txtsize)
163
164 int display , memid , x0 , y0 , path , orient , color , txtsize;
165 char txt[];
166
167 {
168 int np;
169 ALPH_DATA *alph;
170
171
172 if (ididev[display].opened == 0) return(DEVNOTOP);
173
174 dysiz = ididev[display].ysize - 1;
175 np = (int) strlen(txt);
176 conf = ididev[display].confptr;
177
178
179 /* look, if we want the alpha memory ... */
180
181 if (memid >= 90)
182 {
183 if (ididev[display].alpno < 90)
184 return (NOALPHA);
185 else
186 {
187 if (memid == 99)
188 alph = conf->alpmem[conf->memid]; /* use current alpha data */
189 else
190 {
191 memid -= 100;
192 if (conf->RGBmode == 1)
193 {
194 if (memid == 3)
195 memid = conf->overlay;
196 else
197 memid = 0;
198 }
199 else
200 {
201 if ((memid < 0) || (memid >= conf->nmem)) return(ILLMEMID);
202 }
203 alph = conf->alpmem[memid]; /* use alpha data of that memory */
204 }
205
206 alptext(0,display,alph,txt,x0,y0); /* only store the data */
207 return(II_SUCCESS);
208 }
209 }
210
211 if (conf->RGBmode == 1)
212 {
213 if (memid == 3)
214 memid = conf->overlay;
215 else
216 memid = 0;
217 }
218 else
219 {
220 if ((memid < 0) || (memid >= conf->nmem)) return(ILLMEMID);
221 }
222 mem = conf->memory[memid];
223
224 if (mem->mmbm == (char *) 0) /* allocate memory if necessary */
225 i = allo_mem(display,mem,memid);
226
227 /* erase old text */
228
229 if (color <= 0)
230 {
231 if (memid != conf->overlay) /* if not overlay, display chan again */
232 allrefr (display,mem,memid,1);
233 else
234 {
235 for (i=0; i<conf->nmem; i++)
236 {
237 if (i != memid)
238 {
239 dmem = conf->memory[i];
240 if (dmem->visibility == 1)
241 {
242 allrefr(display,dmem,i,1);
243 goto clear_text;
244 }
245 }
246 }
247 }
248
249 clear_text:
250 txtclear(display,mem,x0,y0,np);
251 }
252
253
254 /* or draw new text */
255
256 else
257 txtline(display,dysiz,mem,txt,x0,y0,path,orient,color,txtsize);
258
259 return(II_SUCCESS);
260 }
261
262 /*
263
264 */
265
266 /************************************************************************
267 * IIGCPY_C routine : Copy graphics + text
268 * *
269 * synopsis IIGCPY_C (display,memid)
270 * *
271 * int display; input display identifier *
272 * int memid; input memory identifier *
273 * int append; input append flag (1 = yes)
274 ************************************************************************/
275
276 int IIGCPY_C (display,memid,append)
277 int display, memid, append;
278
279 {
280 if (ididev[display].opened == 0) return(DEVNOTOP);
281
282 conf = ididev[display].confptr;
283 if (conf->RGBmode == 1)
284 {
285 if (memid == 3)
286 memid = conf->overlay;
287 else
288 memid = 0;
289 }
290 else
291 {
292 if ((memid < 0) || (memid >= conf->nmem)) return(ILLMEMID);
293 }
294
295 copy_over(display,memid,append);
296
297 return(II_SUCCESS);
298 }