home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / server / ddx / mi / mizerarc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-12  |  2.3 KB  |  113 lines

  1. /************************************************************
  2. Copyright 1989 by The Massachusetts Institute of Technology
  3.  
  4. Permission to use, copy, modify, and distribute this
  5. software and its documentation for any purpose and without
  6. fee is hereby granted, provided that the above copyright
  7. notice appear in all copies and that both that copyright
  8. notice and this permission notice appear in supporting
  9. documentation, and that the name of MIT not be used in
  10. advertising or publicity pertaining to distribution of the
  11. software without specific prior written permission.
  12. M.I.T. makes no representation about the suitability of
  13. this software for any purpose. It is provided "as is"
  14. without any express or implied warranty.
  15.  
  16. ********************************************************/
  17.  
  18. /* $XConsortium: mizerarc.h,v 5.10 91/06/13 09:42:11 rws Exp $ */
  19.  
  20. typedef struct {
  21.     int x;
  22.     int y;
  23.     int mask;
  24. } miZeroArcPtRec;
  25.  
  26. typedef struct {
  27.     int x, y, k1, k3, a, b, d, dx, dy;
  28.     int alpha, beta;
  29.     int xorg, yorg;
  30.     int xorgo, yorgo;
  31.     int w, h;
  32.     int initialMask;
  33.     miZeroArcPtRec start, altstart, end, altend;
  34.     int firstx, firsty;
  35.     int startAngle, endAngle;
  36. } miZeroArcRec;
  37.  
  38. #define miCanZeroArc(arc) (((arc)->width == (arc)->height) || \
  39.                (((arc)->width <= 800) && ((arc)->height <= 800)))
  40.  
  41. extern Bool miZeroArcSetup();
  42.  
  43. #define MIARCSETUP() \
  44.     x = info.x; \
  45.     y = info.y; \
  46.     k1 = info.k1; \
  47.     k3 = info.k3; \
  48.     a = info.a; \
  49.     b = info.b; \
  50.     d = info.d; \
  51.     dx = info.dx; \
  52.     dy = info.dy
  53.  
  54. #define MIARCOCTANTSHIFT(clause) \
  55.     if (a < 0) \
  56.     { \
  57.     if (y == info.h) \
  58.     { \
  59.         d = -1; \
  60.         a = b = k1 = 0; \
  61.     } \
  62.     else \
  63.     { \
  64.         dx = (k1 << 1) - k3; \
  65.         k1 = dx - k1; \
  66.         k3 = -k3; \
  67.         b = b + a - (k1 >> 1); \
  68.         d = b + ((-a) >> 1) - d + (k3 >> 3); \
  69.         if (dx < 0) \
  70.         a = -((-dx) >> 1) - a; \
  71.         else \
  72.         a = (dx >> 1) - a; \
  73.         dx = 0; \
  74.         dy = 1; \
  75.         clause \
  76.     } \
  77.     }
  78.  
  79. #define MIARCSTEP(move1,move2) \
  80.     b -= k1; \
  81.     if (d < 0) \
  82.     { \
  83.     x += dx; \
  84.     y += dy; \
  85.     a += k1; \
  86.     d += b; \
  87.     move1 \
  88.     } \
  89.     else \
  90.     { \
  91.     x++; \
  92.     y++; \
  93.     a += k3; \
  94.     d -= a; \
  95.     move2 \
  96.     }
  97.  
  98. #define MIARCCIRCLESTEP(clause) \
  99.     b -= k1; \
  100.     x++; \
  101.     if (d < 0) \
  102.     { \
  103.     a += k1; \
  104.     d += b; \
  105.     } \
  106.     else \
  107.     { \
  108.     y++; \
  109.     a += k3; \
  110.     d -= a; \
  111.     clause \
  112.     }
  113.