Utah Raster Toolkit  9999-git
URT Development version (post-3.1b)
getap.c
Go to the documentation of this file.
1 /*
2  * This software is copyrighted as noted below. It may be freely copied,
3  * modified, and redistributed, provided that the copyright notice is
4  * preserved on all copies.
5  *
6  * There is no warranty or other guarantee of fitness for this software,
7  * it is provided solely "as is". Bug reports or fixes may be sent
8  * to the author, who may or may not act on them as he desires.
9  *
10  * You may not include this software in a program or other software product
11  * without supplying the source, or without informing the end-user that the
12  * source is available for no extra charge.
13  *
14  * If you modify this software, you should include a notice giving the
15  * name of the person performing the modification, the date of modification,
16  * and the reason for such modification.
17  */
18 /*
19  * getap.c - Read RLE files onto apollo screens.
20  *
21  * Author: John W. Peterson
22  * Computer Science Dept.
23  * University of Utah
24  * Date: Fri Jun 27 1986
25  * Copyright (c) 1986 John W. Peterson
26  *
27  * Revision 1.1 87/05/26 13:22:30 Clark
28  * Add window name overhead to create window call and fix y calculation in
29  * put_line.
30  * Revision 1.2 87/10/01 10:38:00 Clark
31  * Add code to wait for user input, quit when user types "q"
32  * and to screen dump a GMR bitmap file if user types "d"
33  * Revision 1.3 88/01/07 08:28:30 Clark
34  * Add code to put file name in window legend and fix for obscured
35  * window, add flag for no border and x,y position
36  * Revision 1.4 88/01/08 08:10:30 Clark
37  * Add code for adding text to image
38  * Revision 1.5 88/02/25 01:54:00 Clark
39  * Re-instate BW code, and add suport for 4 bit plane workstations.
40  * Revision 1.6 88/02/29 11:33:50 Clark
41  * Use all available bit planes for gray scale. Use 16x16 dither
42  * for BW nodes instead of 8x8 S. Kitaoka Grey table
43  *
44  *
45  * Some code lifted from an old getX by Spencer Thomas and showbw
46  * by Jim Schimpf.
47  *
48  * Flags are:
49  * -l Linear map
50  * -g gam Gammap map, use gamma of gam (floating point number)
51  * -b Use full 24 bit mode (DN550, DN560, DN660 only)
52  * -w Black and white
53  * -r Flip white on black/black on white for grayscale display.
54  * -x left X coordinate of window
55  * -y top Y coordinate of window
56  * -t text Add text to bottom of image
57  * -n No border or legend
58  *
59  * NOTE: This version applies the color map if present.
60  */
61 
62 #include <stdio.h>
63 #include <math.h>
64 #include "rle.h"
65 
66 #include "/sys/ins/base.ins.c"
67 #include "/sys/ins/gpr.ins.c"
68 #include "/sys/ins/error.ins.c"
69 #include "/sys/ins/pad.ins.c"
70 
71 #define RASTERSIZE 1023
72 #define COLMAP_OFFSET 16
73 
74 #define sysdebug if ((status.all)!=0) error_$print(status)
75 
76 /* Scanline storage & RLE row pointers */
78 #define DMAP(v,x,y) (modN[v]>dm16[x][y] ? divN[v] + 1 : divN[v])
79 int dm16[16][16];
80 int modN[256], divN[256];
81 float gam = 2.0; /* Default gamma */
82 int inverse_flag = false; /* If true, swap bits on B&W displays */
83 int gray_flag = false; /* True if making BW image on color screen */
84 int borrow_mode = false; /* DN560/660 imaging mode (borrow screen)) */
85 int
86  linear_flag = false, /* Color map flags */
87  gam_flag = true;
88 int four_flag = false; /* If true, workstation has only 4 planes */
89 int bw_flag = false; /* If true, workstation is BW */
90 int x_flag = false; /* True if X coord specified */
91 int y_flag = false; /* True if Y coord specified */
92 int no_border_flag = false; /* True if no border or legend */
93 int left = 0; /* Default window X coord */
94 int top = 0; /* Default window Y coord */
95 gpr_$pixel_value_t dest_pixels[RASTERSIZE]; /* avoid bludging stack */
97 short font_id;
98 short middle;
100 gpr_$keyset_t keyset = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
101  0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff };
102 char key;
115 short map[3][256];
116 
117 /* Image header. */
118 rle_hdr hdr;
119 
121 int argc;
122 char **argv;
123 {
124  int i;
125  short len;
126  int row;
127  unsigned n;
128  char * fname = NULL;
129  char * text = NULL;
130  int text_flag = 0;
131  short namelen, tok_count;
132  char gstring[20];
133 
134  set_sbrk_size( 1000000 );
135 
136  hdr = *rle_hdr_init( (rle_hdr *)NULL );
137 
138  if (! scanargs( argc, argv,
139  "% b%- l%- r%- w%- n%- g%-gamma!f x%-left!d y%-top!d t%-text!s file%s",
142  &x_flag, &left, &y_flag, &top, &text_flag, &text, &fname ))
143  exit( 1 );
144  rle_names( &hdr, cmd_name( argv ), fname, 0 );
146 
147  switch( (int) rle_get_setup( &hdr ) )
148  {
149  case 0:
150  break; /* successful open */
151  case -1: /* not an RLE file */
152  case -4: /* or header is short */
153  fprintf( stderr, "getap: %s is not an RLE file\n", fname );
154  exit(-4);
155  break;
156  case -2:
157  fprintf( stderr, "getap: malloc failed\n" );
158  exit(-2);
159  break;
160  case -3:
161  fprintf( stderr, "getap: input file is empty\n" );
162  exit(-3);
163  break;
164  }
165 
166 /* RLE_CLR_BIT( hdr, RLE_ALPHA ); /* No alpha channel */
167 
169 
170  if (borrow_mode)
171  {
172  borrow_setup();
173  borrow_color_map();
174  if (hdr.ymax > 511)
175  hdr.ymax = 511;
176  }
177  else
178  {
179  setup_scr(hdr.xmax, hdr.ymax);
180  window_color_map();
181  if (hdr.ymax > RASTERSIZE)
183  }
184 
185  if (bw_flag) gray_flag = true;
186 
187  for (i = hdr.ymin; i <= hdr.ymax; i++)
188  {
190  if (borrow_mode)
191  put_line_borrow(i);
192  else
193  {
194  if (gray_flag)
195  put_linebw(i);
196  else
197  {
198  if (four_flag)
199  put_line4(i);
200  else
201  put_line8(i);
202  }
203  }
204  }
205  if (text_flag)
206  {
207  if (!borrow_mode) gpr_$acquire_display( status ) ;
208  gpr_$load_font_file( "nonie.r.16", (short) 10, font_id, status );
209  gpr_$set_text_font( font_id, status );
210  gpr_$set_text_background_value( (int) -1, status );
211  gpr_$set_text_value( (int) 17, status );
212  gpr_$inq_text_extent( *text, (short) strlen(text),
213  size, status );
214  middle = (hdr.xmax/2) - (size.x_size/2);
215  if (middle < 0) middle=0;
216  gpr_$move( middle, (short)(hdr.ymax-15), status);
217  gpr_$text( *text, (short) strlen(text), status);
218  if (!borrow_mode) gpr_$release_display( status ) ;
219  }
220  do
221  {
222  if (!borrow_mode) gpr_$acquire_display( status ) ;
223  gpr_$enable_input( gpr_$keystroke, keyset, status ) ;
224  obs = gpr_$event_wait ( event, key, position, status ) ;
225  if (!borrow_mode) gpr_$release_display( status ) ;
226  if ( (event == gpr_$keystroke) && ( (key == 'd') || (key == 'D') ) )
227  {
228  if (borrow_mode)
229  {
230  gpr_$inq_bitmap( bitmap, status ) ;
231  sysdebug;
232  gpr_$allocate_attribute_block(attribs,status);
233  sysdebug;
234  header[0].n_sects = 8;
235  header[0].pixel_size = 1;
236  header[0].allocated_size = 0;
237  header[0].bytes_per_line = 0;
238  header[0].bytes_per_sect = 0;
239  dump_size.x_size = 1024;
240  dump_size.y_size = 1024;
241  gpr_$open_bitmap_file(gpr_$create,"screen_dump",(short)11,version,
242  dump_size,(short)1,header,attribs,dump_bitmap,created,status);
243  if (status.all == 0)
244  {
245  gpr_$set_bitmap(dump_bitmap,status);
246  sysdebug;
247  gpr_$inq_color_map((int)0,256,color_map,status);
248  sysdebug;
249  gpr_$set_bitmap_file_color_map(dump_bitmap,0,256,color_map,status);
250  sysdebug;
251  dump_window.window_base.x_coord = 0;
252  dump_window.window_base.y_coord = 0;
253  dump_window.window_size.x_size = 1024;
254  dump_window.window_size.y_size = 1024;
255  gpr_$set_imaging_format(gpr_$interactive, status );
256  sysdebug;
257  gpr_$pixel_blt(bitmap,dump_window,dump_window.window_base,status);
258  sysdebug;
259  gpr_$set_imaging_format(gpr_$imaging_512x512x24, status );
260  sysdebug;
261  }
262  else
263  {
264  fprintf(stderr, "getap: Could not open bitmap file screen_dump - ");
265  error_$print(status);
266  }
267  }
268  else
269  {
270  pad_$dm_cmd ((short)1, "CPO /COM/CPSCR SCREEN_DUMP -GPR", (short)31, status ) ;
271  sysdebug;
272  }
273  }
274  if ( (event == gpr_$keystroke) && ( (key == 'p') || (key == 'P') && (!borrow_mode) ) )
275  {
276  pad_$dm_cmd ((short)1, "WP", (short)2, status ) ;
277  sysdebug;
278  }
279  }
280  while ( !( (event == gpr_$keystroke) && ( (key == 'q') || (key == 'Q') ) ) );
281  if (borrow_mode)
282  {
283  gpr_$set_imaging_format(gpr_$interactive, status );
284  sysdebug;
285  }
286  if (!borrow_mode && four_flag)
287  {
288  gpr_$acquire_display( status ) ;
289  gpr_$set_color_map((int)0,8,color_map,status);
290  gpr_$release_display( status ) ;
291  }
292 }
293 
294 /*
295  * Initialize the GPR package to imaging mode
296  */
297 borrow_setup()
298 {
299  gpr_$offset_t size;
300  gpr_$bitmap_desc_t main_bitmap; /* Master bitmap */
301 
302  size.x_size = 1024;
303  size.y_size = 1024; /* GPR will shrink to fit */
304 
305  gpr_$init(gpr_$borrow, 1, size, 7, main_bitmap, status );
306  sysdebug;
307 
308  gpr_$set_imaging_format( gpr_$imaging_512x512x24, status );
309  sysdebug;
310  if (status.all != status_$ok)
311  {
312  fprintf(stderr, "getap: Wrong hardware?\n");
313  exit(-1);
314  }
315 }
316 
317 /* Set up the color map (imaging mode) */
318 borrow_color_map()
319 {
320  unsigned int value;
321  unsigned int intgam;
322  int i, map_offset;
323  gpr_$color_vector_t colmap;
324 
325  if ( hdr.ncmap ) /* Must read color map */
326  {
327  map_offset = 1 << hdr.cmaplen;
328 
329  /* This needs more thought; handle ncmap = 1, etc. */
330  if (hdr.ncmap == 3)
331 
332  for (i=0; i < 256; i++)
333  {
334  /* This is bogus, we need to index cmap!... */
335 
336  value = (((hdr.cmap[i]>> 8) & 0xFF) << 16);
337  value |= (((hdr.cmap[i+map_offset] >> 8) & 0xFF) << 8);
338  value |= ((hdr.cmap[i+2*map_offset] >> 8) & 0xFF);
339  colmap[i] = value;
340  }
341  }
342  else
343  {
344  if (gam_flag)
345  {
346  for (i = 0; i < 256; i++)
347  {
348  intgam = (int)(0.5 + 255 * pow( i / 255.0, 1.0/gam ));
349  value = intgam;
350  value |= (intgam << 8);
351  value |= (intgam << 16);
352  colmap[i] = value;
353  }
354  }
355  else
356  { /* Default is linear map */
357  for (i=0; i < 256; i++)
358  {
359  value = (i << 16);
360  value |= (i << 8);
361  value |= i;
362  colmap[i] = value;
363  }
364  }
365  }
366 
367 
368  gpr_$set_color_map( (int) 0, 256, colmap, status );
369  sysdebug;
370 }
371 
372 /*
373  * Initialize the 8 bit color map. Use gamma corrected map.
374  */
375 window_color_map()
376 {
377  int i, j, k, l, planes, map_offset;
378  unsigned int value;
379  unsigned int intgam;
380  status_$t status;
381  static gpr_$color_vector_t colmap;
382  gpr_$display_config_t config;
383 
384  if ( hdr.ncmap ) /* Must read color map */
385  {
386  map_offset = 1 << hdr.cmaplen;
387 
388  /* This needs more thought; handle ncmap = 1, etc. */
389  if (hdr.ncmap == 3)
390 
391  for (i=0; i < 256; i++)
392  {
393  /* This is bogus, we need to index cmap!... */
394 
395  map[0][i] = ((hdr.cmap[i]>> 8) & 0xFF);
396  map[1][i] = ((hdr.cmap[i+map_offset] >> 8) & 0xFF);
397  map[2][i] = ((hdr.cmap[i+2*map_offset] >> 8) & 0xFF);
398  }
399  }
400  else
401  {
402  if (gam_flag)
403  {
404  for (i = 0; i < 256; i++)
405  {
406  intgam = (int)(0.5 + 255 * pow( i / 255.0, 1.0/gam ));
407  map[0][i] = intgam;
408  map[1][i] = intgam;
409  map[2][i] = intgam;
410  }
411  }
412  else
413  { /* Default is linear map */
414  for (i=0; i < 256; i++)
415  {
416  map[0][i] = i;
417  map[1][i] = i;
418  map[2][i] = i;
419  }
420  }
421  }
422 
423  gpr_$inq_config( config, status );
424  if ((config == gpr_$color_1024x1024x4) ||
425  (config == gpr_$color_1024x800x4) ||
426  (config == gpr_$color2_1024x800x4)) four_flag = true;
427  if ((config == gpr_$bw_800x1024) ||
428  (config == gpr_$bw_1024x800) ||
429  (config == gpr_$bw_1280x1024)) bw_flag = true;
430 
431  if (four_flag && !bw_flag && !gray_flag)
432  {
433  /*
434  * Set up the 4-bit color map entries.
435  */
436  for(i = 0; i < 8; i++) {
437  colmap[i] = ((i%2) * 255) << 16;
438  colmap[i] |= (((i/2)%2) * 255) << 8;
439  colmap[i] |= (((i/4)%2) * 255);
440  }
441 
442  /* Save DM window colors */
443  gpr_$acquire_display( status );
444  gpr_$inq_color_map((int)0,8,color_map,status);
445  gpr_$set_color_map( (int)0, 8, colmap, status );
446  gpr_$release_display( status );
447 
449  }
450  else if (four_flag && !bw_flag && gray_flag)
451  {
452  bwdithermap( 8, gam, colmap, divN, modN, dm16);
453 
454  for(i = 0; i < 8; i++) {
455  j = colmap[i];
456  colmap[i] = j << 16;
457  colmap[i] |= j << 8;
458  colmap[i] |= j;
459  }
460  /* Save DM window colors */
461  gpr_$acquire_display( status );
462  gpr_$inq_color_map((int)0,8,color_map,status);
463  gpr_$set_color_map( (int)0, 8, colmap, status );
464  gpr_$release_display( status );
465 
466  }
467  else if (!bw_flag && !gray_flag)
468  {
469  /*
470  * Set up the 8 bit color map entries. We don't yet know the location
471  * in the map at which each will reside, so init it to 0.
472  */
473  for(i = 0; i < 216; i++) {
474  colmap[i] = ((i%6) * 51) << 16;
475  colmap[i] |= (((i/6)%6) * 51) << 8;
476  colmap[i] |= (((i/36)%6) * 51);
477  }
478 
479  /* Offset from DM window colors */
480  gpr_$acquire_display( status );
481  gpr_$set_color_map( (int) COLMAP_OFFSET, 256 - COLMAP_OFFSET,
482  colmap, status );
483  gpr_$release_display( status );
484 
485  /* Compute tables */
487  }
488  else if (!bw_flag)
489  {
490  bwdithermap( 240, gam, colmap, divN, modN, dm16);
491 
492  for(i = 0; i < 240; i++) {
493  j = colmap[i];
494  colmap[i] = j << 16;
495  colmap[i] |= j << 8;
496  colmap[i] |= j;
497  }
498  /* Offset from DM window colors */
499  gpr_$acquire_display( status );
500  gpr_$set_color_map( (int) COLMAP_OFFSET, 256 - COLMAP_OFFSET,
501  colmap, status );
502  gpr_$release_display( status );
503  }
504  else
505  {
506  bwdithermap( 2, gam, colmap, divN, modN, dm16);
507  }
508 }
509 
510 /* All the fun stuff to set up an apollo window */
511 setup_scr(hsize,vsize)
512 int hsize,vsize;
513 {
514  gpr_$offset_t size;
515  gpr_$color_vector_t colmap;
516  gpr_$attribute_desc_t hidden_desc;
517  unsigned int value;
518  int i;
519  name_$pname_t output_file;
520  short len, w, h;
521  pad_$window_desc_t window_shape;
522  static gpr_$bitmap_desc_t main_bitmap;
523  short fontid;
524  static stream_$id_t out_stream;
525 
526  /* Open a separate window to display the results */
527 
528  window_shape.top = 0;
529  window_shape.left = 0;
530  if ( !no_border_flag )
531  {
532  w = 11;
533  h = 34;
534  }
535  else
536  {
537  w = 1;
538  h = 1;
539  }
540  window_shape.width = (short)hsize + w;
541  window_shape.height = (short)vsize + h;
542 
543  pad_$create_window( "", (short) 0, pad_$transcript, (short) 1,
544  window_shape, out_stream, status );
545 
546  if ( no_border_flag ) pad_$set_border( out_stream, (short) 1, false, status );
547 
548  window_shape.top = top;
549  window_shape.left = left;
550  pad_$set_full_window( out_stream, (short) 1, window_shape, status );
551 
552  pad_$set_auto_close( out_stream, (short) 1, true, status );
553 
554  size.x_size = 1024; /* GPR will shrink to fit */
555  size.y_size = 1024;
556 
557  /* Initialize the graphics primitives package */
558 
559  gpr_$init(gpr_$direct,
560  out_stream, /* "unit" */
561  size, /* size of the initial bitmap */
562  7, /* identifier of the heightest
563  numbered bitmap plane */
564  main_bitmap, /* resulting bitmap descriptor */
565  status);
566 
567  gpr_$set_auto_refresh( true, status ); /* all yours, DM. */
568 
569  gpr_$set_obscured_opt( gpr_$block_if_obs, status );
570 
571  gpr_$acquire_display( status ) ;
572 
573  /* set the new bitmap descriptor to be the 'current bitmap' */
574  gpr_$set_bitmap(main_bitmap,status);
575  gpr_$clear( gpr_$black, status );
576 
577  gpr_$release_display( status );
578 }
579 
580 /* Write a scanline to the frame buffer using full 24 bit mode */
581 put_line_borrow(y)
582 int y;
583 {
584  int i;
585  gpr_$window_t dest_box;
586  unsigned char *redptr, *grnptr, *bluptr;
587 
588 
589  dest_box.window_base.x_coord = 0;
590  dest_box.window_base.y_coord = 511 - y;
591  dest_box.window_size.x_size = 511;
592  dest_box.window_size.y_size = 1;
593 
594  redptr = rows[RLE_RED];
595  if (hdr.ncolors == 3)
596  {
597  grnptr = rows[RLE_GREEN];
598  bluptr = rows[RLE_BLUE];
599  }
600  else /* If only one channel, get all from same one */
601  {
602  grnptr = rows[0];
603  bluptr = rows[0];
604  }
605  for (i = hdr.xmin; i <= hdr.xmax; i++)
606  {
607  dest_pixels[i] = (gpr_$pixel_value_t) ((*redptr) << 16);
608  dest_pixels[i] |= (gpr_$pixel_value_t) ((*grnptr) << 8);
609  dest_pixels[i] |= (gpr_$pixel_value_t) (*bluptr);
610  redptr++; grnptr++; bluptr++;
611  }
612  gpr_$write_pixels( dest_pixels, dest_box, status );
613  sysdebug;
614 }
615 
616 /*
617  * Map a 24 bit scanline to 4 bits through the dither matrix.
618  */
619 
620 put_line4( y )
621 int y;
622 {
623  register unsigned char *r, *g, *b;
624  register int i, col, row;
625  gpr_$window_t dest_box;
626  int n = hdr.xmax;
627 
628  r = rows[RLE_RED];
629  if (hdr.ncolors == 3)
630  {
631  g = rows[RLE_GREEN];
632  b = rows[RLE_BLUE];
633  }
634  else
635  {
636  g = rows[0];
637  b = rows[0];
638  }
639 
640  for ( row = y % 16, col = 0, i = 0;
641  i <= n; i++, r++, g++, b++, col = ((col + 1) & 15) )
642  dest_pixels[i] = DMAP(map[0][*r], col, row) +
643  DMAP(map[1][*g], col, row) * 2 +
644  DMAP(map[2][*b], col, row) * 4;
645 
646  dest_box.window_base.x_coord = hdr.xmin;
647  dest_box.window_base.y_coord = hdr.ymax - y;
648  dest_box.window_size.x_size = hdr.xmin + hdr.xmax + 1;
649  dest_box.window_size.y_size = 1;
650 
651  gpr_$acquire_display( status ) ;
652  gpr_$write_pixels( dest_pixels, dest_box, status );
653  gpr_$release_display( status );
654 
655 }
656 
657 /*
658  * Map a 24 bit scanline to 8 bits through the dither matrix.
659  */
660 
661 put_line8( y )
662 int y;
663 {
664  register unsigned char *r, *g, *b;
665  register int i, col, row;
666  gpr_$window_t dest_box;
667  int n = hdr.xmax;
668 
669  r = rows[RLE_RED];
670  if (hdr.ncolors == 3)
671  {
672  g = rows[RLE_GREEN];
673  b = rows[RLE_BLUE];
674  }
675  else
676  {
677  g = rows[0];
678  b = rows[0];
679  }
680 
681  for ( row = y % 16, col = 0, i = 0;
682  i <= n; i++, r++, g++, b++, col = ((col + 1) & 15) )
683  dest_pixels[i] = DMAP(map[0][*r], col, row) +
684  DMAP(map[1][*g], col, row) * 6 +
685  DMAP(map[2][*b], col, row) * 36 + COLMAP_OFFSET;
686 
687  dest_box.window_base.x_coord = hdr.xmin;
688  dest_box.window_base.y_coord = hdr.ymax - y;
689  dest_box.window_size.x_size = hdr.xmin + hdr.xmax + 1;
690  dest_box.window_size.y_size = 1;
691 
692  gpr_$acquire_display( status ) ;
693  gpr_$write_pixels( dest_pixels, dest_box, status );
694  gpr_$release_display( status );
695 
696 }
697 
698 /*
699  * Map a 24 bit scanline through to get dithered black and white
700  */
701 
702 put_linebw( y )
703 int y;
704 {
705  register unsigned char *r, *g, *b;
706  register int i, col, row;
707  gpr_$window_t dest_box;
708  int pixel;
709  int n = hdr.xmax;
710  gpr_$pixel_value_t B = 0, W = 1;
711 
712  r = rows[RLE_RED];
713  if (hdr.ncolors == 3)
714  {
715  g = rows[RLE_GREEN];
716  b = rows[RLE_BLUE];
717  }
718  else
719  {
720  g = rows[0];
721  b = rows[0];
722  }
723 
724  if (bw_flag)
725  {
726  if (inverse_flag)
727  {
728  B = 1; W = 0; /* Swap meaning of Black and White */
729  }
730 
731  for ( row = y % 16, col = 0, i = 0;
732  i <= n; i++, r++, g++, b++, col = ((col + 1) & 15) )
733  {
734  /* Convert to BW (uses YIQ/percentage xformation) */
735  pixel = (35*map[0][*r] + 55*map[1][*g] + 10*map[2][*b]) / 100;
736  if (pixel < 0) pixel += 256;
737  dest_pixels[i] = ((DMAP(pixel, col, row) > 0) ? W : B);
738  }
739  }
740  else
741  {
742  for ( row = y % 16, col = 0, i = 0;
743  i <= n; i++, r++, g++, b++, col = ((col + 1) & 15) )
744  {
745  /* Convert to BW (uses YIQ/percentage xformation) */
746  pixel = (35*map[0][*r] + 55*map[1][*g] + 10*map[2][*b]) / 100;
747  if (pixel < 0) pixel += 256;
748  if (inverse_flag)
749  {
750  pixel = ((~pixel) & 0xFF); /* Swap meaning of Black and White */
751  }
752  if (four_flag)
753  {
754  dest_pixels[i] = DMAP(pixel, col, row);
755  }
756  else
757  {
758  dest_pixels[i] = DMAP(pixel, col, row) + COLMAP_OFFSET;
759  }
760  }
761  }
762  dest_box.window_base.x_coord = hdr.xmin;
763  dest_box.window_base.y_coord = hdr.ymax - y;
764  dest_box.window_size.x_size = hdr.xmin + hdr.xmax + 1;
765  dest_box.window_size.y_size = 1;
766 
767  gpr_$acquire_display( status ) ;
768  gpr_$write_pixels( dest_pixels, dest_box, status );
769  gpr_$release_display( status );
770 
771 }
FILE * rle_open_f(char *prog_name, char *file_name, char *mode)
Definition: rle_open_f.c:216
gpr_ $version_t version
Definition: getap.c:106
status_ $t status
Definition: getap.c:99
boolean obs
Definition: getap.c:104
rle_hdr hdr
Definition: getx10.c:84
gpr_ $offset_t dump_size
Definition: getap.c:107
char key
Definition: getap.c:102
int xmin
Definition: rle.h:100
int modN[256]
Definition: to8.c:45
void make_square(double N, divN, modN, magic)
Definition: dither.c:192
void rle_names(rle_hdr *the_hdr, const char *pgmname, const char *fname, int img_num)
Definition: rle_hdr.c:48
gpr_ $bmf_group_header_array_t header
Definition: getap.c:113
float gam
Definition: getbob.c:65
int gray_flag
Definition: getap.c:83
gpr_ $color_vector_t color_map
Definition: getap.c:114
char * cmd_name(char **argv)
Definition: cmd_name.c:31
void main(int argc, char **argv)
Definition: aliastorle.c:121
int borrow_mode
Definition: getap.c:84
int rle_get_setup(rle_hdr *the_hdr)
Definition: rle_getrow.c:74
int x_flag
Definition: getap.c:90
rle_map * cmap
Definition: rle.h:112
int rle_row_alloc(rle_hdr *the_hdr, rle_pixel ***scanp)
Definition: rle_row_alc.c:56
boolean created
Definition: getap.c:112
#define RLE_GREEN
Definition: rle.h:63
int rle_getrow(rle_hdr *the_hdr, scanline)
Definition: rle_getrow.c:333
int divN[256]
Definition: to8.c:45
int y_flag
Definition: getap.c:91
gpr_ $attribute_desc_t attribs
Definition: getap.c:109
int ymin
Definition: rle.h:100
#define RLE_BLUE
Definition: rle.h:64
int scanargs(int argc, char **argv, const char *format,...)
Definition: scanargs.c:94
int dm16[16][16]
Definition: to8.c:42
int four_flag
Definition: getap.c:88
const char * cmd
Definition: rle.h:133
#define RLE_RED
Definition: rle.h:62
int xmax
Definition: rle.h:100
gpr_ $event_t event
Definition: getap.c:105
#define sysdebug
Definition: getap.c:74
int top
Definition: getap.c:94
short middle
Definition: getap.c:98
short map[3][256]
Definition: to8.c:38
gpr_ $window_t dump_window
Definition: getap.c:108
int left
Definition: getap.c:93
int no_border_flag
Definition: getap.c:92
short font_id
Definition: getap.c:97
int inverse_flag
Definition: getap.c:82
int ncmap
Definition: rle.h:100
int ymax
Definition: rle.h:100
gpr_ $bitmap_desc_t bitmap
Definition: getap.c:110
unsigned char rle_pixel
Definition: rle.h:56
boolean linear_flag
Definition: getbob.c:74
gpr_ $bitmap_desc_t dump_bitmap
Definition: getap.c:111
int cmaplen
Definition: rle.h:100
gpr_ $keyset_t keyset
Definition: getap.c:100
int gam_flag
Definition: getap.c:87
gpr_ $offset_t size
Definition: getap.c:96
gpr_ $position_t position
Definition: getap.c:103
#define DMAP(v, x, y)
Definition: get_orion.c:310
#define COLMAP_OFFSET
Definition: getap.c:72
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)
Definition: rle_hdr.c:267
int bw_flag
Definition: getap.c:89
unsigned char * rows[4]
Definition: getbob.c:52
FILE * rle_file
Definition: rle.h:114
int ncolors
Definition: rle.h:100
#define RASTERSIZE
Definition: getap.c:71