home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d541 / gifmachine.lha / GIFMachine / Sources / doflip.c < prev    next >
C/C++ Source or Header  |  1991-09-17  |  2KB  |  75 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. extern BOOL DisplayCounts;
  13.  
  14. void DoXFlip(void)
  15. {
  16.     register UWORD x1;
  17.     register UWORD x2;
  18.     register UWORD y;
  19.     struct RGB TempColourStore;
  20.  
  21.     MyPrintf("...Flipping image %s.\n......%s ", "horizontally", (DisplayCounts ? "Line" : "Working\x1B[1D"));
  22.  
  23.         for (y = 0; y < gdesc.gd_Height; y++) {
  24.         if (DisplayCounts)
  25.             MyPrintf("%5ld", y);
  26.  
  27.         for (x1 = 0, x2 = gdesc.gd_Width - 1; x1 < x2; x1++, x2--) {
  28.             TempColourStore = BitPlane[y][x1];
  29.             BitPlane[y][x1] = BitPlane[y][x2];
  30.             BitPlane[y][x2] = TempColourStore;
  31.         }
  32.  
  33.         if (SetSignal(0L, SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C) {
  34.             MyPrintf("\n%s", AbortMsg);
  35.             MyExit(ABORTEXITVAL);
  36.         }
  37.  
  38.         if (DisplayCounts)
  39.             PutStr("\x1B[5D");
  40.     }
  41.  
  42.     MyPrintf("\x1B[%ldDFlipped.    \n", (DisplayCounts ? 5 : 7));
  43. }
  44.  
  45. void DoYFlip(void)
  46. {
  47.     register UWORD y1;
  48.     register UWORD y2;
  49.     register UWORD x;
  50.     struct RGB TempColourStore;
  51.  
  52.     MyPrintf("...Flipping image %s.\n......%s ", "vertically", (DisplayCounts ? "Column" : "Working\x1B[1D"));
  53.  
  54.         for (x = 0; x < gdesc.gd_Width; x++) {
  55.         if (DisplayCounts)
  56.             MyPrintf("%5ld", x);
  57.  
  58.         for (y1 = 0, y2 = gdesc.gd_Height - 1; y1 < y2; y1++, y2--) {
  59.             TempColourStore = BitPlane[y1][x];
  60.             BitPlane[y1][x] = BitPlane[y2][x];
  61.             BitPlane[y2][x] = TempColourStore;
  62.         }
  63.  
  64.         if (SetSignal(0L, SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C) {
  65.             MyPrintf("\n%s", AbortMsg);
  66.             MyExit(ABORTEXITVAL);
  67.         }
  68.  
  69.         if (DisplayCounts)
  70.             PutStr("\x1B[5D");
  71.     }
  72.  
  73.     MyPrintf("\x1B[%ldDFlipped.    \n", 7);
  74. }
  75.