| 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 |
* * |
| 30 |
* file: idiutil1.c * |
| 31 |
* * |
| 32 |
* X11 independent internal service routines * |
| 33 |
* * |
| 34 |
************************************************************************ |
| 35 |
* V 1.1 871201: P. Santin - Trieste Astronomical Observatory (X10) * |
| 36 |
* V 2.0 890102: K. Banse - ESO Garching (X11) * |
| 37 |
|
| 38 |
090424 last modif |
| 39 |
************************************************************************ |
| 40 |
|
| 41 |
* contains the following routines: |
| 42 |
* |
| 43 |
* clmem : Clear parameters of memory |
| 44 |
* wr_mem : Write Main Memory Bitmap; |
| 45 |
* rd_mem : Read Main Memory Bitmap; |
| 46 |
* show_pix8 : Read + Display location + pixel_value; |
| 47 |
* copy_mem : Copy memory (or parts of); |
| 48 |
* zero_mem : set memory to zero (+ constant) |
| 49 |
* |
| 50 |
***********************************************************************/ |
| 51 |
|
| 52 |
/* |
| 53 |
|
| 54 |
*/ |
| 55 |
|
| 56 |
# include <idi.h> |
| 57 |
# include <idistruct.h> |
| 58 |
# include <computer.h> |
| 59 |
# include <proto_idi.h> |
| 60 |
|
| 61 |
# include <stdlib.h> |
| 62 |
# include <stdio.h> |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
/* set up for "normal" [x][0] and byte swapped [x][1] case */ |
| 67 |
|
| 68 |
static int shiftab[3][2] = |
| 69 |
{ |
| 70 |
{0, 24}, /* red/blue for RGBord 0/1 */ |
| 71 |
{8, 16}, /* green */ |
| 72 |
{16, 8}, /* blue/red for RGBord 0/1 */ |
| 73 |
}; |
| 74 |
|
| 75 |
static unsigned int outab[3][2] = |
| 76 |
{ |
| 77 |
{0x00ffff00, 0x00ffff00}, /* red/blue */ |
| 78 |
{0x00ff00ff, 0xff00ff00}, /* green */ |
| 79 |
{0x0000ffff, 0xffff0000}, /* blue/red */ |
| 80 |
}; |
| 81 |
/* |
| 82 |
|
| 83 |
*/ |
| 84 |
|
| 85 |
/* ---- Clear Memory Parameters ------------------------------------- */ |
| 86 |
|
| 87 |
void clmem(mem) |
| 88 |
|
| 89 |
MEM_DATA *mem; |
| 90 |
|
| 91 |
{ |
| 92 |
register int nr; |
| 93 |
|
| 94 |
mem->xwoff = mem->ywoff = 0; |
| 95 |
mem->xwdim = mem->xsize; |
| 96 |
mem->ywdim = mem->ysize; |
| 97 |
mem->load_dir = 0; |
| 98 |
mem->lut_id = 0; |
| 99 |
mem->xscroll = mem->yscroll = 0; |
| 100 |
mem->zoom = 1; |
| 101 |
mem->xscale = mem->yscale = 1; |
| 102 |
mem->sspx = mem->sspy = 0; |
| 103 |
mem->nsx = mem->nsy = 0; |
| 104 |
mem->sfpx = mem->sfpy = 1; |
| 105 |
mem->source = 0; |
| 106 |
mem->frame[0] = ' '; |
| 107 |
mem->frame[1] = '\0'; /* was: (void) strcpy(mem->frame," "); */ |
| 108 |
for (nr=0; nr<8; nr++) mem->rbuf[nr] = 0.0; |
| 109 |
} |
| 110 |
|
| 111 |
/* |
| 112 |
|
| 113 |
*/ |
| 114 |
|
| 115 |
/* ---- write main memory bitmap ------------------------------------- */ |
| 116 |
|
| 117 |
void wr_mem(dspno,RGBflag,mem,x0,y0,ix,iy,const_flg,data) |
| 118 |
|
| 119 |
MEM_DATA *mem; |
| 120 |
int dspno, RGBflag, x0, y0, ix, iy, const_flg; |
| 121 |
unsigned char *data; |
| 122 |
|
| 123 |
{ |
| 124 |
int no, temp, kxsiz, ioff, indy; |
| 125 |
register int loopk, loopi, koff, off, dval, *ptrlut; |
| 126 |
|
| 127 |
register unsigned char *cpntra, *cpntrb; |
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
if (mem->load_dir == 0) /* loading bottom up */ |
| 133 |
{ |
| 134 |
temp = (mem->ysize -1 - mem->ywoff - y0) * mem->xsize; |
| 135 |
kxsiz = - mem->xsize; |
| 136 |
} |
| 137 |
else /* loading top down */ |
| 138 |
{ |
| 139 |
temp = (mem->ywoff + y0) * mem->xsize; |
| 140 |
kxsiz = mem->xsize; |
| 141 |
} |
| 142 |
|
| 143 |
mem->source = mem->source | 1; /* set last bit */ |
| 144 |
|
| 145 |
off = 0; |
| 146 |
no = ididev[dspno].screen; |
| 147 |
ioff = ididev[dspno].lutsect * Xworkst[no].lutsize; |
| 148 |
ptrlut = Xworkst[no].mapin; |
| 149 |
|
| 150 |
|
| 151 |
if (Xworkst[no].flag24[0] == 0) /* write swap flag */ |
| 152 |
indy = 0; |
| 153 |
else |
| 154 |
indy = 1; /* Yes, byte swapped */ |
| 155 |
|
| 156 |
|
| 157 |
if (Xworkst[no].visual == 2) /* PseudoColor */ |
| 158 |
{ |
| 159 |
if (Xworkst[no].nobyt == 1) /* 8 bit memory */ |
| 160 |
{ |
| 161 |
cpntra = (unsigned char*)( mem->mmbm + temp + (mem->xwoff + x0) ); |
| 162 |
|
| 163 |
if (ioff == 0) |
| 164 |
{ |
| 165 |
for (loopi=0; loopi<iy; loopi++) |
| 166 |
{ |
| 167 |
cpntrb = cpntra; |
| 168 |
koff = off; |
| 169 |
for (loopk=0; loopk<ix; loopk++) |
| 170 |
{ |
| 171 |
dval = (int)data[koff++]; |
| 172 |
*cpntrb++ = (unsigned char) *(ptrlut+dval); |
| 173 |
} |
| 174 |
|
| 175 |
cpntra += kxsiz; |
| 176 |
off += ix; |
| 177 |
} |
| 178 |
} |
| 179 |
else |
| 180 |
{ |
| 181 |
for (loopi=0; loopi<iy; loopi++) |
| 182 |
{ |
| 183 |
cpntrb = cpntra; |
| 184 |
koff = off; |
| 185 |
for (loopk=0; loopk<ix; loopk++) |
| 186 |
{ |
| 187 |
dval = (int)data[koff++] + ioff; |
| 188 |
*cpntrb++ = (unsigned char) *(ptrlut+dval); |
| 189 |
} |
| 190 |
|
| 191 |
cpntra += kxsiz; |
| 192 |
off += ix; |
| 193 |
} |
| 194 |
} |
| 195 |
} |
| 196 |
else if (Xworkst[no].nobyt == 2) /* 16 bit memory */ |
| 197 |
{ |
| 198 |
register short int *jpntra, *jpntrb; |
| 199 |
|
| 200 |
jpntra = (short int *) mem->mmbm; |
| 201 |
jpntra += (temp + (mem->xwoff + x0)); |
| 202 |
|
| 203 |
if (ioff == 0) |
| 204 |
{ |
| 205 |
for (loopi=0; loopi<iy; loopi++) |
| 206 |
{ |
| 207 |
jpntrb = jpntra; |
| 208 |
koff = off; |
| 209 |
for (loopk=0; loopk<ix; loopk++) |
| 210 |
{ |
| 211 |
dval = (int)data[koff++]; |
| 212 |
*jpntrb++ = (short int) *(ptrlut+dval); |
| 213 |
} |
| 214 |
|
| 215 |
jpntra += kxsiz; |
| 216 |
off += ix; |
| 217 |
} |
| 218 |
} |
| 219 |
else |
| 220 |
{ |
| 221 |
for (loopi=0; loopi<iy; loopi++) |
| 222 |
{ |
| 223 |
jpntrb = jpntra; |
| 224 |
koff = off; |
| 225 |
for (loopk=0; loopk<ix; loopk++) |
| 226 |
{ |
| 227 |
dval = (int)data[koff++] + ioff; |
| 228 |
*jpntrb++ = (short int) *(ptrlut+dval); |
| 229 |
} |
| 230 |
|
| 231 |
jpntra += kxsiz; |
| 232 |
off += ix; |
| 233 |
} |
| 234 |
} |
| 235 |
} |
| 236 |
} |
| 237 |
|
| 238 |
else if (Xworkst[no].visual == 3) /* Direct/TrueColor (3 bytes/pixel) */ |
| 239 |
{ |
| 240 |
int rgbpix, pixi, shiftmask, outmask; |
| 241 |
register int *ipntra, *ipntrb; |
| 242 |
|
| 243 |
ipntra = (int *) mem->mmbm; |
| 244 |
ipntra += (temp + (mem->xwoff + x0)); |
| 245 |
|
| 246 |
|
| 247 |
if (RGBflag == 0) /* work on red color */ |
| 248 |
{ |
| 249 |
if (Xworkst[no].RGBord == 0) |
| 250 |
{ |
| 251 |
shiftmask = shiftab[0][indy]; /* red */ |
| 252 |
outmask = outab[0][indy]; |
| 253 |
} |
| 254 |
else |
| 255 |
{ |
| 256 |
shiftmask = shiftab[2][indy]; /* red */ |
| 257 |
outmask = outab[2][indy]; |
| 258 |
} |
| 259 |
} |
| 260 |
else if (RGBflag == 1) /* work on green color */ |
| 261 |
{ |
| 262 |
shiftmask = shiftab[1][indy]; /* green */ |
| 263 |
outmask = outab[1][indy]; |
| 264 |
} |
| 265 |
else /* work on blue color */ |
| 266 |
{ |
| 267 |
if (Xworkst[no].RGBord == 0) |
| 268 |
{ |
| 269 |
shiftmask = shiftab[2][indy]; /* blue */ |
| 270 |
outmask = outab[2][indy]; |
| 271 |
} |
| 272 |
else |
| 273 |
{ |
| 274 |
shiftmask = shiftab[0][indy]; /* blue */ |
| 275 |
outmask = outab[0][indy]; |
| 276 |
} |
| 277 |
} |
| 278 |
|
| 279 |
if (const_flg == 1) |
| 280 |
{ |
| 281 |
dval = (int) *data; |
| 282 |
dval = dval << shiftmask; |
| 283 |
|
| 284 |
for (loopi=0; loopi<iy; loopi++) |
| 285 |
{ |
| 286 |
ipntrb = ipntra; |
| 287 |
for (loopk=0; loopk<ix; loopk++) |
| 288 |
{ |
| 289 |
rgbpix = (*ipntrb) & outmask; |
| 290 |
*ipntrb++ = (rgbpix | dval); |
| 291 |
} |
| 292 |
ipntra += kxsiz; |
| 293 |
} |
| 294 |
} |
| 295 |
|
| 296 |
else |
| 297 |
{ |
| 298 |
for (loopi=0; loopi<iy; loopi++) |
| 299 |
{ |
| 300 |
ipntrb = ipntra; |
| 301 |
koff = off; |
| 302 |
for (loopk=0; loopk<ix; loopk++) |
| 303 |
{ |
| 304 |
dval = (int)data[koff++]; |
| 305 |
dval &= 0xff; /* cut out last byte */ |
| 306 |
pixi = dval << shiftmask; |
| 307 |
rgbpix = (*ipntrb) & outmask; |
| 308 |
*ipntrb++ = (rgbpix | pixi); |
| 309 |
} |
| 310 |
ipntra += kxsiz; |
| 311 |
off += ix; |
| 312 |
} |
| 313 |
} |
| 314 |
} |
| 315 |
|
| 316 |
else if (Xworkst[no].visual == 4) |
| 317 |
{ |
| 318 |
register unsigned int *ipntra, *ipntrb; |
| 319 |
|
| 320 |
ipntra = (unsigned int *) mem->mmbm; |
| 321 |
ipntra += (temp + (mem->xwoff + x0)); |
| 322 |
|
| 323 |
if (const_flg == 1) |
| 324 |
{ |
| 325 |
dval = (int) *data; |
| 326 |
dval += Xworkst[no].auxcol; |
| 327 |
dval = Xworkst[no].mapin[dval]; |
| 328 |
|
| 329 |
for (loopi=0; loopi<iy; loopi++) |
| 330 |
{ |
| 331 |
ipntrb = ipntra; |
| 332 |
for (loopk=0; loopk<ix; loopk++) *ipntrb++ = dval; |
| 333 |
ipntra += kxsiz; |
| 334 |
} |
| 335 |
} |
| 336 |
|
| 337 |
else |
| 338 |
{ |
| 339 |
for (loopi=0; loopi<iy; loopi++) |
| 340 |
{ |
| 341 |
ipntrb = ipntra; |
| 342 |
koff = off; |
| 343 |
for (loopk=0; loopk<ix; loopk++) |
| 344 |
{ |
| 345 |
dval = (int)data[koff++] + Xworkst[no].auxcol; |
| 346 |
/* |
| 347 |
*ipntrb++ = *(ptrlut+dval); |
| 348 |
*ipntrb++ = Xworkst[no].mapin[dval]; |
| 349 |
*/ |
| 350 |
*ipntrb++ = Xworkst[no].mapin[dval]; |
| 351 |
} |
| 352 |
ipntra += kxsiz; |
| 353 |
off += ix; |
| 354 |
} |
| 355 |
} |
| 356 |
} |
| 357 |
} |
| 358 |
|
| 359 |
/* |
| 360 |
|
| 361 |
*/ |
| 362 |
|
| 363 |
unsigned short int XSWAP_SHORT(jnni) |
| 364 |
unsigned short int jnni; |
| 365 |
|
| 366 |
{ |
| 367 |
unsigned short int ja, jb, jn; |
| 368 |
|
| 369 |
jb = jnni & 0xff; /* input: ab */ |
| 370 |
ja = (jnni >> 8) & 0xff; |
| 371 |
|
| 372 |
jb = jb << 8; |
| 373 |
jn = jb | ja; /* output: ba */ |
| 374 |
|
| 375 |
return jn; |
| 376 |
} |
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
/* ---- read main memory bitmap -------------------------------------- */ |
| 381 |
|
| 382 |
void rd_mem(dspno,RGBflag,mem,hcopflg,inpntr,xoff,yoff,xsize,ix,iy,ittf,data) |
| 383 |
|
| 384 |
MEM_DATA *mem; |
| 385 |
int dspno, RGBflag; |
| 386 |
int hcopflg; /* IN: = 1, make a copy of display */ |
| 387 |
int xoff, yoff, xsize, ix, iy, ittf; |
| 388 |
char *inpntr; |
| 389 |
unsigned char *data; |
| 390 |
|
| 391 |
{ |
| 392 |
register unsigned char *cpntra, *cpntrb; |
| 393 |
register int i, loopk, loopi, lutoff; |
| 394 |
ITT_DATA *itt; |
| 395 |
|
| 396 |
int ioff, no, offset, pix; |
| 397 |
unsigned char cpx; |
| 398 |
|
| 399 |
|
| 400 |
lutoff = ididev[dspno].lutoff; |
| 401 |
itt = mem->ittpntr; |
| 402 |
no = ididev[dspno].screen; |
| 403 |
ioff = ididev[dspno].lutsect * Xworkst[no].lutsize; |
| 404 |
|
| 405 |
|
| 406 |
/* |
| 407 |
printf("rd_memory: visual = %d, hcopflg = %d, RGBord = %d\n", |
| 408 |
Xworkst[no].visual,Xworkst[no].RGBord,hcopflg); |
| 409 |
*/ |
| 410 |
|
| 411 |
|
| 412 |
if (Xworkst[no].visual == 2) /* PseudoColor */ |
| 413 |
{ |
| 414 |
if (Xworkst[no].nobyt == 1) /* 8 bit memory */ |
| 415 |
{ |
| 416 |
cpntra = (unsigned char*) (inpntr + yoff + xoff); |
| 417 |
|
| 418 |
if (ittf == 0) |
| 419 |
{ |
| 420 |
if (hcopflg == 0) |
| 421 |
{ |
| 422 |
for (loopi=0; loopi<iy; loopi++) |
| 423 |
{ |
| 424 |
cpntrb = cpntra; |
| 425 |
for (loopk=0; loopk<ix; loopk++) |
| 426 |
{ |
| 427 |
pix = *cpntrb++; |
| 428 |
*data++ = (unsigned char) Xworkst[no].mapout[ioff+pix]; |
| 429 |
} |
| 430 |
cpntra += xsize; |
| 431 |
} |
| 432 |
} |
| 433 |
else |
| 434 |
{ /* highest colour + LUT offset */ |
| 435 |
offset = Xworkst[no].lutlen; |
| 436 |
|
| 437 |
for (loopi=0; loopi<iy; loopi++) |
| 438 |
{ |
| 439 |
cpntrb = cpntra; |
| 440 |
for (loopk=0; loopk<ix; loopk++) |
| 441 |
{ |
| 442 |
pix = *cpntrb++; |
| 443 |
for (i=0; i<9; i++) /* test, if fixed colour */ |
| 444 |
{ |
| 445 |
if (pix == Xworkst[no].fixpix[i]) |
| 446 |
{ |
| 447 |
*data++ = (unsigned char) (offset + i); |
| 448 |
goto nexta; |
| 449 |
} |
| 450 |
} |
| 451 |
*data++ = (unsigned char) Xworkst[no].mapout[ioff+pix]; |
| 452 |
nexta: |
| 453 |
; |
| 454 |
} |
| 455 |
|
| 456 |
cpntra += xsize; |
| 457 |
} |
| 458 |
} |
| 459 |
} |
| 460 |
else |
| 461 |
{ /* here we handle ITT data */ |
| 462 |
if (hcopflg == 0) |
| 463 |
{ |
| 464 |
for (loopi=0; loopi<iy; loopi++) |
| 465 |
{ |
| 466 |
cpntrb = cpntra; |
| 467 |
for (loopk=0; loopk<ix; loopk++) |
| 468 |
{ |
| 469 |
pix = *cpntrb++; |
| 470 |
cpx = (unsigned char) Xworkst[no].mapout[ioff+pix]; |
| 471 |
*data++ = (unsigned char) (itt->val[cpx]); |
| 472 |
} |
| 473 |
cpntra += xsize; |
| 474 |
} |
| 475 |
} |
| 476 |
else |
| 477 |
{ |
| 478 |
offset = Xworkst[no].lutlen; /* highest colour only */ |
| 479 |
for (loopi=0; loopi<iy; loopi++) |
| 480 |
{ |
| 481 |
cpntrb = cpntra; |
| 482 |
for (loopk=0; loopk<ix; loopk++) |
| 483 |
{ |
| 484 |
pix = *cpntrb++; |
| 485 |
for (i=0; i<9; i++) /* test, if fixed colour */ |
| 486 |
{ |
| 487 |
if (pix == Xworkst[no].fixpix[i]) |
| 488 |
{ |
| 489 |
*data++ = (unsigned char) (offset + i); |
| 490 |
goto nextb; |
| 491 |
} |
| 492 |
} |
| 493 |
|
| 494 |
cpx = (unsigned char) Xworkst[no].mapout[ioff+pix]; |
| 495 |
*data++ = (unsigned char) (itt->val[cpx]); |
| 496 |
nextb: |
| 497 |
; |
| 498 |
} |
| 499 |
cpntra += xsize; |
| 500 |
} |
| 501 |
} |
| 502 |
} |
| 503 |
} |
| 504 |
} |
| 505 |
|
| 506 |
else if (Xworkst[no].visual == 3) |
| 507 |
{ /* DirectColor/TrueColor => 3 bytes per pixel */ |
| 508 |
register int *ipntra, *ipntrb; |
| 509 |
|
| 510 |
ipntra = (int *) inpntr; /* no ITT here */ |
| 511 |
ipntra += (yoff + xoff); |
| 512 |
|
| 513 |
if (hcopflg == 0) /* no display snapshot */ |
| 514 |
{ |
| 515 |
int rgbpix, shiftmask; |
| 516 |
|
| 517 |
/* Must account for RGB ordering when returning a particular plane */ |
| 518 |
switch (RGBflag) |
| 519 |
{ |
| 520 |
case 0: /* Red color */ |
| 521 |
if (Xworkst[no].RGBord == 0) shiftmask = 0; else shiftmask = 16; |
| 522 |
break; |
| 523 |
case 1: /* Green color */ |
| 524 |
shiftmask = 8; |
| 525 |
break; |
| 526 |
case 2: /* Blue color */ |
| 527 |
if (Xworkst[no].RGBord == 0) shiftmask = 16; else shiftmask = 0; |
| 528 |
break; |
| 529 |
default: |
| 530 |
shiftmask = 0; |
| 531 |
} |
| 532 |
for (loopi=0; loopi<iy; loopi++) |
| 533 |
{ |
| 534 |
ipntrb = ipntra; |
| 535 |
for (loopk=0; loopk<ix; loopk++) |
| 536 |
{ |
| 537 |
rgbpix = *ipntrb++; |
| 538 |
*data++ = (unsigned char) (rgbpix >> shiftmask) & 0xff; |
| 539 |
} |
| 540 |
ipntra += xsize; |
| 541 |
} |
| 542 |
} |
| 543 |
|
| 544 |
else /* hardcopy - work on all 3 color channels */ |
| 545 |
{ |
| 546 |
int *idata; |
| 547 |
unsigned int word; |
| 548 |
|
| 549 |
|
| 550 |
idata = (int *) data; |
| 551 |
for (loopi=0; loopi<iy; loopi++) |
| 552 |
{ |
| 553 |
ipntrb = ipntra; |
| 554 |
|
| 555 |
|
| 556 |
/* following section modified by CM */ |
| 557 |
|
| 558 |
if (Xworkst[no].RGBord == 0) |
| 559 |
{ |
| 560 |
for (loopk=0; loopk<ix; loopk++) *idata++ = *ipntrb++; |
| 561 |
} |
| 562 |
else |
| 563 |
{ |
| 564 |
for (loopk=0; loopk<ix; loopk++) |
| 565 |
{ |
| 566 |
word = *ipntrb++; |
| 567 |
*idata++ = ((word & 0x00ff00) | ((word & 0xff0000) >> 16) |
| 568 |
| ((word & 0x0000ff) << 16)); |
| 569 |
} |
| 570 |
} |
| 571 |
|
| 572 |
ipntra += xsize; |
| 573 |
} |
| 574 |
} |
| 575 |
} |
| 576 |
|
| 577 |
else /* emulate PseudoColor on Direct/TrueColor */ |
| 578 |
{ |
| 579 |
register int *ipntra, *ipntrb; |
| 580 |
|
| 581 |
ipntra = (int *) inpntr; /* no ITT here */ |
| 582 |
ipntra += (yoff + xoff); |
| 583 |
|
| 584 |
|
| 585 |
if (hcopflg == 0) |
| 586 |
{ |
| 587 |
unsigned long int mindist=0; |
| 588 |
unsigned int minind; |
| 589 |
|
| 590 |
for (loopi=0; loopi<iy; loopi++) |
| 591 |
{ |
| 592 |
ipntrb = ipntra; |
| 593 |
for (loopk=0; loopk<ix; loopk++) |
| 594 |
{ |
| 595 |
/* It is possible to lose precision in the memory "read", |
| 596 |
namely in the conversion from 16-bit to 32-bit pixels. |
| 597 |
Thus, we loop through each color table entry to find a |
| 598 |
closest match using the pythagorean theorem. On small |
| 599 |
enough images this is not a burden. |
| 600 |
|
| 601 |
To get nice quality print output this step appears |
| 602 |
necessary, so those using Pseudo emulation may just have |
| 603 |
to wait. |
| 604 |
|
| 605 |
I decided to put the ittf and hcopflg comparisons inside |
| 606 |
the inner loop. This doesn't cost much in comparison to |
| 607 |
the color-table-lookup loop. */ |
| 608 |
|
| 609 |
int i; |
| 610 |
pix = *ipntrb++; |
| 611 |
|
| 612 |
/* Removed check for fixed colours - doesn't work well in |
| 613 |
24-bit environments */ |
| 614 |
|
| 615 |
/* Search for the best fitting color index */ |
| 616 |
minind = -1; |
| 617 |
|
| 618 |
offset = Xworkst[no].lutlen; /* highest colour only */ |
| 619 |
|
| 620 |
for (i=ioff; i<(offset+ioff); i++) |
| 621 |
{ |
| 622 |
unsigned int lval; |
| 623 |
unsigned long int dist; |
| 624 |
int dr, dg, db; |
| 625 |
|
| 626 |
lval = Xworkst[no].mapin[i]; |
| 627 |
dr = ((lval & 0x0000ff) - (pix & 0x0000ff)); |
| 628 |
dg = ((lval & 0x00ff00) - (pix & 0x00ff00)) >> 8; |
| 629 |
db = ((lval & 0xff0000) - (pix & 0xff0000)) >> 16; |
| 630 |
/* Euclidean distance, squared */ |
| 631 |
dist = dr*dr + dg*dg + db*db; |
| 632 |
if (minind == -1 || dist < mindist) |
| 633 |
{ |
| 634 |
mindist = dist; |
| 635 |
minind = i; |
| 636 |
} |
| 637 |
} |
| 638 |
/* Apply transfer function and global offset */ |
| 639 |
if (ittf == 0) |
| 640 |
*data++ = (unsigned char) (minind - lutoff); |
| 641 |
else |
| 642 |
{ |
| 643 |
int kval = (minind - lutoff); |
| 644 |
if (kval < 0) kval = 0; |
| 645 |
*data++ = (unsigned char) (itt->val[kval]); |
| 646 |
} |
| 647 |
} |
| 648 |
|
| 649 |
ipntra += xsize; |
| 650 |
} |
| 651 |
} |
| 652 |
else /* hardcopy - work on all 3 color channels */ |
| 653 |
{ |
| 654 |
int *idata; |
| 655 |
unsigned int word; |
| 656 |
|
| 657 |
|
| 658 |
idata = (int *) data; |
| 659 |
|
| 660 |
/* The subsequent modules know about RGBord (= 0/1) |
| 661 |
(1 = 0 R G B 0 = 0 B G R), |
| 662 |
with data shifted to the low 24 bytes - |
| 663 |
thus for displays with RGBord = 1 we need 0 R G B as output |
| 664 |
(4 bytes, LSB to the right) |
| 665 |
and 0 B G R as output for displays with RGBord = 0 */ |
| 666 |
|
| 667 |
if (Xworkst[no].RGBord == 0) |
| 668 |
{ |
| 669 |
if (Xworkst[no].flag24[1] == 0) /* read swap flag */ |
| 670 |
{ /* no byte swap */ |
| 671 |
for (loopi=0; loopi<iy; loopi++) /* in: 0 B G R */ |
| 672 |
{ /* same for 16/24/32 bits */ |
| 673 |
ipntrb = ipntra; |
| 674 |
|
| 675 |
for (loopk=0; loopk<ix; loopk++) *idata++ = *ipntrb++; |
| 676 |
|
| 677 |
ipntra += xsize; |
| 678 |
} |
| 679 |
} |
| 680 |
else /* Yes, we have byte swap */ |
| 681 |
{ |
| 682 |
if (Xworkst[no].depth == 16) |
| 683 |
{ /* in: Rg gB 0 0 */ |
| 684 |
unsigned short int jj, kk; |
| 685 |
|
| 686 |
for (loopi=0; loopi<iy; loopi++) |
| 687 |
{ |
| 688 |
ipntrb = ipntra; |
| 689 |
|
| 690 |
for (loopk=0; loopk<ix; loopk++) |
| 691 |
{ |
| 692 |
word = *ipntrb++; |
| 693 |
kk = (unsigned short int) word; |
| 694 |
jj = XSWAP_SHORT(kk); |
| 695 |
*idata++ = (unsigned int) jj; |
| 696 |
} /* out: 0 0 gB Rg */ |
| 697 |
ipntra += xsize; |
| 698 |
} |
| 699 |
} |
| 700 |
else /* use 24 bits */ |
| 701 |
{ |
| 702 |
for (loopi=0; loopi<iy; loopi++) |
| 703 |
{ /* in: R G B 0 */ |
| 704 |
ipntrb = ipntra; |
| 705 |
|
| 706 |
for (loopk=0; loopk<ix; loopk++) |
| 707 |
{ |
| 708 |
word = *ipntrb++; |
| 709 |
word = word >> 8; /* out: 0 B G R */ |
| 710 |
*idata++ = ((word & 0x00ff00) | ((word & 0xff0000) >> 16) |
| 711 |
| ((word & 0x0000ff) << 16)); |
| 712 |
} |
| 713 |
ipntra += xsize; |
| 714 |
} |
| 715 |
} |
| 716 |
} |
| 717 |
} |
| 718 |
|
| 719 |
else |
| 720 |
{ |
| 721 |
if (Xworkst[no].flag24[1] == 0) /* read swap flag */ |
| 722 |
{ /* no byte swap */ |
| 723 |
for (loopi=0; loopi<iy; loopi++) /* in: 0 R G B */ |
| 724 |
{ |
| 725 |
ipntrb = ipntra; |
| 726 |
|
| 727 |
for (loopk=0; loopk<ix; loopk++) *idata++ = *ipntrb++; |
| 728 |
|
| 729 |
ipntra += xsize; /* same for 16/24/32 bits */ |
| 730 |
} |
| 731 |
} |
| 732 |
else /* Yes, we have byte swap */ |
| 733 |
{ |
| 734 |
if (Xworkst[no].depth == 16) |
| 735 |
{ /* in: Bg gR 0 0 */ |
| 736 |
unsigned short int jj, kk; |
| 737 |
|
| 738 |
for (loopi=0; loopi<iy; loopi++) |
| 739 |
{ |
| 740 |
ipntrb = ipntra; |
| 741 |
|
| 742 |
for (loopk=0; loopk<ix; loopk++) |
| 743 |
{ |
| 744 |
word = *ipntrb++; |
| 745 |
kk = (unsigned short int) word; |
| 746 |
jj = XSWAP_SHORT(kk); |
| 747 |
*idata++ = (unsigned int) jj; |
| 748 |
} /* out: 0 0 gR Bg */ |
| 749 |
ipntra += xsize; |
| 750 |
} |
| 751 |
} |
| 752 |
else /* in: B G R 0 */ |
| 753 |
{ |
| 754 |
for (loopi=0; loopi<iy; loopi++) |
| 755 |
{ |
| 756 |
ipntrb = ipntra; |
| 757 |
|
| 758 |
for (loopk=0; loopk<ix; loopk++) |
| 759 |
{ |
| 760 |
word = *ipntrb++; |
| 761 |
word = word >> 8; /* out: 0 R G B */ |
| 762 |
*idata++ = ((word & 0x00ff00) | ((word & 0xff0000) >> 16) |
| 763 |
| ((word & 0x0000ff) << 16)); |
| 764 |
} |
| 765 |
|
| 766 |
ipntra += xsize; |
| 767 |
} |
| 768 |
} |
| 769 |
} |
| 770 |
} |
| 771 |
} |
| 772 |
} |
| 773 |
} |
| 774 |
|
| 775 |
/* |
| 776 |
|
| 777 |
*/ |
| 778 |
|
| 779 |
/* ---- read + display cursor location(s) + pixel value ------------- */ |
| 780 |
|
| 781 |
void show_pix8(dspno,cursno,x0,y0,x1,y1,data) |
| 782 |
|
| 783 |
int dspno, cursno, x0, y0, x1, y1; |
| 784 |
unsigned char *data; |
| 785 |
|
| 786 |
{ |
| 787 |
int i, temp, pix, no, xs, ys, xoff, yoff; |
| 788 |
int *ipntra; |
| 789 |
short int *jpntra; |
| 790 |
register int lutoff; |
| 791 |
|
| 792 |
char text[28]; |
| 793 |
static char bltext[18] = " "; |
| 794 |
|
| 795 |
unsigned char *cpntra; |
| 796 |
|
| 797 |
MEM_DATA *mem; |
| 798 |
CONF_DATA *conf; |
| 799 |
ALPH_DATA *alph; |
| 800 |
|
| 801 |
if (ididev[dspno].alpno < 90) return; |
| 802 |
|
| 803 |
|
| 804 |
/* first we get currently active memory + the data values */ |
| 805 |
|
| 806 |
no = ididev[dspno].screen; |
| 807 |
lutoff = ididev[dspno].lutoff; |
| 808 |
conf = ididev[dspno].confptr; |
| 809 |
i = conf->memid; |
| 810 |
mem = conf->memory[i]; |
| 811 |
alph = conf->alpmem[i]; |
| 812 |
|
| 813 |
ys = 3; yoff = y0; xoff = x0; |
| 814 |
|
| 815 |
|
| 816 |
loop: |
| 817 |
temp = mem->ysize - 1 - mem->yscroll - yoff; |
| 818 |
|
| 819 |
if (Xworkst[no].visual == 2) /* PseudoColor */ |
| 820 |
{ |
| 821 |
if (Xworkst[no].nobyt == 1) /* 8bit memory */ |
| 822 |
{ |
| 823 |
cpntra = (unsigned char*)( mem->mmbm + (temp*mem->xsize) + |
| 824 |
(mem->xscroll + xoff) ); |
| 825 |
pix = *cpntra; |
| 826 |
*data = (unsigned char) (pix - lutoff); |
| 827 |
} |
| 828 |
else if (Xworkst[no].nobyt == 2) |
| 829 |
{ |
| 830 |
jpntra = (short int *) mem->mmbm; |
| 831 |
jpntra += (temp + (mem->xscroll + x0)); |
| 832 |
pix = *jpntra; |
| 833 |
*data = (unsigned char) (pix - lutoff); |
| 834 |
} |
| 835 |
} |
| 836 |
|
| 837 |
else /* DirectColor/TrueColor => 3 (in 4) bytes per pixel */ |
| 838 |
{ |
| 839 |
ipntra = (int *) mem->mmbm; |
| 840 |
ipntra += (temp*mem->xsize + (mem->xscroll + xoff)); |
| 841 |
pix = (*ipntra) & 0xff; /* use only red part */ |
| 842 |
if (Xworkst[no].visual == 4) |
| 843 |
{ |
| 844 |
pix -= lutoff; |
| 845 |
if (pix < 0) pix = 0; |
| 846 |
} |
| 847 |
*data = (unsigned char) pix; |
| 848 |
} |
| 849 |
|
| 850 |
/* now we display the stuff */ |
| 851 |
|
| 852 |
if ((cursno == 1) || (cursno == 3)) |
| 853 |
xs = (ididev[dspno].xsize/16) + 13; /* 13 = 5 + 8 */ |
| 854 |
else |
| 855 |
xs = 8; |
| 856 |
|
| 857 |
(void) sprintf(text,"%d, %d, %d",xoff,yoff,*data); /* convert to ASCII */ |
| 858 |
alptext(1,dspno,alph,bltext,xs,ys); /* force display */ |
| 859 |
alptext(1,dspno,alph,text,xs,ys); |
| 860 |
|
| 861 |
|
| 862 |
/* if cursno .eq. 2, handle second coordinate pair */ |
| 863 |
|
| 864 |
if (cursno == 2) |
| 865 |
{ |
| 866 |
data ++; |
| 867 |
yoff = y1; |
| 868 |
xoff = x1; |
| 869 |
cursno = 3; |
| 870 |
goto loop; |
| 871 |
} |
| 872 |
|
| 873 |
} |
| 874 |
|
| 875 |
/* |
| 876 |
|
| 877 |
*/ |
| 878 |
|
| 879 |
/* ---- Copy parts of memory planes ----------------------------------*/ |
| 880 |
|
| 881 |
void copy_zmem(dspno,mema) |
| 882 |
|
| 883 |
int dspno; |
| 884 |
MEM_DATA *mema; |
| 885 |
|
| 886 |
{ |
| 887 |
int offseta[2], xysize[2]; |
| 888 |
int offa, offb, inca; |
| 889 |
|
| 890 |
void cp_zmem8(); |
| 891 |
|
| 892 |
|
| 893 |
offseta[0] = mema->xscroll; |
| 894 |
offseta[1] = mema->ysize - (ididev[dspno].ysize + mema->yscroll); |
| 895 |
|
| 896 |
xysize[0] = (mema->xsize - offseta[0]); /* no of pixels per line */ |
| 897 |
xysize[1] = (mema->ysize - offseta[1]); /* no of lines */ |
| 898 |
|
| 899 |
|
| 900 |
if (mema->load_dir == 0) /* loading bottom up */ |
| 901 |
{ |
| 902 |
offa = (offseta[1] * mema->xsize) + offseta[0]; /* contrary to */ |
| 903 |
offb = 0; /* normal copy... ! */ |
| 904 |
inca = mema->xsize; |
| 905 |
} |
| 906 |
else |
| 907 |
{ |
| 908 |
offa = (((mema->ysize-1) - offseta[1]) * mema->xsize) + offseta[0]; |
| 909 |
offb = (mema->ysize - 1) * mema->xsize; |
| 910 |
inca = -mema->xsize; |
| 911 |
} |
| 912 |
|
| 913 |
if (Xworkst[ididev[dspno].screen].nobyt == 1) |
| 914 |
cp_zmem8(mema,offa,inca,offb,xysize); |
| 915 |
|
| 916 |
} |
| 917 |
|
| 918 |
/* |
| 919 |
|
| 920 |
*/ |
| 921 |
|
| 922 |
void cp_zmem8(mema,offa,xsiza,offb,xysize) |
| 923 |
|
| 924 |
int offa, xsiza, offb, *xysize; |
| 925 |
MEM_DATA *mema; |
| 926 |
|
| 927 |
{ |
| 928 |
int xm, ym, zoomf; |
| 929 |
register int i, k, loopk, loopi; |
| 930 |
|
| 931 |
register unsigned char *p1, *p2, *r1, *r2; |
| 932 |
|
| 933 |
|
| 934 |
p1 = (unsigned char *) mema->mmbm; |
| 935 |
p1 += offa; |
| 936 |
|
| 937 |
p2 = (unsigned char *) mema->zmbm; |
| 938 |
p2 += offb; |
| 939 |
|
| 940 |
zoomf = mema->zoom; |
| 941 |
xm = mema->xsize/zoomf; /* max. no. of pixels */ |
| 942 |
if (xm > *xysize) xm = *xysize; |
| 943 |
ym = mema->ysize/zoomf; /* max. no. of lines */ |
| 944 |
if (ym > xysize[1]) ym = xysize[1]; |
| 945 |
|
| 946 |
for (loopi=0; loopi<ym; loopi++) |
| 947 |
{ |
| 948 |
for (i=0; i<zoomf; i++) |
| 949 |
{ |
| 950 |
r1 = p1; |
| 951 |
r2 = p2; |
| 952 |
for (loopk=0; loopk<xm; loopk++) |
| 953 |
{ |
| 954 |
for (k=0; k<zoomf; k++) |
| 955 |
*r2++ = *r1; |
| 956 |
r1 ++; |
| 957 |
} |
| 958 |
p2 += xsiza; |
| 959 |
} |
| 960 |
|
| 961 |
p1 += xsiza; |
| 962 |
} |
| 963 |
} |
| 964 |
|
| 965 |
/* |
| 966 |
|
| 967 |
*/ |
| 968 |
|
| 969 |
/* ---- Copy parts of memory planes ----------------------------------*/ |
| 970 |
|
| 971 |
void copy_mem(dspno,mema,offseta,memb,offsetb,xysize,zoomf) |
| 972 |
|
| 973 |
int dspno, *offseta, *offsetb, *xysize, zoomf; |
| 974 |
MEM_DATA *mema, *memb; |
| 975 |
|
| 976 |
{ |
| 977 |
int no, offa, offb, inca, incb; |
| 978 |
|
| 979 |
void cp_mem8(), cp_mem16(), cp_mem32(); |
| 980 |
|
| 981 |
|
| 982 |
if (mema->load_dir == 0) /* loading bottom up */ |
| 983 |
{ |
| 984 |
offa = (((mema->ysize-1) - offseta[1]) * mema->xsize) + offseta[0]; |
| 985 |
offb = (((memb->ysize-1) - offsetb[1]) * memb->xsize) + offsetb[0]; |
| 986 |
inca = -mema->xsize; |
| 987 |
incb = -memb->xsize; |
| 988 |
} |
| 989 |
else |
| 990 |
{ |
| 991 |
offa = (offseta[1] * mema->xsize) + offseta[0]; |
| 992 |
offb = (offsetb[1] * memb->xsize) + offsetb[0]; |
| 993 |
inca = mema->xsize; |
| 994 |
incb = memb->xsize; |
| 995 |
} |
| 996 |
memb->source = memb->source | 2; |
| 997 |
|
| 998 |
no = ididev[dspno].screen; |
| 999 |
|
| 1000 |
if (Xworkst[no].visual == 2) /* PseudoColor */ |
| 1001 |
{ |
| 1002 |
if (Xworkst[no].nobyt == 1) |
| 1003 |
cp_mem8(mema,offa,inca,memb,offb,incb,xysize,zoomf); |
| 1004 |
else if (Xworkst[no].nobyt == 2) |
| 1005 |
cp_mem16(mema,offa,inca,memb,offb,incb,xysize,zoomf); |
| 1006 |
} |
| 1007 |
else /* DirectColor/TrueColor => 3 bytes per pixel */ |
| 1008 |
cp_mem32(mema,offa,inca,memb,offb,incb,xysize,zoomf); |
| 1009 |
} |
| 1010 |
|
| 1011 |
/* |
| 1012 |
|
| 1013 |
*/ |
| 1014 |
|
| 1015 |
void cp_mem8(mema,offa,xsiza,memb,offb,xsizb,xysize,zoomf) |
| 1016 |
|
| 1017 |
int xsiza, offa, xsizb, offb, *xysize, zoomf; |
| 1018 |
MEM_DATA *mema, *memb; |
| 1019 |
|
| 1020 |
{ |
| 1021 |
int xm, ym; |
| 1022 |
register int i, k, loopk, loopi; |
| 1023 |
|
| 1024 |
register unsigned char *p1, *p2, *r1, *r2; |
| 1025 |
|
| 1026 |
|
| 1027 |
p1 = (unsigned char *) mema->mmbm; |
| 1028 |
p1 += offa; |
| 1029 |
|
| 1030 |
p2 = (unsigned char *) memb->mmbm; |
| 1031 |
p2 += offb; |
| 1032 |
|
| 1033 |
xm = memb->xsize / zoomf; |
| 1034 |
if (xm > xysize[0]) xm = xysize[0]; /* no of pixels per line */ |
| 1035 |
|
| 1036 |
ym = memb->ysize / zoomf; |
| 1037 |
if (ym > xysize[1]) ym = xysize[1]; /* no of lines */ |
| 1038 |
|
| 1039 |
for (loopi=0; loopi<ym; loopi++) |
| 1040 |
{ |
| 1041 |
for (i=0; i<zoomf; i++) |
| 1042 |
{ |
| 1043 |
r1 = p1; |
| 1044 |
r2 = p2; |
| 1045 |
for (loopk=0; loopk<xm; loopk++) |
| 1046 |
{ |
| 1047 |
for (k=0; k<zoomf; k++) |
| 1048 |
*r2++ = *r1; |
| 1049 |
r1 ++; |
| 1050 |
} |
| 1051 |
p2 += xsizb; |
| 1052 |
} |
| 1053 |
p1 += xsiza; |
| 1054 |
} |
| 1055 |
} |
| 1056 |
|
| 1057 |
/* |
| 1058 |
|
| 1059 |
*/ |
| 1060 |
|
| 1061 |
void cp_mem16(mema,offa,xsiza,memb,offb,xsizb,xysize,zoomf) |
| 1062 |
|
| 1063 |
int xsiza, offa, xsizb, offb, *xysize, zoomf; |
| 1064 |
MEM_DATA *mema, *memb; |
| 1065 |
|
| 1066 |
{ |
| 1067 |
(void) printf("memory copy not implemented for 16 bit pixels...\n"); |
| 1068 |
return; |
| 1069 |
} |
| 1070 |
|
| 1071 |
void cp_mem32(mema,offa,xsiza,memb,offb,xsizb,xysize,zoomf) |
| 1072 |
|
| 1073 |
int xsiza, offa, xsizb, offb, *xysize, zoomf; |
| 1074 |
MEM_DATA *mema, *memb; |
| 1075 |
|
| 1076 |
{ |
| 1077 |
int xm, ym; |
| 1078 |
register int i, k, loopi, loopk; |
| 1079 |
register int *ip1, *ip2, *ir1, *ir2; |
| 1080 |
|
| 1081 |
|
| 1082 |
ip1 = (int *) mema->mmbm; |
| 1083 |
ip1 += offa; |
| 1084 |
|
| 1085 |
ip2 = (int *) memb->mmbm; |
| 1086 |
ip2 += offb; |
| 1087 |
|
| 1088 |
xm = memb->xsize / zoomf; |
| 1089 |
if (xm > xysize[0]) xm = xysize[0]; /* no of pixels per line */ |
| 1090 |
|
| 1091 |
ym = memb->ysize / zoomf; |
| 1092 |
if (ym > xysize[1]) ym = xysize[1]; /* no of lines */ |
| 1093 |
|
| 1094 |
for (loopi=0; loopi<ym; loopi++) |
| 1095 |
{ |
| 1096 |
for (i=0; i<zoomf; i++) |
| 1097 |
{ |
| 1098 |
ir1 = ip1; |
| 1099 |
ir2 = ip2; |
| 1100 |
for (loopk=0; loopk<xm; loopk++) |
| 1101 |
{ |
| 1102 |
for (k=0; k<zoomf; k++) |
| 1103 |
*ir2++ = *ir1; |
| 1104 |
ir1 ++; |
| 1105 |
} |
| 1106 |
ip2 += xsizb; |
| 1107 |
} |
| 1108 |
ip1 += xsiza; |
| 1109 |
} |
| 1110 |
} |
| 1111 |
|
| 1112 |
/* |
| 1113 |
|
| 1114 |
*/ |
| 1115 |
|
| 1116 |
/* ---- Zero Memory ------------------------------------- */ |
| 1117 |
|
| 1118 |
void zero_mem(dspno,mem,zflag,bck) |
| 1119 |
|
| 1120 |
int dspno, zflag, bck; |
| 1121 |
MEM_DATA *mem; |
| 1122 |
|
| 1123 |
{ |
| 1124 |
int no, temp; |
| 1125 |
register int loopi, lutoff; |
| 1126 |
|
| 1127 |
unsigned char bval; |
| 1128 |
unsigned char *cpntra; |
| 1129 |
|
| 1130 |
|
| 1131 |
if (mem->source > 1) |
| 1132 |
mem->source--; |
| 1133 |
else |
| 1134 |
mem->source = 0; |
| 1135 |
|
| 1136 |
temp = mem->xsize * mem->ysize; |
| 1137 |
no = ididev[dspno].screen; |
| 1138 |
lutoff = ididev[dspno].lutoff; |
| 1139 |
|
| 1140 |
if (Xworkst[no].visual == 2) /* `true' PseudoColor */ |
| 1141 |
{ |
| 1142 |
if (Xworkst[no].nobyt == 1) |
| 1143 |
{ |
| 1144 |
if (zflag == 0) |
| 1145 |
cpntra = (unsigned char *) mem->mmbm; |
| 1146 |
else |
| 1147 |
cpntra = (unsigned char *) mem->zmbm; |
| 1148 |
/* bval = (unsigned char) (lutoff + bck); */ |
| 1149 |
bval = (unsigned char) (ididev[dspno].backpix); |
| 1150 |
|
| 1151 |
for (loopi=0; loopi<temp; loopi++) |
| 1152 |
*cpntra++ = bval; |
| 1153 |
} |
| 1154 |
else if (Xworkst[no].nobyt == 2) |
| 1155 |
{ |
| 1156 |
register short int *jpntra, jbval; |
| 1157 |
|
| 1158 |
if (zflag == 0) |
| 1159 |
jpntra = (short int*) mem->mmbm; |
| 1160 |
else |
| 1161 |
jpntra = (short int*) mem->zmbm; |
| 1162 |
jbval = (short int) (ididev[dspno].backpix); |
| 1163 |
|
| 1164 |
for (loopi=0; loopi<temp; loopi++) |
| 1165 |
*jpntra++ = jbval; |
| 1166 |
} |
| 1167 |
} |
| 1168 |
|
| 1169 |
else if (Xworkst[no].visual == 3) /* RGB mode with 24 (32) bits */ |
| 1170 |
{ |
| 1171 |
register int *ipntra, ibval; |
| 1172 |
|
| 1173 |
if (zflag == 0) |
| 1174 |
ipntra = (int *) mem->mmbm; |
| 1175 |
else |
| 1176 |
ipntra = (int *) mem->zmbm; |
| 1177 |
|
| 1178 |
/* ibval = (int) bck; */ |
| 1179 |
ibval = (int) (ididev[dspno].backpix); |
| 1180 |
for (loopi=0; loopi<temp; loopi++) *ipntra++ = ibval; |
| 1181 |
} |
| 1182 |
|
| 1183 |
else if (Xworkst[no].visual == 4) /* PseudoColor on RGB */ |
| 1184 |
{ |
| 1185 |
register int *ipntra, ibval; |
| 1186 |
|
| 1187 |
if (zflag == 0) |
| 1188 |
ipntra = (int *) mem->mmbm; |
| 1189 |
else |
| 1190 |
ipntra = (int *) mem->zmbm; |
| 1191 |
|
| 1192 |
/* |
| 1193 |
ibval = (int) bck; |
| 1194 |
ibval += Xworkst[no].auxcol; |
| 1195 |
ibval = Xworkst[no].mapin[ibval]; |
| 1196 |
*/ |
| 1197 |
|
| 1198 |
ibval = (int) (ididev[dspno].backpix); |
| 1199 |
for (loopi=0; loopi<temp; loopi++) *ipntra++ = ibval; |
| 1200 |
} |
| 1201 |
} |
| 1202 |
|