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.

73 lines
2.2 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: CContainerClip.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 "CContainerClip.h"
  14. CContainerClip::CContainerClip(BOOL bRegression)
  15. {
  16. strcpy(m_szName,"ContainerClip");
  17. m_bRegression=bRegression;
  18. }
  19. CContainerClip::~CContainerClip()
  20. {
  21. }
  22. void CContainerClip::Draw(Graphics *g)
  23. {
  24. ARGB colors[5];
  25. colors[0] = Color::MakeARGB(255, 255, 0, 0);
  26. colors[1] = Color::MakeARGB(255, 0, 255, 0);
  27. colors[2] = Color::MakeARGB(255, 0, 0, 255);
  28. colors[3] = Color::MakeARGB(255, 255, 255, 0);
  29. colors[4] = Color::MakeARGB(255, 0, 255, 255);
  30. GraphicsState s = g->Save();
  31. DrawContainer(g, colors, 5);
  32. g->Restore(s);
  33. }
  34. VOID CContainerClip::DrawContainer(Graphics * g, ARGB * argb, INT count)
  35. {
  36. Matrix mymatrix;
  37. int nX;
  38. int nY;
  39. g->SetPageUnit(UnitPixel);
  40. g->GetTransform(&mymatrix);
  41. nX=(int)mymatrix.OffsetX();
  42. nY=(int)mymatrix.OffsetY();
  43. Rect clipRect(0,0,(int)TESTAREAWIDTH, (int)TESTAREAHEIGHT);
  44. g->SetClip(clipRect);
  45. mymatrix.Translate((int)(TESTAREAWIDTH/2.0f), (int)(TESTAREAHEIGHT/2.0f));
  46. mymatrix.Rotate(15);
  47. mymatrix.Translate(-(int)(TESTAREAWIDTH/2.0f), -(int)(TESTAREAHEIGHT/2.0f));
  48. g->SetTransform(&mymatrix);
  49. Color color(*argb++);
  50. SolidBrush contBrush(color);
  51. g->FillRectangle(&contBrush, 0, 0, (int)TESTAREAWIDTH, (int)TESTAREAHEIGHT);
  52. if (--count == 0)
  53. {
  54. return;
  55. }
  56. RectF destRect((int)(TESTAREAWIDTH/10.0f), (int)(TESTAREAHEIGHT/10.0f), (int)(TESTAREAWIDTH/1.25f), (int)(TESTAREAHEIGHT/1.25f));
  57. RectF srcRect(0, 0, (int)TESTAREAWIDTH, (int)TESTAREAHEIGHT);
  58. INT id = g->BeginContainer(destRect, srcRect, UnitPixel);
  59. g->ResetClip();
  60. DrawContainer (g, argb, count);
  61. g->EndContainer(id);
  62. }