| 1 |
/*=========================================================================== |
| 2 |
Copyright (C) 1995-2009 European Southern Observatory (ESO) |
| 3 |
|
| 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. |
| 8 |
|
| 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. |
| 13 |
|
| 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, |
| 17 |
MA 02139, USA. |
| 18 |
|
| 19 |
Correspondence concerning ESO-MIDAS should be addressed as follows: |
| 20 |
Internet e-mail: [email protected] |
| 21 |
Postal address: European Southern Observatory |
| 22 |
Data Management Division |
| 23 |
Karl-Schwarzschild-Strasse 2 |
| 24 |
D 85748 Garching bei Muenchen |
| 25 |
GERMANY |
| 26 |
===========================================================================*/ |
| 27 |
|
| 28 |
/* ----------------------------------------------------------------- */ |
| 29 |
/* --------- IIM -------------------------------------------------- */ |
| 30 |
/* ----------------------------------------------------------------- */ |
| 31 |
|
| 32 |
/* |
| 33 |
*********************************************************************** |
| 34 |
* |
| 35 |
* IIMSTW_C: Set Transfer Window; |
| 36 |
* IIMWMY_C: Image Memory Write; |
| 37 |
* IIMRMY_C: Image Memory Read; |
| 38 |
* IIMSMV_C: Set Memory Visibility; |
| 39 |
* IIMCMY_C: Clear memory; |
| 40 |
* IIMSLT_C: Select Video Lookup Table; |
| 41 |
* IIMBLM_C: Blink Memories; |
| 42 |
* IIMCPY_C: Copy memory; |
| 43 |
* IIMCPV_C: Copy memory + make it visible; |
| 44 |
* |
| 45 |
* V 1.1 871201: P. Santin - Trieste Astronomical Observatory * |
| 46 |
* V 2.0 881221: K. Banse - ESO Garching * |
| 47 |
|
| 48 |
090120 last modif |
| 49 |
|
| 50 |
*********************************************************************** |
| 51 |
*/ |
| 52 |
|
| 53 |
# include <idi.h> |
| 54 |
# include <idistruct.h> |
| 55 |
# include <proto_idi.h> |
| 56 |
|
| 57 |
# include <stdio.h> |
| 58 |
|
| 59 |
|
| 60 |
extern int OSY_SLEEP(); |
| 61 |
|
| 62 |
static CONF_DATA *conf; |
| 63 |
static MEM_DATA *mem, *dmem; |
| 64 |
|
| 65 |
/* |
| 66 |
|
| 67 |
*/ |
| 68 |
|
| 69 |
/************************************************************************ |
| 70 |
* IIMSTW_C routine : set image memory transfer window * |
| 71 |
* * |
| 72 |
* synopsis IIMSTW_C (display , memid , loaddir , xwdim , ywdim , * |
| 73 |
* depth , xwoff , ywoff); * |
| 74 |
* * |
| 75 |
* int display; input display identifier * |
| 76 |
* int memid; input memory identifier * |
| 77 |
* int loaddir; input load direction * |
| 78 |
not updated, if = -99 |
| 79 |
* int xwdim; input X memory size * |
| 80 |
* int ywdim; input Y memory size * |
| 81 |
* int depth; input data depth (bits/pixel) * |
| 82 |
not updated currently |
| 83 |
* int xwoff; input X memory offset * |
| 84 |
* int ywoff; input Y memory offset * |
| 85 |
************************************************************************/ |
| 86 |
|
| 87 |
int IIMSTW_C (display, memid, loaddir, xwdim, ywdim, depth, xwoff, |
| 88 |
ywoff) |
| 89 |
|
| 90 |
int display , memid , loaddir , xwdim , ywdim , depth , xwoff , ywoff; |
| 91 |
|
| 92 |
{ |
| 93 |
|
| 94 |
if (ididev[display].opened == 0) return(DEVNOTOP); |
| 95 |
|
| 96 |
conf = ididev [display].confptr; |
| 97 |
if (conf->RGBmode == 1) |
| 98 |
{ |
| 99 |
if (memid == 3) |
| 100 |
memid = conf->overlay; |
| 101 |
else |
| 102 |
memid = 0; /* single memory for 3 channels */ |
| 103 |
} |
| 104 |
else |
| 105 |
{ |
| 106 |
if ((memid < 0) || (memid >= conf->nmem)) return(ILLMEMID); |
| 107 |
} |
| 108 |
|
| 109 |
/* check for transfer window size against memory size */ |
| 110 |
|
| 111 |
mem = conf->memory[memid]; |
| 112 |
if ((xwdim > mem->xsize) || (ywdim > mem->ysize)) return(TWTOOBIG); |
| 113 |
|
| 114 |
/* store transfer window parameters */ |
| 115 |
|
| 116 |
mem->xwdim = xwdim; |
| 117 |
mem->ywdim = ywdim; |
| 118 |
mem->xwoff = xwoff; |
| 119 |
mem->ywoff = ywoff; |
| 120 |
if (loaddir != -99) mem->load_dir = loaddir; |
| 121 |
|
| 122 |
return(II_SUCCESS); |
| 123 |
} |
| 124 |
/* |
| 125 |
|
| 126 |
*/ |
| 127 |
|
| 128 |
/************************************************************************ |
| 129 |
* IIMWMY_C routine : writes image memory * |
| 130 |
* * |
| 131 |
* synopsis IIMWMY_C (display , memid , data , npixel , depth , packf ,* |
| 132 |
* x0 , y0); * |
| 133 |
* * |
| 134 |
* int display; input display identifier * |
| 135 |
* int memid; input memory identifier * |
| 136 |
* int data[]; input image or graphic data * |
| 137 |
* single array -npix- long * |
| 138 |
* int npixel; input data array length * |
| 139 |
* int depth; input data depth (bits/pixel) * |
| 140 |
* int packf; input packing factor ( pixel/int >> 1..32 ) * |
| 141 |
* int x0; input X data origin * |
| 142 |
* int y0; input Y data origin * |
| 143 |
************************************************************************/ |
| 144 |
|
| 145 |
int IIMWMY_C (display , memid , data , npixel , depth , packf , x0 , y0) |
| 146 |
|
| 147 |
int display , memid , npixel , depth , packf , x0 , y0; |
| 148 |
unsigned char *data; |
| 149 |
|
| 150 |
{ |
| 151 |
int ix, iy, nb; |
| 152 |
int colchan; |
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
if (ididev[display].opened == 0) return(DEVNOTOP); |
| 157 |
|
| 158 |
conf = ididev[display].confptr; |
| 159 |
if (conf->RGBmode == 1) |
| 160 |
{ |
| 161 |
colchan = memid; |
| 162 |
memid = 0; /* single memory for 3 channels */ |
| 163 |
} |
| 164 |
else |
| 165 |
{ |
| 166 |
if ((memid < 0) || (memid >= conf->nmem)) return(ILLMEMID); |
| 167 |
colchan = -1; |
| 168 |
} |
| 169 |
|
| 170 |
|
| 171 |
mem = conf->memory[memid]; |
| 172 |
if (mem->mmbm == (char *) 0) |
| 173 |
nb = allo_mem(display,mem,memid); /* allocate primary memory */ |
| 174 |
|
| 175 |
iy = ((npixel-1) / mem->xwdim) + 1; /* no. of rows to write */ |
| 176 |
ix = npixel / iy; |
| 177 |
if (y0 +iy > mem->ysize) return(IMGTOOBIG); |
| 178 |
|
| 179 |
wr_mem(display,colchan,mem,x0,y0,ix,iy,0,data); |
| 180 |
|
| 181 |
|
| 182 |
return(II_SUCCESS); |
| 183 |
} |
| 184 |
/* |
| 185 |
|
| 186 |
*/ |
| 187 |
|
| 188 |
/************************************************************************ |
| 189 |
* IIMRMY_C routine : read image memory * |
| 190 |
* * |
| 191 |
* synopsis IIMRMY_C (display , memid , npixel , x0 , y0 , depth , * |
| 192 |
* packf , ittf , data); * |
| 193 |
* * |
| 194 |
* int display; input display identifier * |
| 195 |
* int memid; input memory identifier * |
| 196 |
* single array -npix- long * |
| 197 |
* int npixel; input data array length * |
| 198 |
* int x0; input X data origin * |
| 199 |
* int y0; input Y data origin * |
| 200 |
* int depth; input data depth (bits/pixel) * |
| 201 |
* int packf; input packing factor ( pixel/int >> 1..32 ) * |
| 202 |
* int ittf; input ITT flag * |
| 203 |
* int data[]; output image or graphic data * |
| 204 |
************************************************************************/ |
| 205 |
|
| 206 |
int IIMRMY_C (display,memid,npixel,x0,y0,depth,packf,ittf,data) |
| 207 |
|
| 208 |
int display,memid,npixel,depth,packf,x0,y0,ittf; |
| 209 |
unsigned char *data; |
| 210 |
|
| 211 |
{ |
| 212 |
int ix, iy; |
| 213 |
int colchan, xoff, yoff, xsize; |
| 214 |
|
| 215 |
|
| 216 |
if (ididev[display].opened == 0) return(DEVNOTOP); |
| 217 |
|
| 218 |
conf = ididev [display].confptr; |
| 219 |
if (conf->RGBmode == 1) |
| 220 |
{ |
| 221 |
colchan = memid; |
| 222 |
memid = 0; /* single memory for 3 channels */ |
| 223 |
} |
| 224 |
else |
| 225 |
{ |
| 226 |
if ((memid < 0) || (memid >= conf->nmem)) return(ILLMEMID); |
| 227 |
colchan = -1; |
| 228 |
} |
| 229 |
|
| 230 |
mem = conf->memory[memid]; |
| 231 |
if (mem->mmbm == (char *) 0) |
| 232 |
ix = allo_mem(display,mem,memid); /* allocate primary memory */ |
| 233 |
|
| 234 |
iy = ((npixel-1) / mem->xwdim) + 1; /* no. of rows to write */ |
| 235 |
ix = npixel / iy; |
| 236 |
if (y0 +iy > mem->ysize) return(IMGTOOBIG); |
| 237 |
|
| 238 |
xoff = mem->xwoff + x0; |
| 239 |
yoff = (mem->ysize - 1 - mem->ywoff - y0) * mem->xsize; |
| 240 |
xsize = - mem->xsize; |
| 241 |
|
| 242 |
rd_mem(display,colchan,mem,0,mem->mmbm,xoff,yoff,xsize,ix,iy,ittf,data); |
| 243 |
|
| 244 |
return(II_SUCCESS); |
| 245 |
} |
| 246 |
/* |
| 247 |
|
| 248 |
*/ |
| 249 |
|
| 250 |
/************************************************************************ |
| 251 |
* IIMSMV_C routine : set memory visibility * |
| 252 |
* * |
| 253 |
* synopsis IIMSMV_C (display , memlist , nmem , vis); * |
| 254 |
* * |
| 255 |
* int display; input display identifier * |
| 256 |
* int memlist[]; input memory list * |
| 257 |
* int nmem; input number of memories * |
| 258 |
* int vis; input visibility (1/0) * |
| 259 |
************************************************************************/ |
| 260 |
|
| 261 |
int IIMSMV_C(display,memlist,nmem,vis) |
| 262 |
|
| 263 |
int display,nmem,vis; |
| 264 |
int memlist[]; |
| 265 |
|
| 266 |
{ |
| 267 |
int memid, i; |
| 268 |
int szflag; |
| 269 |
|
| 270 |
if (ididev[display].opened == 0) return(DEVNOTOP); |
| 271 |
if (nmem > 1) |
| 272 |
{ |
| 273 |
(void) printf |
| 274 |
("IIMSMV: memory list with more than 1 memory not supported...\n"); |
| 275 |
return(FNCNOTIMPL); |
| 276 |
} |
| 277 |
|
| 278 |
szflag = 0; |
| 279 |
memid = memlist[0]; |
| 280 |
|
| 281 |
conf = ididev[display].confptr; |
| 282 |
if (conf->RGBmode == 1) |
| 283 |
{ |
| 284 |
if (memid == 3) |
| 285 |
memid = conf->overlay; |
| 286 |
else |
| 287 |
memid = 0; /* single memory for 3 channels */ |
| 288 |
} |
| 289 |
else |
| 290 |
{ |
| 291 |
if ((memid < 0) || (memid >= conf->nmem)) return(ILLMEMID); |
| 292 |
} |
| 293 |
|
| 294 |
|
| 295 |
mem = conf->memory[memid]; |
| 296 |
mem->visibility = vis; |
| 297 |
|
| 298 |
if (vis == 1) |
| 299 |
{ |
| 300 |
if (memid == conf->overlay) |
| 301 |
{ |
| 302 |
if (mem->gpntr != 0) polyrefr(display,mem,0,0); |
| 303 |
if (mem->tpntr != (TLIST *)0) txtrefr(display,mem,0,0); |
| 304 |
return(II_SUCCESS); |
| 305 |
} |
| 306 |
|
| 307 |
if (conf->RGBmode != 1) |
| 308 |
{ |
| 309 |
for (i=0; i<conf->nmem; i++) /* turn off visibility for all others */ |
| 310 |
{ |
| 311 |
if ((i != memid) && (i != conf->overlay)) |
| 312 |
{ |
| 313 |
dmem = conf->memory[i]; |
| 314 |
dmem->visibility = 0; |
| 315 |
} |
| 316 |
} |
| 317 |
} |
| 318 |
|
| 319 |
allrefr(display,mem,memid,2); /* also updates graphics */ |
| 320 |
|
| 321 |
|
| 322 |
/* if needed, repaint overlay graphics */ |
| 323 |
|
| 324 |
i = conf->overlay; |
| 325 |
dmem = conf->memory[i]; |
| 326 |
if (dmem->visibility == 1) |
| 327 |
{ |
| 328 |
if (dmem->gpntr != 0) polyrefr(display,dmem,0,0); |
| 329 |
if (dmem->tpntr != (TLIST *)0) txtrefr(display,dmem,0,0); |
| 330 |
} |
| 331 |
} |
| 332 |
|
| 333 |
|
| 334 |
/* with visibility off, we only have work if it's the overlay channel */ |
| 335 |
|
| 336 |
else |
| 337 |
{ |
| 338 |
if (memid == conf->overlay) |
| 339 |
{ |
| 340 |
if (conf->RGBmode != 1) |
| 341 |
{ /* no RGB mode */ |
| 342 |
for (i=0; i<conf->nmem; i++) |
| 343 |
{ |
| 344 |
if (i != memid) |
| 345 |
{ |
| 346 |
dmem = conf->memory[i]; |
| 347 |
if (dmem->visibility == 1) /* use 1st chanl with vis on */ |
| 348 |
{ |
| 349 |
allrefr(display,dmem,i,1); |
| 350 |
return(II_SUCCESS); |
| 351 |
} |
| 352 |
} |
| 353 |
} |
| 354 |
} |
| 355 |
else /* in RGB mode */ |
| 356 |
{ |
| 357 |
dmem = conf->memory[0]; |
| 358 |
if (dmem->visibility == 1) /* use red chanl */ |
| 359 |
{ |
| 360 |
allrefr(display,dmem,0,1); |
| 361 |
return(II_SUCCESS); |
| 362 |
} |
| 363 |
} |
| 364 |
return(II_SUCCESS); |
| 365 |
} |
| 366 |
} |
| 367 |
|
| 368 |
conf->memid = memid; /* update active memory-id in config */ |
| 369 |
return(II_SUCCESS); |
| 370 |
} |
| 371 |
/* |
| 372 |
|
| 373 |
*/ |
| 374 |
|
| 375 |
/************************************************************************ |
| 376 |
* IIMCMY_C routine : clear memory * |
| 377 |
* * |
| 378 |
* synopsis IIMCMY_C (display , memlist , nmem , bck); * |
| 379 |
* * |
| 380 |
* int display; input display identifier * |
| 381 |
* int memlist[]; input memory list * |
| 382 |
* int nmem; input number of memories * |
| 383 |
* int bck; input background value * |
| 384 |
************************************************************************/ |
| 385 |
|
| 386 |
int IIMCMY_C (display, memlist, nmem, bck) |
| 387 |
|
| 388 |
int display, nmem, bck; |
| 389 |
int memlist[]; |
| 390 |
|
| 391 |
{ |
| 392 |
int i, n, curmem; |
| 393 |
|
| 394 |
ALPH_DATA *alph; |
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
if (ididev[display].opened == 0) return(DEVNOTOP); |
| 399 |
if (nmem < 1) return(BADINPUT); |
| 400 |
|
| 401 |
conf = ididev[display].confptr; |
| 402 |
|
| 403 |
for (i=0; i<nmem; i++) |
| 404 |
{ |
| 405 |
curmem = memlist[i]; |
| 406 |
|
| 407 |
if (curmem >= 90) /* handle alpha memory in a special way... */ |
| 408 |
{ |
| 409 |
if (ididev[display].alpno < 90) |
| 410 |
return (NOALPHA); |
| 411 |
else |
| 412 |
{ |
| 413 |
alph = conf->alpmem[conf->memid]; |
| 414 |
for (n=0; n<10; n++) |
| 415 |
alph->savx[n] = -1; |
| 416 |
clalph(display,0,0,0,0); |
| 417 |
return(II_SUCCESS); |
| 418 |
} |
| 419 |
} |
| 420 |
|
| 421 |
if (conf->RGBmode == 1) /* true RGB mode */ |
| 422 |
{ |
| 423 |
if (curmem == 3) |
| 424 |
{ |
| 425 |
curmem = conf->overlay; |
| 426 |
mem = conf->memory[curmem]; |
| 427 |
} |
| 428 |
else |
| 429 |
{ |
| 430 |
if ((curmem < 0) || (curmem > 2)) return(ILLMEMID); |
| 431 |
mem = conf->memory[0]; |
| 432 |
} |
| 433 |
clgraph(mem); /* clear any graphics + text */ |
| 434 |
} |
| 435 |
|
| 436 |
else |
| 437 |
{ |
| 438 |
if ((curmem < 0) || (curmem >= conf->nmem)) return(ILLMEMID); |
| 439 |
mem = conf->memory[curmem]; |
| 440 |
clgraph(mem); /* clear any graphics + text */ |
| 441 |
clmem(mem); /* reset parameters of normal" channel */ |
| 442 |
} |
| 443 |
|
| 444 |
|
| 445 |
|
| 446 |
if ((mem->type & II_IMAGE) > 0) |
| 447 |
{ |
| 448 |
if (mem->mmbm == (char *) 0) |
| 449 |
n = allo_mem(display,mem,curmem); |
| 450 |
else |
| 451 |
{ |
| 452 |
if (ididev[display].devtyp == 'g') |
| 453 |
cl_win(display,bck); |
| 454 |
else |
| 455 |
{ |
| 456 |
int trumem; |
| 457 |
|
| 458 |
if (conf->RGBmode == 1) |
| 459 |
{ |
| 460 |
unsigned char zero=0; |
| 461 |
|
| 462 |
wr_mem(display,curmem,mem,0,0,mem->xsize,mem->ysize, |
| 463 |
1,&zero); /* curmem => RGBflag */ |
| 464 |
clmem(mem); |
| 465 |
trumem = 0; |
| 466 |
} |
| 467 |
else |
| 468 |
{ |
| 469 |
zero_mem(display,mem,0,bck); |
| 470 |
trumem = curmem; |
| 471 |
} |
| 472 |
|
| 473 |
if (mem->visibility == 1) |
| 474 |
smv(2,display,mem,trumem,0,0,mem->xsize,mem->ysize,0,0); |
| 475 |
|
| 476 |
if (ididev[display].alpno >= 90) |
| 477 |
{ |
| 478 |
alph = conf->alpmem[trumem]; |
| 479 |
for (n=0; n<10; n++) alph->savx[n] = -1; |
| 480 |
if (mem->visibility == 1) clalph(display,0,0,0,0); |
| 481 |
} |
| 482 |
} |
| 483 |
} |
| 484 |
} |
| 485 |
else |
| 486 |
{ |
| 487 |
if (conf->RGBmode == 1) /* was if (conf->RGBmode > 0) */ |
| 488 |
{ |
| 489 |
if (mem->mmbm == (char *) 0) |
| 490 |
cl_win(display,bck); |
| 491 |
else |
| 492 |
zero_mem(display,mem,0,bck); |
| 493 |
clgraph(mem); |
| 494 |
} |
| 495 |
else |
| 496 |
{ |
| 497 |
if (ididev[display].devtyp == 'g') |
| 498 |
cl_win(display,bck); |
| 499 |
else |
| 500 |
zero_mem(display,mem,0,bck); |
| 501 |
} |
| 502 |
} |
| 503 |
} |
| 504 |
|
| 505 |
if (curmem == conf->overlay) |
| 506 |
{ |
| 507 |
for (i=0; i<conf->nmem; i++) |
| 508 |
{ |
| 509 |
if (i != curmem) |
| 510 |
{ |
| 511 |
dmem = conf->memory[i]; |
| 512 |
if (dmem->visibility == 1) /* use first channel with vis on */ |
| 513 |
{ |
| 514 |
allrefr(display,dmem,i,1); |
| 515 |
return(II_SUCCESS); |
| 516 |
} |
| 517 |
} |
| 518 |
} |
| 519 |
} |
| 520 |
|
| 521 |
return(II_SUCCESS); |
| 522 |
} |
| 523 |
/* |
| 524 |
|
| 525 |
*/ |
| 526 |
|
| 527 |
/************************************************************************ |
| 528 |
* IIMSLT_C routine : select video lookup table * |
| 529 |
* * |
| 530 |
* synopsis IIMSLT_C (display , memid , lutn , ittn); * |
| 531 |
* * |
| 532 |
* int display; input display identifier * |
| 533 |
* int memid; input memory identifier * |
| 534 |
* int lutn; input LUT number * |
| 535 |
* int ittn; input ITT number * |
| 536 |
************************************************************************/ |
| 537 |
|
| 538 |
int IIMSLT_C (display , memid , lutn , ittn) |
| 539 |
|
| 540 |
int display , memid , lutn , ittn; |
| 541 |
|
| 542 |
{ |
| 543 |
|
| 544 |
return(II_SUCCESS); |
| 545 |
|
| 546 |
} |
| 547 |
|
| 548 |
/************************************************************************ |
| 549 |
* IIMBLM_C routine : blink memories * |
| 550 |
* * |
| 551 |
* synopsis IIMBLM_C (display , memlst , nmem , period); * |
| 552 |
* int display; input display identifier * |
| 553 |
* int memlst[]; input memory list * |
| 554 |
* int nmem; input no. of memories * |
| 555 |
* float period[]; input blink periods * |
| 556 |
************************************************************************/ |
| 557 |
|
| 558 |
int IIMBLM_C (display , memlst ,nmem , period) |
| 559 |
|
| 560 |
int display , memlst[] ,nmem; |
| 561 |
float period[]; |
| 562 |
|
| 563 |
{ |
| 564 |
int memid, Recta; |
| 565 |
register int nr; |
| 566 |
unsigned int time; |
| 567 |
|
| 568 |
|
| 569 |
|
| 570 |
|
| 571 |
if (ididev[display].opened == 0) return(DEVNOTOP); |
| 572 |
conf = ididev[display].confptr; |
| 573 |
if (conf->RGBmode == 1) |
| 574 |
{ |
| 575 |
(void) printf("IIMBLM: blinking not supported for TrueColor mode ...\n"); |
| 576 |
return(FNCNOTIMPL); |
| 577 |
} |
| 578 |
|
| 579 |
for (nr=0; nr<nmem; nr++) |
| 580 |
{ |
| 581 |
memid = memlst[nr]; |
| 582 |
if ((memid < 0) || (memid >= conf->nmem)) return(ILLMEMID); |
| 583 |
} |
| 584 |
|
| 585 |
memid = memlst[1]; /* test 2. channel for rectangle */ |
| 586 |
mem = conf->memory[memid]; |
| 587 |
if ((mem->xwdim < mem->xsize) || (mem->ywdim < mem->ysize)) |
| 588 |
Recta = 1; |
| 589 |
else |
| 590 |
Recta = 0; |
| 591 |
|
| 592 |
for (nr=0; nr<nmem; nr++) |
| 593 |
{ |
| 594 |
memid = memlst[nr]; |
| 595 |
mem = conf->memory[memid]; |
| 596 |
smv(3,display,mem,memid,0,0,mem->xsize,mem->ysize,0,0); |
| 597 |
} |
| 598 |
|
| 599 |
if (memlst[0] != conf->memid) /* 1. blink-chanl is not current one */ |
| 600 |
{ |
| 601 |
mem = conf->memory[conf->memid]; |
| 602 |
mem->visibility = 0; |
| 603 |
} |
| 604 |
|
| 605 |
|
| 606 |
/* enable EXIT trigger */ |
| 607 |
|
| 608 |
(void) IIIENI_C(display,5,0,0,0,0,0); |
| 609 |
exit_trg_enable(display); |
| 610 |
|
| 611 |
|
| 612 |
/* only period[0] is used for all channels... */ |
| 613 |
|
| 614 |
if (period[0] > 0.01) |
| 615 |
{ /* OSY_SLEEP <- millisecs */ |
| 616 |
time = (unsigned int) (period[0]*1000); |
| 617 |
} |
| 618 |
else |
| 619 |
{ |
| 620 |
time = 0; |
| 621 |
} |
| 622 |
|
| 623 |
|
| 624 |
blink_loop: |
| 625 |
for (nr=0; nr<nmem; nr++) |
| 626 |
{ |
| 627 |
memid = memlst[nr]; |
| 628 |
conf->memid = memid; /* update active mem id in config */ |
| 629 |
mem = conf->memory[memid]; |
| 630 |
mem->visibility = 1; |
| 631 |
|
| 632 |
if (Recta == 1) |
| 633 |
rectrefr(display,mem,memid); /* refresh rectangle of memory */ |
| 634 |
else |
| 635 |
allrefr(display,mem,memid,1); /* refresh contents of memory */ |
| 636 |
|
| 637 |
sendX(display); /* force display now!! */ |
| 638 |
|
| 639 |
mem->visibility = 0; /* now vis. for this mem. off */ |
| 640 |
|
| 641 |
|
| 642 |
/* do we have overlay stuff? */ |
| 643 |
|
| 644 |
mem = conf->memory[conf->overlay]; |
| 645 |
if (mem->visibility == 1) |
| 646 |
{ |
| 647 |
if (mem->gpntr != 0) polyrefr(display,mem,0,0); |
| 648 |
if (mem->tpntr != (TLIST *)0) txtrefr(display,mem,0,0); |
| 649 |
} |
| 650 |
|
| 651 |
if (stopped(display) == 1) goto blink_stop; /* Exit button pressed? */ |
| 652 |
|
| 653 |
if (time > 0) OSY_SLEEP(time,1); /* use high resolution wait... */ |
| 654 |
if (stopped(display) == 1) goto blink_stop; /* Exit button pressed? */ |
| 655 |
} |
| 656 |
|
| 657 |
goto blink_loop; |
| 658 |
|
| 659 |
|
| 660 |
/* leave last displayed memory visible */ |
| 661 |
|
| 662 |
blink_stop: |
| 663 |
ididev[display].n_inter = 0; |
| 664 |
int_disable(display); |
| 665 |
|
| 666 |
|
| 667 |
mem = conf->memory[memid]; /* set mem back from overlay */ |
| 668 |
|
| 669 |
mem->visibility = 1; |
| 670 |
|
| 671 |
return(II_SUCCESS); |
| 672 |
|
| 673 |
} |
| 674 |
/* |
| 675 |
|
| 676 |
*/ |
| 677 |
|
| 678 |
/************************************************************************ |
| 679 |
* IIMCPY_C routine : copy memory * |
| 680 |
* * |
| 681 |
* synopsis * |
| 682 |
* IIMCPY_C(displaya,memida,offseta,displayb,memidb,offsetb,xysize,zoom) * |
| 683 |
* * |
| 684 |
* int displaya; input display id of source |
| 685 |
* int memida; input memid of source |
| 686 |
* int offseta[]; input x,y offset in source |
| 687 |
* int memidb; input memid of destination |
| 688 |
* int offsetb[]; input x,y offset in destination |
| 689 |
* int xysize[]; input x,ysize for copying |
| 690 |
* int zoom; input zoom factor (>= 1) |
| 691 |
************************************************************************/ |
| 692 |
|
| 693 |
int IIMCPY_C(displaya,memida,offseta,displayb,memidb,offsetb,xysize,zoom) |
| 694 |
|
| 695 |
int displaya, displayb, memida, memidb; |
| 696 |
int *offseta, *offsetb, *xysize, zoom; |
| 697 |
|
| 698 |
{ |
| 699 |
CONF_DATA *confb; |
| 700 |
|
| 701 |
|
| 702 |
if ((ididev[displaya].opened == 0) || |
| 703 |
(ididev[displayb].opened == 0)) return(DEVNOTOP); |
| 704 |
|
| 705 |
conf = ididev [displaya].confptr; |
| 706 |
mem = conf->memory[memida]; |
| 707 |
|
| 708 |
confb = ididev [displayb].confptr; |
| 709 |
dmem = confb->memory[memidb]; |
| 710 |
|
| 711 |
copy_mem(displaya,mem,offseta,dmem,offsetb,xysize,zoom); |
| 712 |
|
| 713 |
return(II_SUCCESS); |
| 714 |
} |
| 715 |
/* |
| 716 |
|
| 717 |
*/ |
| 718 |
|
| 719 |
/************************************************************************ |
| 720 |
* IIMCPV_C routine : copy memory + make it visible * |
| 721 |
* * |
| 722 |
* synopsis * |
| 723 |
* IIMCPV_C(displaya,memida,offseta,displayb,memidb,offsetb,xysize,zoom) * |
| 724 |
* * |
| 725 |
* int displaya; input display id of source |
| 726 |
* int memida; input memid of source |
| 727 |
* int offseta[]; input x,y offset in source |
| 728 |
* int memidb; input memid of destination |
| 729 |
* int offsetb[]; input x,y offset in destination |
| 730 |
* int xysize[]; input x,ysize for copying |
| 731 |
* int zoom; input zoom factor (>= 1) |
| 732 |
************************************************************************/ |
| 733 |
|
| 734 |
int IIMCPV_C(displaya,memida,offseta,displayb,memidb,offsetb,xysize,zoom) |
| 735 |
|
| 736 |
int displaya, displayb, memida, memidb; |
| 737 |
int *offseta, *offsetb, *xysize, zoom; |
| 738 |
|
| 739 |
{ |
| 740 |
int i; |
| 741 |
|
| 742 |
CONF_DATA *confb; |
| 743 |
|
| 744 |
if ((ididev[displaya].opened == 0) || |
| 745 |
(ididev[displayb].opened == 0)) return(DEVNOTOP); |
| 746 |
|
| 747 |
conf = ididev [displaya].confptr; |
| 748 |
mem = conf->memory[memida]; |
| 749 |
|
| 750 |
confb = ididev [displayb].confptr; |
| 751 |
dmem = confb->memory[memidb]; |
| 752 |
|
| 753 |
copy_mem(displaya,mem,offseta,dmem,offsetb,xysize,zoom); |
| 754 |
|
| 755 |
dmem->visibility = 1; |
| 756 |
for (i=0; i<confb->nmem; i++) /* turn off visibility for all others */ |
| 757 |
{ |
| 758 |
if ((i != memidb) && (i != confb->overlay)) |
| 759 |
{ |
| 760 |
mem = confb->memory[i]; |
| 761 |
mem->visibility = 0; |
| 762 |
} |
| 763 |
} |
| 764 |
|
| 765 |
allrefr(displayb,dmem,memidb,2); /* also updates graphics */ |
| 766 |
confb->memid = memidb; /* update active memory id in configuration */ |
| 767 |
|
| 768 |
return(II_SUCCESS); |
| 769 |
} |
| 770 |
|