1
/*===========================================================================
2
Copyright (C) 1995-2009 European Southern Observatory (ESO)
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License as
6
published by the Free Software Foundation; either version 2 of
7
the License, or (at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public
15
License along with this program; if not, write to the Free
16
Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
19
Correspondence concerning ESO-MIDAS should be addressed as follows:
20
Internet e-mail: midas@eso.org
21
Postal address: European Southern Observatory
22
Data Management Division
23
Karl-Schwarzschild-Strasse 2
24
D 85748 Garching bei Muenchen
26
===========================================================================*/
28
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
30
.AUTHOR Richard van Hees ESO - Garching
31
.IDENTIFICATION Module f2cdsp.fc
32
.PURPUSE fortran to C interfaces for low level display routines
33
.VERSION [1.00] 940327
36
---------------------------------------------------------*/
38
#include <midas_def.h>
61
/*** colo = tstcolor(cbuf) ***/
67
ptr1 = strp_pntr(1); /* get stripped string of "cbuf" */
69
*colo = tstcolor(ptr1);
73
/*** Alptxec(cbuf,xp,yp,colo) ***/
75
ROUTINE DAZ2(xp,yp,colo)
81
ptr1 = strp_pntr(1); /* get stripped string of "cbuf" */
83
Alptxec(ptr1,*xp,*yp,*colo);
88
/*** Alptext(cbuf,na,nb,colo) ***/
90
ROUTINE DAZ3(na,nb,colo)
96
ptr1 = strp_pntr(1); /* get stripped string of "cbuf" */
98
Alptext(99,ptr1,*na,*nb,*colo);
110
ROUTINE AUXWND(flag,info,xya,xyb,stat)
118
*stat = Cauxwnd(*flag,info,xya,xyb);
122
ROUTINE SCRPIX(imno,kwc,rval,kxy,scrpix,stat)
131
imno = image id (IN), kwc = 0/1 for rval = f.p./w.c. value
132
kxy = 1/2/3 for using x/y/(x+y)/2 screen distance
133
scrpix = screen pixel value corresponding to rval
137
*stat = GetScrPix(*imno,*kwc,*rval,*kxy,scrpix);
141
/*** buildgra(shape,coords,arcs,xfig,yfig,figmax,nop) ***/
143
ROUTINE DAZ4(coords,arcs,xfig,yfig,figmax,nop)
152
ptr1 = strp_pntr(1); /* get stripped string of "shape" */
154
buildgra(ptr1,coords,arcs,xfig,yfig,*figmax,nop);
158
ROUTINE CONCHA(dsplay,chan,grflag,value)
165
CONCHA_C(*dsplay,*chan,*grflag,*value);
170
/***Ccursin(dsplay,iact,nocurs,xya,mca,isca,xyb,mcb,iscb) ***/
172
ROUTINE CURSIN(dsplay,iact,nocurs,xya,mca,isca,xyb,mcb,iscb)
184
int unit, ik[4], kxya[5], kxyb[5];
187
for (nr=0; nr<5; nr++)
193
Ccursin( *dsplay, *iact, *nocurs, kxya, isca, kxyb, iscb );
203
if ((*isca != 0) || (*iscb != 0))
210
(void) SCKWRI("CURSOR",ik,1,4,&unit); /* save screen coords. */
216
ROUTINE DAZVIS( dsplay, chanl, flag, vis )
223
(void) Cdazvis( *dsplay,* chanl, *flag, *vis );
227
ROUTINE DAZSCR( dsplay, chanl, scrx, scry, stat )
235
*stat = Cdazscr(*dsplay,*chanl,scrx,scry);
239
ROUTINE DAZZSC( dsplay, chanl, zoom, scrx, scry, stat )
248
*stat = Cdazzsc( *dsplay, *chanl, *zoom, scrx, scry );
253
/*** GETCUR(action,frame,icur1,fp1,wc1,val1,stat1,icur2,fp2,wc2,val2,stat2) ***/
255
ROUTINE DAZ5(icur1,fp1,wc1,val1,stat1,icur2,fp2,wc2,val2,stat2)
257
/* action = char string with action code (input)
258
frame = char string to hold displayed image name (in/output)
259
for details see description in getcur.c */
261
int *icur1; /* screen cursor coords (OUT)*/
262
float *fp1; /* = f.p. at cursor pos. (OUT) */
263
float *wc1; /* = w.c. at cursor pos. (OUT)*/
264
float *val1; /* = value a.c.p. (OUT) */
265
int *stat1; /* = status of cursor (which keys pressed)*/
274
float xya[7], xyb[7];
275
char *work, myframe[80];
278
ptr1 = strp_pntr(1); /* get stripped string of "action" */
279
ptr2 = loc_pntr(1,&mm); /* get location of "frame" and its length */
281
kk = 80; /* for GetCursor max 80 char. string */
291
{ /* we expect a char string with ' ' in the end */
293
for (n=0; n<(kk-1); n++) /* at most 79 chars */
300
myframe[n] = *work++;
303
myframe[79] = '\0'; /* last element of myframe */
307
GetCursor(ptr1,myframe,xya,stat1,xyb,stat2);
311
icur1[0] = (int) (xya[0]+0.5); icur1[1] = (int) (xya[1]+0.5);
312
fp1[0] = xya[2]; fp1[1] = xya[3];
313
wc1[0] = xya[4]; wc1[1] = xya[5];
315
icur2[0] = (int) (xyb[0]+0.5); icur2[1] = (int) (xyb[1]+0.5);
316
fp2[0] = xyb[2]; fp2[1] = xyb[3];
317
wc2[0] = xyb[4]; wc2[1] = xyb[5];
321
n = (int) strlen(myframe);
324
if (n < mm) /* string + ' ' as endmarker fit */
326
(void) strcpy(ptr2,myframe);
330
{ /* no space for end marker... */
331
(void) strncpy(ptr2,myframe,(size_t)mm);
340
/*** GETSTR( outstr, dim ) ***/
349
ptr1 = loc_pntr(1,&mm); /* get location of "outstr" */
353
n = (int) strlen(ptr1);
354
if ((n > 0) && (n < mm)) *(ptr1+n) = ' ';
359
ROUTINE HSIRGB( flag, hsi, rgb )
365
HSIRGB_C(*flag,hsi,rgb);
369
ROUTINE JOYSTK( dsplay, iact, nocurs, jxdis, jydis, stat )
378
*stat = JOYSTK_C( *dsplay, *iact, *nocurs, jxdis, jydis );
382
ROUTINE LOADWN( flags, imno, npix, stapix, kpix, wsta, cuts )
392
LOADWN_C( flags, *imno, npix, stapix, kpix, wsta, cuts );
396
ROUTINE MAKITT(icount,ritt,ocount,oitt)
403
MakeITT(*icount,ritt,*ocount,oitt);
407
static void mak1(ic,mlut,qlut)
412
register int jin, jout, jouta, joutb;
416
joutb = jouta + jouta;
418
for (jin=0; jout<ic; jin+=3)
420
mlut[jout++] = qlut[jin];
421
mlut[jouta++] = qlut[jin+1];
422
mlut[joutb++] = qlut[jin+2];
426
static void mak2(oc,mlut,qlut)
431
register int jin, jout, jouta, joutb;
435
joutb = jouta + jouta;
436
for (jin=0; jout<oc; jin+=3)
438
qlut[jin] = mlut[jout++];
439
qlut[jin+1] = mlut[jouta++];
440
qlut[jin+2] = mlut[joutb++];
444
ROUTINE MAKLUT( flag, icount, rlut, ocount, olut )
445
int *flag; /* IN: 1= send to device, 2= get from device */
452
float mylut[3*LUTSIZE];
456
r1 g1 b1 r2 g2 b2 ... rN gN bN => r1 ... rN g1 ... gN b1 ... bN
461
mak1(*icount,mylut,rlut);
462
MakeLUT(*icount,mylut,*ocount,olut);
466
r1 ... rN g1 ... gN b1 ... bN => r1 g1 b1 r2 g2 b2 ... rN gN bN
471
MakeLUT(*icount,rlut,*ocount,mylut);
472
mak2(*ocount,mylut,olut);
485
ROUTINE DAZ8(dsplay,chan,nitt,ista,count,ritt,idst)
495
int mysta = *ista - 1; /* 1,... -> 0,... */
497
*idst = IILRIT_C(*dsplay,*chan,*nitt,mysta,*count,ritt);
502
ROUTINE RDLUT(dsplay,nlut,ista,count,rlut,idst)
511
int mysta = *ista - 1; /* 1,... -> 0,... */
513
*idst = IILRLT_C(*dsplay,*nlut,mysta,*count,rlut);
526
ROUTINE SPLCNT( splcx, splcy )
531
SPLCNT_C( splcx, splcy );
535
ROUTINE SETCUR( dsplay, cursno, forma, colo, coords, stat )
545
SETCUR_C( *dsplay, *cursno, *forma, *colo, coords );
549
static int pxx(flag,cb,rbuff,dbuf,tbuf)
559
if ((cb[0] == 'I') && (cb[1] == 'N')) /* action = INIT */
566
tbuf[0] = rbuff[2]; /* for security - maybe not needed... */
582
/* OJO: this routine works only for 1dim or 2dim frames */
583
/*** PIXXCV (cflag,imno,rbuff,stat) ***/
585
ROUTINE DAZ9(imno,rbuff,stat)
590
/* cflag = "WRS", ... like explained in pixcnv.c (IN), imno = image id (IN)
591
rbuff = 6 elem buffer, rbuff[0,1] "are" dd1 in Pixconv() (IN)
592
rbuff[2,3] are dd2 (OUT) , rbuff[4,5] are dd3 (OUT) */
596
double dbuf1[MAXDIM], dbuf2[MAXDIM], dbuf3[MAXDIM];
598
ptr1 = strp_pntr(1); /* get stripped string of "cflag" */
600
ipxx = pxx(1,ptr1,rbuff,dbuf1,dbuf2);
603
*stat = Pixconv("INIT",*imno,dbuf1,dbuf2,dbuf3);
604
if (*stat == -1) *stat = 0; /* FORTRAN wants 0 */
608
*stat = Pixconv(ptr1,0,dbuf1,dbuf2,dbuf3);
610
(void) pxx(2,"RES",rbuff,dbuf2,dbuf3); /* store results */
615
ROUTINE WALPHB(chan,flag)
626
ROUTINE DAZ7(dsplay,chan,nitt,ista,count,ritt,idst)
636
int mysta = *ista - 1; /* 1,... -> 0,... */
638
*idst = IILWIT_C(*dsplay,*chan,*nitt,mysta,*count,ritt);
642
ROUTINE WRLUT(dsplay,nlut,ista,count,rlut,idst)
651
int mysta = *ista - 1; /* 1,... -> 0,... */
653
*idst = IILWLT_C(*dsplay,*nlut,mysta,*count,rlut);
657
ROUTINE K1PACK(rbuf,ibuf,aux,faux,ldata,outaux)
658
float *rbuf; /* IN: float image data */
659
int *ibuf; /* IN: int image data */
660
int *aux; /* IN: auxiliary info array:
661
data type flag (1-R4,2-I4)
665
scaling_flag, = 0 (no), = 1 (yes scale) */
666
float *faux; /* IN: auxiliary real info array:
667
factor to map into [0,outmax]
668
artificial minimum and maximum of image data */
669
unsigned char *ldata; /* OUT: scaled line with pixel in byte */
670
int *outaux; /* IN: max. output value (<= 255)
671
offset in pixel array */
678
cpntr = (char *) ibuf;
680
cpntr = (char *) rbuf;
682
K1PACK_C(cpntr,aux,faux,ldata,outaux);