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.

71 lines
1.7 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: CPaths.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 "CPaths.h"
  14. #include <limits.h>
  15. #include <stdio.h>
  16. extern gnPaths;
  17. extern HWND g_hWndMain;
  18. CPaths::CPaths(BOOL bRegression)
  19. {
  20. strcpy(m_szName,"Paths");
  21. m_bRegression=bRegression;
  22. }
  23. CPaths::~CPaths()
  24. {
  25. }
  26. void CPaths::Draw(Graphics *g)
  27. {
  28. TestBezierPath(g);
  29. }
  30. VOID CPaths::TestBezierPath(Graphics *g)
  31. {
  32. REAL width = 4; // Pen width
  33. REAL offset;
  34. Point points[4];
  35. RectF rect;
  36. RECT crect;
  37. int i;
  38. // find avg size of testarea. 4 => top & bottom strokes of path + a white
  39. // width wide border, plus 1 => the white square in the center
  40. GetClientRect(g_hWndMain, &crect);
  41. width = (REAL)((crect.bottom - crect.top) / ((4 * gnPaths) + 1));
  42. offset = width;
  43. Color blackColor(128, 0, 0, 0);
  44. SolidBrush blackBrush(blackColor);
  45. Pen blackPen(&blackBrush, width);
  46. for(i = 1; i <= gnPaths; i++) {
  47. GraphicsPath* path = new GraphicsPath(FillModeAlternate);
  48. rect.X = offset;
  49. rect.Y = offset;
  50. rect.Width = crect.right - (2 * offset);
  51. rect.Height = crect.bottom - (2 * offset);
  52. path->AddRectangle(rect);
  53. g->DrawPath(&blackPen, path);
  54. delete path;
  55. offset += (width * 2);
  56. }
  57. }