mizerarc.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /************************************************************
  2. Copyright 1989, 1998 The Open Group
  3. Permission to use, copy, modify, distribute, and sell this software and its
  4. documentation for any purpose is hereby granted without fee, provided that
  5. the above copyright notice appear in all copies and that both that
  6. copyright notice and this permission notice appear in supporting
  7. documentation.
  8. The above copyright notice and this permission notice shall be included in
  9. all copies or substantial portions of the Software.
  10. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13. OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  14. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  15. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  16. Except as contained in this notice, the name of The Open Group shall not be
  17. used in advertising or otherwise to promote the sale, use or other dealings
  18. in this Software without prior written authorization from The Open Group.
  19. ********************************************************/
  20. typedef struct {
  21. int x;
  22. int y;
  23. int mask;
  24. } miZeroArcPtRec;
  25. typedef struct {
  26. int x, y, k1, k3, a, b, d, dx, dy;
  27. int alpha, beta;
  28. int xorg, yorg;
  29. int xorgo, yorgo;
  30. int w, h;
  31. int initialMask;
  32. miZeroArcPtRec start, altstart, end, altend;
  33. int firstx, firsty;
  34. int startAngle, endAngle;
  35. } miZeroArcRec;
  36. #define miCanZeroArc(arc) (((arc)->width == (arc)->height) || \
  37. (((arc)->width <= 800) && ((arc)->height <= 800)))
  38. #define MIARCSETUP() \
  39. x = info.x; \
  40. y = info.y; \
  41. k1 = info.k1; \
  42. k3 = info.k3; \
  43. a = info.a; \
  44. b = info.b; \
  45. d = info.d; \
  46. dx = info.dx; \
  47. dy = info.dy
  48. #define MIARCOCTANTSHIFT(clause) \
  49. if (a < 0) \
  50. { \
  51. if (y == info.h) \
  52. { \
  53. d = -1; \
  54. a = b = k1 = 0; \
  55. } \
  56. else \
  57. { \
  58. dx = (k1 << 1) - k3; \
  59. k1 = dx - k1; \
  60. k3 = -k3; \
  61. b = b + a - (k1 >> 1); \
  62. d = b + ((-a) >> 1) - d + (k3 >> 3); \
  63. if (dx < 0) \
  64. a = -((-dx) >> 1) - a; \
  65. else \
  66. a = (dx >> 1) - a; \
  67. dx = 0; \
  68. dy = 1; \
  69. clause \
  70. } \
  71. }
  72. #define MIARCSTEP(move1,move2) \
  73. b -= k1; \
  74. if (d < 0) \
  75. { \
  76. x += dx; \
  77. y += dy; \
  78. a += k1; \
  79. d += b; \
  80. move1 \
  81. } \
  82. else \
  83. { \
  84. x++; \
  85. y++; \
  86. a += k3; \
  87. d -= a; \
  88. move2 \
  89. }
  90. #define MIARCCIRCLESTEP(clause) \
  91. b -= k1; \
  92. x++; \
  93. if (d < 0) \
  94. { \
  95. a += k1; \
  96. d += b; \
  97. } \
  98. else \
  99. { \
  100. y++; \
  101. a += k3; \
  102. d -= a; \
  103. clause \
  104. }
  105. /* mizerarc.c */
  106. extern Bool miZeroArcSetup(
  107. xArc * /*arc*/,
  108. miZeroArcRec * /*info*/,
  109. Bool /*ok360*/
  110. );
  111. extern DDXPointPtr miZeroArcPts(
  112. xArc * /*arc*/,
  113. DDXPointPtr /*pts*/
  114. );