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.

189 lines
4.2 KiB

  1. /**************************************************************************
  2. *
  3. * Copyright (c) 2000 Microsoft Corporation
  4. *
  5. * Module Name:
  6. *
  7. * <an unabbreviated name for the module (not the filename)>
  8. *
  9. * Abstract:
  10. *
  11. * <Description of what this module does>
  12. *
  13. * Notes:
  14. *
  15. * <optional>
  16. *
  17. * Created:
  18. *
  19. * 08/28/2000 asecchia
  20. * Created it.
  21. *
  22. **************************************************************************/
  23. /**************************************************************************
  24. *
  25. * Function Description:
  26. *
  27. * <Description of what the function does>
  28. *
  29. * Arguments:
  30. *
  31. * [<blank> | OUT | IN/OUT] argument-name - description of argument
  32. * ......
  33. *
  34. * Return Value:
  35. *
  36. * return-value - description of return value
  37. * or NONE
  38. *
  39. * Created:
  40. *
  41. * 08/28/2000 asecchia
  42. * Created it.
  43. *
  44. **************************************************************************/
  45. #include "CLines.hpp"
  46. #ifndef M_PI
  47. #define M_PI 3.1415926536
  48. #endif
  49. CLinesNominal::CLinesNominal(BOOL bRegression)
  50. {
  51. strcpy(m_szName,"Lines : Slope, Nominal");
  52. m_bRegression=bRegression;
  53. }
  54. void CLinesNominal::Draw(Graphics *g)
  55. {
  56. RectF rect(0, 0, TESTAREAWIDTH, TESTAREAHEIGHT);
  57. Pen pen(Color(0xff000000), 0.0f);
  58. // control the center ring size.
  59. const double center_r = 0.82;
  60. // control the total size of the object.
  61. const double scale = 0.44;
  62. // number of lines.
  63. const int n_lines = 40;
  64. for(int i = 0; i<n_lines; i++)
  65. {
  66. double angle = (double)2.0*M_PI*i/n_lines; // radians
  67. float x1 = (float)((0.5+scale*cos(angle))*rect.Width);
  68. float y1 = (float)((0.5+scale*sin(angle))*rect.Height);
  69. float x2 = (float)((0.5+scale*cos(angle+M_PI*center_r))*rect.Width);
  70. float y2 = (float)((0.5+scale*sin(angle+M_PI*center_r))*rect.Height);
  71. g->DrawLine(&pen, x1, y1, x2, y2);
  72. }
  73. }
  74. CLinesFat::CLinesFat(BOOL bRegression)
  75. {
  76. strcpy(m_szName,"Lines : Slope, 3 pixel wide");
  77. m_bRegression=bRegression;
  78. }
  79. void CLinesFat::Draw(Graphics *g)
  80. {
  81. RectF rect(0, 0, TESTAREAWIDTH, TESTAREAHEIGHT);
  82. Pen pen(Color(0xff000000), 3.0f);
  83. // control the center ring size.
  84. const double center_r = 0.82;
  85. // control the total size of the object.
  86. const double scale = 0.44;
  87. // number of lines.
  88. const int n_lines = 40;
  89. for(int i = 0; i<n_lines; i++)
  90. {
  91. double angle = (double)2.0*M_PI*i/n_lines; // radians
  92. float x1 = (float)((0.5+scale*cos(angle))*rect.Width);
  93. float y1 = (float)((0.5+scale*sin(angle))*rect.Height);
  94. float x2 = (float)((0.5+scale*cos(angle+M_PI*center_r))*rect.Width);
  95. float y2 = (float)((0.5+scale*sin(angle+M_PI*center_r))*rect.Height);
  96. g->DrawLine(&pen, x1, y1, x2, y2);
  97. }
  98. }
  99. CLinesMirrorPen::CLinesMirrorPen(BOOL bRegression)
  100. {
  101. strcpy(m_szName,"Lines : Pen, Mirror Transform");
  102. m_bRegression=bRegression;
  103. }
  104. void CLinesMirrorPen::Draw(Graphics *g)
  105. {
  106. const int endpt = 220;
  107. Matrix m;
  108. g->GetTransform(&m);
  109. GraphicsPath gp;
  110. gp.AddLine(10, 10, endpt, endpt);
  111. GraphicsPath gp2;
  112. gp2.AddLine(10, endpt, endpt, 10);
  113. Pen pen(Color(0x8f0000ff), 20);
  114. pen.SetEndCap(LineCapArrowAnchor);
  115. g->DrawPath(&pen, &gp);
  116. // Pen mirror transform.
  117. pen.ScaleTransform(1.0f, -1.0f);
  118. g->DrawPath(&pen, &gp2);
  119. // Mirror the world to device transform.
  120. g->ScaleTransform(1.0f, -1.0f);
  121. g->TranslateTransform(0.0f, (float)-endpt);
  122. pen.SetColor(0x3fff0000);
  123. g->DrawPath(&pen, &gp);
  124. // Combination pen and world to device mirror transform.
  125. pen.ScaleTransform(1.0f, -1.0f);
  126. g->DrawPath(&pen, &gp2);
  127. // Mirror the world to device transform.
  128. g->SetTransform(&m);
  129. g->ScaleTransform(-1.0f, 1.0f);
  130. g->TranslateTransform((float)-endpt, 20.0f);
  131. pen.SetColor(0x3f00ff00);
  132. g->DrawPath(&pen, &gp);
  133. // Combination pen and world to device mirror transform.
  134. pen.ScaleTransform(1.0f, -1.0f);
  135. g->DrawPath(&pen, &gp2);
  136. }