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.

95 lines
2.8 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: CCompoundLines.cpp
  3. *
  4. * This file contains the code to support the functionality test harness
  5. * for GDI+. This includes menu options and calling the appropriate
  6. * functions for execution.
  7. *
  8. * Created: 05-May-2000 - Jeff Vezina [t-jfvez]
  9. *
  10. * Copyright (c) 2000 Microsoft Corporation
  11. *
  12. \**************************************************************************/
  13. #include "CCompoundLines.h"
  14. CCompoundLines::CCompoundLines(BOOL bRegression)
  15. {
  16. strcpy(m_szName,"Lines : Compound");
  17. m_bRegression=bRegression;
  18. }
  19. CCompoundLines::~CCompoundLines()
  20. {
  21. }
  22. void CCompoundLines::Draw(Graphics *g)
  23. {
  24. REAL width = 4; // Pen width
  25. PointF points[4];
  26. points[0].X = 100.0f/280.0f*TESTAREAWIDTH;
  27. points[0].Y = 50.0f/280.0f*TESTAREAHEIGHT;
  28. points[1].X = -50.0f/280.0f*TESTAREAWIDTH;
  29. points[1].Y = 190.0f/280.0f*TESTAREAHEIGHT;
  30. points[2].X = 150.0f/280.0f*TESTAREAWIDTH;
  31. points[2].Y = 320.0f/280.0f*TESTAREAHEIGHT;
  32. points[3].X = 200.0f/280.0f*TESTAREAWIDTH;
  33. points[3].Y = 110.0f/280.0f*TESTAREAHEIGHT;
  34. Color yellowColor(128, 255, 255, 0);
  35. SolidBrush yellowBrush(yellowColor);
  36. GraphicsPath* path = new GraphicsPath(FillModeAlternate);
  37. path->AddBeziers(points, 4);
  38. points[0].X = 260.0f/280.0f*TESTAREAWIDTH;
  39. points[0].Y = 20.0f/280.0f*TESTAREAHEIGHT;
  40. path->AddLines(points, 1);
  41. Matrix matrix;
  42. // matrix.Scale(1.25, 1.25);
  43. // matrix.Translate(30.0f/1024.0f*TESTAREAWIDTH, 30.0f/768.0f*TESTAREAHEIGHT);
  44. // If you wanto to flatten the path before rendering,
  45. // Flatten() can be called.
  46. BOOL flattenFirst = FALSE;
  47. if(!flattenFirst)
  48. {
  49. // Don't flatten and keep the original path.
  50. // FillPath or DrawPath will flatten the path automatically
  51. // without modifying the original path.
  52. path->Transform(&matrix);
  53. }
  54. else
  55. {
  56. // Flatten this path. The resultant path is made of line
  57. // segments. The original path information is lost.
  58. path->Flatten(&matrix);
  59. }
  60. Color blackColor(0, 0, 0);
  61. SolidBrush blackBrush(blackColor);
  62. width = 3;
  63. Pen blackPen(&blackBrush, width);
  64. REAL* compoundArray = new REAL[6];
  65. compoundArray[0] = 0.0f;
  66. compoundArray[1] = 0.2f;
  67. compoundArray[2] = 0.4f;
  68. compoundArray[3] = 0.6f;
  69. compoundArray[4] = 0.8f;
  70. compoundArray[5] = 1.0f;
  71. blackPen.SetCompoundArray(&compoundArray[0], 6);
  72. blackPen.SetDashStyle(DashStyleDash);
  73. blackPen.SetStartCap(LineCapDiamondAnchor);
  74. blackPen.SetEndCap(LineCapArrowAnchor);
  75. g->FillPath(&yellowBrush, path);
  76. g->DrawPath(&blackPen, path);
  77. delete path;
  78. }