home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / dirs / gifmachine_458.lzh / GIFMachine / Sources / doflip.c < prev    next >
C/C++ Source or Header  |  1991-02-15  |  1KB  |  69 lines

  1. /* Copyright 1990 by Christopher A. Wichura.
  2.    See file GIFMachine.doc for full description of rights.
  3. */
  4.  
  5. #include "GIFMachine.h"
  6.  
  7. extern struct GIFdescriptor gdesc;
  8. EXTERNBITPLANE;
  9.  
  10. extern char *AbortMsg;
  11.  
  12. void DoXFlip(void)
  13. {
  14.     register UWORD x1;
  15.     register UWORD x2;
  16.     register UWORD y;
  17.     struct RGB TempColourStore;
  18.  
  19.     MyPrintf("...Flipping image %s.\n......%s ", "horizontally", "Line");
  20.  
  21.         for (y = 0; y < gdesc.gd_Height; y++) {
  22.         MyPrintf("%5ld", y);
  23.  
  24.         for (x1 = 0, x2 = gdesc.gd_Width - 1; x1 < x2; x1++, x2--) {
  25.             TempColourStore = BitPlane[y][x1];
  26.             BitPlane[y][x1] = BitPlane[y][x2];
  27.             BitPlane[y][x2] = TempColourStore;
  28.         }
  29.  
  30.         if (SetSignal(0L, SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C) {
  31.             MyPrintf("\n%s", AbortMsg);
  32.             MyExit(ABORTEXITVAL);
  33.         }
  34.  
  35.         PutStr("\x9B" "5D");
  36.     }
  37.  
  38.     MyPrintf("\x9B" "%sDFlipped.    \n", "5");
  39. }
  40.  
  41. void DoYFlip(void)
  42. {
  43.     register UWORD y1;
  44.     register UWORD y2;
  45.     register UWORD x;
  46.     struct RGB TempColourStore;
  47.  
  48.     MyPrintf("...Flipping image %s.\n......%s ", "vertically", "Column");
  49.  
  50.         for (x = 0; x < gdesc.gd_Width; x++) {
  51.         MyPrintf("%5ld", x);
  52.  
  53.         for (y1 = 0, y2 = gdesc.gd_Height - 1; y1 < y2; y1++, y2--) {
  54.             TempColourStore = BitPlane[y1][x];
  55.             BitPlane[y1][x] = BitPlane[y2][x];
  56.             BitPlane[y2][x] = TempColourStore;
  57.         }
  58.  
  59.         if (SetSignal(0L, SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C) {
  60.             MyPrintf("\n%s", AbortMsg);
  61.             MyExit(ABORTEXITVAL);
  62.         }
  63.  
  64.         PutStr("\x9B" "5D");
  65.     }
  66.  
  67.     MyPrintf("\x9B" "%sDFlipped.    \n", "7");
  68. }
  69.