Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
2.9 KiB

  1. /**************************************************************************\
  2. *
  3. * Copyright (c) 1999 Microsoft Corporation
  4. *
  5. * Abstract:
  6. *
  7. * Quad Transforms
  8. *
  9. * History:
  10. *
  11. * 03/17/1999 ikkof
  12. * Created it.
  13. *
  14. \**************************************************************************/
  15. #ifndef _QUADTRAMSFOPRMS_HPP
  16. #define _QUADTRAMSFOPRMS_HPP
  17. //#define TEST_QUADTRANSFORMS
  18. class GpXPoints;
  19. class GpQuadAnalyzer
  20. {
  21. public:
  22. GpQuadAnalyzer() {Initialize();}
  23. VOID SetQuadAnalyzer(const GpPointF* points);
  24. INT GetXSpans(REAL* xSpans, REAL y);
  25. protected:
  26. VOID Initialize()
  27. {
  28. Top = Bottom = Left = Right = 0;
  29. GpMemset(&Y1[0], 0, 4*sizeof(REAL));
  30. GpMemset(&Y2[0], 0, 4*sizeof(REAL));
  31. GpMemset(&Directions[0], 0, 4);
  32. GpMemset(&DxDy[0], 0, 4*sizeof(REAL));
  33. }
  34. protected:
  35. REAL Top;
  36. REAL Bottom;
  37. REAL Left;
  38. REAL Right;
  39. REAL Y1[4];
  40. REAL Y2[4];
  41. BYTE Directions[4];
  42. REAL X1[4];
  43. REAL DxDy[4];
  44. };
  45. class GpBilinearTransform
  46. {
  47. protected:
  48. GpRectF SrcRect;
  49. GpRectF DstBounds;
  50. GpPointF A;
  51. GpPointF B;
  52. GpPointF C;
  53. GpPointF D;
  54. REAL C_VV;
  55. REAL C_V;
  56. GpQuadAnalyzer QAnalyzer;
  57. REAL FixedValue; // Set to positive number if this transform
  58. // represents a single fixed value over its
  59. // entire area.
  60. #ifdef TEST_QUADTRANSFORMS
  61. // For testing purpose only.
  62. GpPointF Verteces[4];
  63. #endif
  64. public:
  65. GpBilinearTransform() {Initialize();}
  66. GpBilinearTransform(const GpRectF& rect, const GpPointF* points, INT count)
  67. {
  68. Initialize();
  69. SetBilinearTransform(rect, points, count);
  70. }
  71. GpStatus ConvertLines(const GpPointF* points, INT count, GpPointF* q);
  72. GpStatus ConvertLines(const GpPointF* points, INT count, REALD* data);
  73. GpStatus ConvertCubicBeziers(const GpPointF* srcQ, INT count, GpPointF* q);
  74. GpStatus ConvertCubicBeziers(const GpPointF* srcQ, INT count, REALD* data);
  75. GpStatus SetBilinearTransform(const GpRectF& rect, const GpPointF* points, INT count, REAL fixed=-1.0f);
  76. INT GetSourceParameterArrays(
  77. REAL* u,
  78. REAL* v,
  79. INT* xSpans,
  80. INT y,
  81. INT xmin,
  82. INT xmax
  83. );
  84. protected:
  85. VOID Initialize();
  86. INT GetXSpans(INT* xSpans, INT y, INT xmin, INT xmax);
  87. BOOL GetSourceParameter(REAL* u, REAL* v, const GpPointF& point);
  88. };
  89. class GpPerspectiveTransform
  90. {
  91. protected:
  92. GpRectF SrcRect;
  93. GpRectF DstBounds;
  94. REAL M00, M01, M02;
  95. REAL M10, M11, M12;
  96. REAL M20, M21, M22;
  97. public:
  98. GpPerspectiveTransform(const GpRectF& rect, const GpPointF* points, INT count);
  99. GpStatus ConvertPoints(const GpPointF* points, INT count, GpPoint3F* q);
  100. GpStatus ConvertPoints(const GpPointF* points, INT count, GpXPoints* xpoints);
  101. };
  102. #endif