[comp.windows.x] modifications to the bitmap editor

bradley@DSL.CIS.UPENN.EDU.UUCP (03/27/87)

I've modified the bitmap editor (the one that comes with X 10.4) so that it has
two extra commands, Flip Horizontal and Flip Vertical.  Useful for quickly 
converting a bitmap of a left-facing Blue Space Lemur into a right-facing 
Blue Space Lemur.  Or something like that.

Anyhow, here's the diffs to apply to bitmap.c, via the command:
  ( cat diffs ; echo '1,$p' ) | ed - bitmap.c > bitmap.c.new

John Bradley  (bradley@cis.upenn.edu)

"Patch program?!?  WHAT patch program?"

---------------(cut here, save as 'diffs' (or don't))--------------------------
1865a

FlipH() {
  register int i,j;

  for (i=0; i<squares_high; i++)
    for (j=0; j<(squares_wide/2); j++) {
      bit b,b1;
      b =GetRasterBit(raster, j, i);
      b1=GetRasterBit(raster, squares_wide-1-j, i);
      SetRasterBit(raster, j, i, b1);
      SetRasterBit(raster, squares_wide-1-j, i, b);
      }

  changed = TRUE;

  RefillGrid(TRUE);
  RepaintRaster();
  RepaintRasterInverted();
  }  /* end of FlipH procedure */

FlipV() {
  register int i,j;

  for (i=0; i<squares_wide; i++)
    for (j=0; j<(squares_high/2); j++) {
      bit b,b1;
      b =GetRasterBit(raster, i, j);
      b1=GetRasterBit(raster, i, squares_high-1-j);
      SetRasterBit(raster, i, j, b1);
      SetRasterBit(raster, i, squares_high-1-j, b);
      }

  changed = TRUE;

  RefillGrid(TRUE);
  RepaintRaster();
  RepaintRasterInverted();
  }  /* end of FlipV procedure */
.
1084c
    if (i==2 || i == 5 || i == 8 || i == 11 || i == 13 || i == 15)
.
1063a
  commands[17].name = "Quit";
  commands[17].proc = Quit;

.
1062a
  commands[16].name = "Write Output";
  commands[16].proc = WriteOutput;
.
1060,1061c
  commands[15].name = "Flip Vertical";
  commands[15].proc = FlipV;
.
1057,1058c
  commands[14].name = "Flip Horizontal";
  commands[14].proc = FlipH;
.
1004c
      WriteOutput(), Quit(), FlipH(), FlipV();
.
85c
#define N_COMMANDS 	18
.