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.

113 lines
3.9 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: CBitmaps.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 "CBitmaps.h"
  14. CBitmaps::CBitmaps(BOOL bRegression)
  15. {
  16. strcpy(m_szName,"Image : Filters");
  17. m_bRegression=bRegression;
  18. }
  19. CBitmaps::~CBitmaps()
  20. {
  21. }
  22. void CBitmaps::Draw(Graphics *g)
  23. {
  24. Bitmap *bitmap = new Bitmap(L"..\\data\\3x3.bmp");
  25. PointF dest[3];
  26. for(int i=0; i<=InterpolationModeHighQualityBicubic; i++)
  27. {
  28. // for all the interpolation modes
  29. g->SetInterpolationMode((InterpolationMode)i);
  30. // simple scale
  31. dest[0].X = (float)0/1024.0f*TESTAREAWIDTH;
  32. dest[0].Y = (float)i*100.0f/768.0f*TESTAREAHEIGHT;
  33. dest[1].X = (float)100/1024.0f*TESTAREAWIDTH;
  34. dest[1].Y = (float)i*100.0f/768.0f*TESTAREAHEIGHT;
  35. dest[2].X = (float)0/1024.0f*TESTAREAWIDTH;
  36. dest[2].Y = (float)(100+i*100.0f)/768.0f*TESTAREAHEIGHT;
  37. g->DrawImage(bitmap, dest, 3, 0, 0, 3, 3, UnitPixel);
  38. // rotate 90
  39. dest[0].X = (float)200/1024.0f*TESTAREAWIDTH;
  40. dest[0].Y = (float)i*100.0f/768.0f*TESTAREAHEIGHT;
  41. dest[1].X = (float)200/1024.0f*TESTAREAWIDTH;
  42. dest[1].Y = (float)(100+i*100.0f)/768.0f*TESTAREAHEIGHT;
  43. dest[2].X = (float)100/1024.0f*TESTAREAWIDTH;
  44. dest[2].Y = (float)i*100.0f/768.0f*TESTAREAHEIGHT;
  45. g->DrawImage(bitmap, dest, 3, 0, 0, 3, 3, UnitPixel);
  46. // rotate 180
  47. dest[0].X = (float)300/1024.0f*TESTAREAWIDTH;
  48. dest[0].Y = (float)(100+i*100.0f)/768.0f*TESTAREAHEIGHT;
  49. dest[1].X = (float)200/1024.0f*TESTAREAWIDTH;
  50. dest[1].Y = (float)(100+i*100.0f)/768.0f*TESTAREAHEIGHT;
  51. dest[2].X = (float)300/1024.0f*TESTAREAWIDTH;
  52. dest[2].Y = (float)i*100.0f/768.0f*TESTAREAHEIGHT;
  53. g->DrawImage(bitmap, dest, 3, 0, 0, 3, 3, UnitPixel);
  54. // rotate 270
  55. dest[0].X = (float)300/1024.0f*TESTAREAWIDTH;
  56. dest[0].Y = (float)(100+i*100.0f)/768.0f*TESTAREAHEIGHT;
  57. dest[1].X = (float)300/1024.0f*TESTAREAWIDTH;
  58. dest[1].Y = (float)i*100.0f/768.0f*TESTAREAHEIGHT;
  59. dest[2].X = (float)400/1024.0f*TESTAREAWIDTH;
  60. dest[2].Y = (float)(100+i*100.0f)/768.0f*TESTAREAHEIGHT;
  61. g->DrawImage(bitmap, dest, 3, 0, 0, 3, 3, UnitPixel);
  62. }
  63. delete bitmap;
  64. WCHAR *filename = L"..\\data\\winnt256.bmp";
  65. bitmap = new Bitmap(filename);
  66. dest[0].X = (int)(300.0f/450.0f*TESTAREAWIDTH);
  67. dest[0].Y = (int)(50.0f/450.0f*TESTAREAHEIGHT);
  68. dest[1].X = (int)(450.0f/450.0f*TESTAREAWIDTH);
  69. dest[1].Y = (int)(50.0f/450.0f*TESTAREAHEIGHT);
  70. dest[2].X = (int)(240.0f/450.0f*TESTAREAWIDTH);
  71. dest[2].Y = (int)(200.0f/450.0f*TESTAREAHEIGHT);
  72. g->DrawImage(bitmap, &dest[0], 3);
  73. Image *imageThumb = bitmap->GetThumbnailImage(32, 32);
  74. RectF thumbRect(
  75. (int)(220.0f/450.0f*TESTAREAWIDTH),
  76. (int)(50.0f/450.0f*TESTAREAHEIGHT),
  77. (REAL) imageThumb->GetWidth(),
  78. (REAL) imageThumb->GetHeight()
  79. );
  80. g->DrawImage(imageThumb, thumbRect);
  81. delete imageThumb;
  82. g->SetInterpolationMode(InterpolationModeHighQualityBicubic);
  83. dest[0].X = (int)(300.0f/450.0f*TESTAREAWIDTH);
  84. dest[0].Y = (int)(250.0f/450.0f*TESTAREAHEIGHT);
  85. dest[1].X = (int)(450.0f/450.0f*TESTAREAWIDTH);
  86. dest[1].Y = (int)(250.0f/450.0f*TESTAREAHEIGHT);
  87. dest[2].X = (int)(300.0f/450.0f*TESTAREAWIDTH);
  88. dest[2].Y = (int)(400.0f/450.0f*TESTAREAHEIGHT);
  89. g->DrawImage(bitmap, &dest[0], 3);
  90. delete bitmap;
  91. }