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.

768 lines
19 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: drawimage.cpp
  3. *
  4. * Created: 23 December 1999
  5. * Author: Adrian Secchia [asecchia]
  6. *
  7. * Copyright (c) 1999,Microsoft Corporation
  8. *
  9. * This is the DrawImage unit test.
  10. *
  11. \**************************************************************************/
  12. #include <windows.h>
  13. #include <objbase.h>
  14. #include <math.h> // sin & cos
  15. // Define away IStream
  16. #define IStream int
  17. #include <gdiplus.h>
  18. #include <stdlib.h>
  19. #include <stdio.h>
  20. #include <tchar.h>
  21. #include "drawimage.hpp"
  22. #include "wndstuff.h"
  23. using namespace Gdiplus;
  24. #define USE_NEW_APIS 1
  25. #define USE_NEW_APIS2 1
  26. ImageAttributes *Img = NULL;
  27. /***************************************************************************\
  28. * DrawXXXX
  29. *
  30. * These routines are all the individual tests that this test
  31. * suite will use.
  32. \***************************************************************************/
  33. // No fancy stuff - just put the whole image in the window.
  34. // No rotation, stretching, etc.
  35. #if 0
  36. // cached bitmap in animated infinite loop
  37. VOID DrawSimple(Graphics *g)
  38. {
  39. unsigned short filename[1024];
  40. CachedBitmap *frame[32];
  41. Bitmap *temp;
  42. Graphics *gbmp;
  43. Unit u;
  44. RectF r;
  45. for(int i=0; i<32; i++) {
  46. wsprintf(filename, L"T%d.bmp", i);
  47. temp = new Bitmap(filename);
  48. temp->GetBounds(&r, &u);
  49. // r.Width *=2;
  50. // r.Height *=2;
  51. frame[i] = new CachedBitmap(temp, g);
  52. // gbmp = new Graphics(frame[i]);
  53. // gbmp->SetInterpolationMode(InterpolationModeHighQualityBilinear);
  54. /* Matrix *m = new Matrix(1.0f, 0.0f,
  55. 0.0f, -1.0f,
  56. 0.0f, r.Height);
  57. gbmp->SetTransform(m);
  58. */
  59. // gbmp->DrawImage(temp, 0, 0, (INT)r.Width, (INT)r.Height);
  60. // delete gbmp;
  61. delete temp;
  62. // delete m;
  63. }
  64. RectF s = r;
  65. i = 0;
  66. int j;
  67. while(++i) {
  68. // for(j=0; j<3; j++)
  69. // g->DrawImage(frame[i % 32], s, r.X, r.Y, r.Width, r.Height, UnitPixel);
  70. g->DrawCachedBitmap(frame[i % 32], 10, 10);
  71. }
  72. }
  73. #endif
  74. VOID DrawSimple(Graphics *g)
  75. {
  76. Bitmap *image = new Bitmap(FileName);
  77. Unit u;
  78. RectF r;
  79. image->GetBounds(&r, &u);
  80. RectF s = r;
  81. s.X = 31;
  82. s.Y = 27;
  83. s.Width *= 0.7f;
  84. s.Height *= 0.7f;
  85. g->DrawImage(image, s, r.X, r.Y, r.Width, r.Height, UnitPixel);
  86. g->SetClip(Rect(50, 70, 100, 10));
  87. ImageAttributes img;
  88. ColorMatrix flipRedBlue = {
  89. 0, 1, 0, 0, 0,
  90. 0, 0, 1, 0, 0,
  91. 1, 0, 0, 0, 0,
  92. 0, 0, 0, 1, 0,
  93. 0, 0, 0, 0, 1
  94. };
  95. img.SetColorMatrix(&flipRedBlue);
  96. g->DrawImage(image, s, r.X, r.Y, r.Width, r.Height, UnitPixel, &img);
  97. g->ResetClip();
  98. delete image;
  99. }
  100. VOID DrawSpecialRotate(Graphics *g)
  101. {
  102. Bitmap *image = new Bitmap(FileName);
  103. Unit u;
  104. RectF r;
  105. image->GetBounds(&r, &u);
  106. RectF s = r;
  107. ImageAttributes img;
  108. ColorMatrix flipRedBlue = {
  109. 0, 1, 0, 0, 0,
  110. 1, 0, 0, 0, 0,
  111. 0, 0, 1, 0, 0,
  112. 0, 0, 0, 1, 0,
  113. 0, 0, 0, 0, 1
  114. };
  115. img.SetColorMatrix(&flipRedBlue);
  116. g->SetCompositingQuality(CompositingQualityGammaCorrected);
  117. Rect dstRect(0, 0, 50, 100);
  118. Rect srcRect(12, -14, 50, 100);
  119. g->TranslateTransform(s.Height, 0.0f);
  120. g->RotateTransform(90);
  121. g->DrawImage(image, s, r.X, r.Y, r.Width, r.Height, UnitPixel, Img);
  122. g->ResetTransform();
  123. g->TranslateTransform(s.Height, s.Width);
  124. g->RotateTransform(270);
  125. g->DrawImage(image, s, r.X, r.Y, r.Width, r.Height, UnitPixel, Img);
  126. g->ResetTransform();
  127. g->TranslateTransform(s.Width, s.Height+s.Width);
  128. g->RotateTransform(180);
  129. g->DrawImage(image, s, r.X, r.Y, r.Width, r.Height, UnitPixel, Img);
  130. g->ResetTransform();
  131. g->TranslateTransform(s.Width+2*s.Height, 0.0f);
  132. g->ScaleTransform(-1.0, 1.0);
  133. g->DrawImage(image, s, r.X, r.Y, r.Width, r.Height, UnitPixel, Img);
  134. g->ResetTransform();
  135. g->TranslateTransform(2*s.Height, s.Height*2);
  136. g->ScaleTransform(1.0, -1.0);
  137. g->DrawImage(image, s, r.X, r.Y, r.Width, r.Height, UnitPixel, Img);
  138. g->ResetTransform();
  139. g->TranslateTransform(s.Width+2*s.Height, 0.0f);
  140. g->ScaleTransform(-1.0, 1.0);
  141. g->RotateTransform(90);
  142. g->DrawImage(image, s, r.X, r.Y, r.Width, r.Height, UnitPixel, Img);
  143. g->ResetTransform();
  144. g->TranslateTransform(s.Width+3*s.Height, 2*s.Width);
  145. g->ScaleTransform(-1.0, 1.0);
  146. g->RotateTransform(270);
  147. g->DrawImage(image, s, r.X, r.Y, r.Width, r.Height, UnitPixel, Img);
  148. g->ResetTransform();
  149. //Rot180
  150. g->TranslateTransform(400.0f, 500.0f);
  151. g->RotateTransform(180);
  152. g->DrawImage(image, dstRect,srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height+1, UnitPixel, &img);
  153. g->ResetTransform();
  154. g->TranslateTransform(400.0f, 500.0f);
  155. g->RotateTransform(180);
  156. g->DrawImage(image, dstRect,srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, UnitPixel);
  157. g->ResetTransform();
  158. //ID
  159. g->TranslateTransform(400.0f, 500.0f);
  160. g->RotateTransform(0);
  161. g->DrawImage(image, dstRect,srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height+1, UnitPixel, &img);
  162. g->ResetTransform();
  163. g->TranslateTransform(400.0f, 500.0f);
  164. g->RotateTransform(0);
  165. g->DrawImage(image, dstRect,srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, UnitPixel);
  166. g->ResetTransform();
  167. //Rot270FlipX
  168. g->TranslateTransform(600.0f, 500.0f);
  169. g->ScaleTransform(-1.0f, 1.0f);
  170. g->RotateTransform(270);
  171. g->DrawImage(image, dstRect,srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height+1, UnitPixel, &img);
  172. g->ResetTransform();
  173. g->TranslateTransform(600.0f, 500.0f);
  174. g->ScaleTransform(-1.0f, 1.0f);
  175. g->RotateTransform(270);
  176. g->DrawImage(image, dstRect,srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, UnitPixel);
  177. g->ResetTransform();
  178. //Rot270
  179. g->TranslateTransform(600.0f, 500.0f);
  180. g->RotateTransform(270);
  181. g->DrawImage(image, dstRect,srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height+1, UnitPixel, &img);
  182. g->ResetTransform();
  183. g->TranslateTransform(600.0f, 500.0f);
  184. g->RotateTransform(270);
  185. g->DrawImage(image, dstRect,srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, UnitPixel);
  186. g->ResetTransform();
  187. //Rot90FlipX
  188. g->TranslateTransform(600.0f, 500.0f);
  189. g->ScaleTransform(-1.0f, 1.0f);
  190. g->RotateTransform(90);
  191. g->DrawImage(image, dstRect,srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height+1, UnitPixel, &img);
  192. g->ResetTransform();
  193. g->TranslateTransform(600.0f, 500.0f);
  194. g->ScaleTransform(-1.0f, 1.0f);
  195. g->RotateTransform(90);
  196. g->DrawImage(image, dstRect,srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, UnitPixel);
  197. g->ResetTransform();
  198. //Rot90
  199. g->TranslateTransform(600.0f, 500.0f);
  200. g->RotateTransform(90);
  201. g->DrawImage(image, dstRect,srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height+1, UnitPixel, &img);
  202. g->ResetTransform();
  203. g->TranslateTransform(600.0f, 500.0f);
  204. g->RotateTransform(90);
  205. g->DrawImage(image, dstRect,srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, UnitPixel);
  206. g->ResetTransform();
  207. // FlipX
  208. g->TranslateTransform(600.0f, 300.0f);
  209. g->ScaleTransform(-1.0f, 1.0f);
  210. g->DrawImage(image, dstRect,srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height+1, UnitPixel, &img);
  211. g->ResetTransform();
  212. g->TranslateTransform(600.0f, 300.0f);
  213. g->ScaleTransform(-1.0f, 1.0f);
  214. g->DrawImage(image, dstRect,srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, UnitPixel);
  215. g->ResetTransform();
  216. // FlipY
  217. g->TranslateTransform(600.0f, 300.0f);
  218. g->ScaleTransform(1.0f, -1.0f);
  219. g->DrawImage(image, dstRect,srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height+1, UnitPixel, &img);
  220. g->ResetTransform();
  221. g->TranslateTransform(600.0f, 300.0f);
  222. g->ScaleTransform(1.0f, -1.0f);
  223. g->DrawImage(image, dstRect,srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, UnitPixel);
  224. g->ResetTransform();
  225. delete image;
  226. }
  227. VOID DrawCachedBitmap(Graphics *g)
  228. {
  229. Bitmap *image = new Bitmap(FileName);
  230. Bitmap *bmp = new Bitmap(100, 100, PixelFormat32bppPARGB);
  231. Graphics *gfx = new Graphics(bmp);
  232. gfx->DrawImage(image, Rect(0,0,100,100), 0,0,100,100, UnitPixel);
  233. gfx->SetCompositingMode(CompositingModeSourceCopy);
  234. SolidBrush brush(Color(0x7f0000ff));
  235. gfx->FillEllipse(&brush, 0, 0, 100, 100);
  236. brush.SetColor(Color(0x00000000));
  237. gfx->FillEllipse(&brush, 25, 25, 50, 50);
  238. delete image;
  239. delete gfx;
  240. CachedBitmap *cb = new CachedBitmap(bmp, g);
  241. int x;
  242. for(int i=0; i<=40; i++)
  243. {
  244. x = i-20;
  245. g->DrawCachedBitmap(cb, x*x, i*10);
  246. }
  247. delete cb;
  248. delete bmp;
  249. }
  250. // Slightly rotated stretch.
  251. VOID DrawStretchRotation(Graphics *g)
  252. {
  253. Image *image = new Bitmap(FileName);
  254. PointF dst[4];
  255. dst[0].X = 20;
  256. dst[0].Y = 0;
  257. dst[1].X = 900;
  258. dst[1].Y = 20;
  259. dst[2].X = 0;
  260. dst[2].Y = 700;
  261. g->DrawImage(image, dst, 3);
  262. delete image;
  263. }
  264. // Slightly rotated stretch.
  265. VOID DrawShrinkRotation(Graphics *g)
  266. {
  267. Image *image = new Bitmap(FileName);
  268. PointF dst[4];
  269. dst[0].X = 14.1521f;
  270. dst[0].Y = 11.0205f;
  271. dst[1].X = 25.4597f;
  272. dst[1].Y = 10.5023f;
  273. dst[2].X = 14.5403f;
  274. dst[2].Y = 19.4908f;
  275. g->DrawImage(image, dst, 3);
  276. delete image;
  277. }
  278. // Rotated stretch with source cropping.
  279. VOID DrawCropRotation(Graphics *g)
  280. {
  281. Image *image = new Bitmap(FileName);
  282. PointF dst[4];
  283. dst[0].X = 20;
  284. dst[0].Y = 0;
  285. dst[1].X = 180;
  286. dst[1].Y = 20;
  287. dst[2].X = 0;
  288. dst[2].Y = 140;
  289. g->DrawImage(image, dst, 3, 0, 0, 488, 400, UnitPixel);
  290. delete image;
  291. }
  292. // Draw multiple copybits with different source cropping and
  293. // destination positions.
  294. // Little squares are drawn in reverse order from their source position and
  295. // only alternate squares from a checkerboard pattern are drawn.
  296. // Note outcropping can occur along the bottom and right edge of the source -
  297. // which would be the top and left row of squares in the output.
  298. VOID DrawCopyCrop(Graphics *g)
  299. {
  300. Image *image = new Bitmap(FileName);
  301. const INT xs = 10;
  302. const INT ys = 6;
  303. const INT step = 50;
  304. Rect s(0,0,step,step);
  305. for(int i=0; i<xs; i++) for(int j=0; j<ys; j++) {
  306. if(((i+j) & 0x1)==0x1) {
  307. s.X = i*step-15;
  308. s.Y = j*step-15;
  309. g->DrawImage(image, s,
  310. (xs-i-1)*step, (ys-j-1)*step, step, step, UnitPixel);
  311. }
  312. }
  313. delete image;
  314. }
  315. // Pixel centering test. This test should show
  316. // the correct pixel centering. The top left should be green and the bottom
  317. // and right should be blending in the blend color
  318. VOID DrawPixelCenter(Graphics *g)
  319. {
  320. WCHAR *filename = L"../data/3x3.bmp";
  321. Image *image = new Bitmap(filename);
  322. Color black(0xff,0,0,0);
  323. Pen linepen(black, 1);
  324. RectF r(100.0f, 100.0f, 300.0f, 300.0f);
  325. for(int i=0; i<6; i++) {
  326. g->DrawLine(&linepen, 100*i, 0, 100*i, 600);
  327. g->DrawLine(&linepen, 0, 100*i, 600, 100*i);
  328. }
  329. g->DrawImage(image, r, 0.0f, 0.0f, 3.0f, 3.0f, UnitPixel, Img);
  330. delete image;
  331. }
  332. // Draw with palette modification.
  333. VOID DrawPalette(Graphics *g)
  334. {
  335. Image *image = new Bitmap(FileName, uICM==IDM_ICM);
  336. Unit u;
  337. RectF r;
  338. image->GetBounds(&r, &u);
  339. RectF s = r;
  340. s.X = 21;
  341. s.Y = 30;
  342. ColorPalette *palette = NULL;
  343. INT size;
  344. Status status;
  345. // Whack the first entry in the palette.
  346. size = image->GetPaletteSize();
  347. if(size > 0) {
  348. palette = (ColorPalette *)malloc(size);
  349. if(palette) {
  350. status = image->GetPalette(palette, size);
  351. if(status == Ok) {
  352. palette->Entries[0] = 0x7fff0000;
  353. status = image->SetPalette(palette);
  354. }
  355. }
  356. }
  357. g->DrawImage(image, r, r.X, r.Y, r.Width, r.Height, UnitPixel);
  358. free(palette);
  359. delete image;
  360. }
  361. // Specify source rectangle crop area not at the origin.
  362. // Draw off the top of the window (negative destination).
  363. VOID DrawICM(Graphics *g)
  364. {
  365. Bitmap *image = new Bitmap(FileName, uICM==IDM_ICM);
  366. // Our ICM profile is hacked to flip the red and blue color channels
  367. // Apply a recolor matrix to flip them back so that if something breaks
  368. // ICM, the picture will look blue instead of the familiar colors.
  369. ColorMatrix flipRedBlue =
  370. {0, 1, 0, 0, 0,
  371. 0, 0, 1, 0, 0,
  372. 1, 0, 0, 0, 0,
  373. 0, 0, 0, 1, 0,
  374. 0, 0, 0, 0, 1};
  375. /*img->SetColorMatrix(&flipRedBlue);*/
  376. Unit u;
  377. RectF r;
  378. image->GetBounds(&r, &u);
  379. RectF s = r;
  380. s.X = 21;
  381. s.Y = 30;
  382. g->DrawImage(image, r, r.X, r.Y, r.Width, r.Height, UnitPixel, Img);
  383. /* CachedBitmap *cb = new CachedBitmap(image, g);
  384. g->DrawCachedBitmap(cb, 100, 100);
  385. delete cb;*/
  386. delete image;
  387. }
  388. // Draw a non rotated outcropped image.
  389. VOID DrawOutCrop(Graphics *g)
  390. {
  391. Image *image = new Bitmap(FileName);
  392. g->DrawImage(image, Rect(0,0,500,500), -500,-500,1500,1500, UnitPixel, Img);
  393. delete image;
  394. }
  395. // Do a non-trivial crop with a world transform applied.
  396. VOID DrawCropWT(Graphics *g)
  397. {
  398. Image *image = new Bitmap(FileName);
  399. g->TranslateTransform(0, 100.0f);
  400. g->DrawImage(image, 0, 0, 100,100,600,400, UnitPixel);
  401. g->ResetTransform();
  402. delete image;
  403. }
  404. // Non-trivial cropping combined with a horizontal flip and a world transform
  405. VOID DrawHFlip(Graphics *g)
  406. {
  407. Image *image = new Bitmap(FileName);
  408. PointF dst[4];
  409. dst[0].X = 400;
  410. dst[0].Y = 200;
  411. dst[1].X = 0;
  412. dst[1].Y = 200;
  413. dst[2].X = 400;
  414. dst[2].Y = 500;
  415. g->TranslateTransform(0, 100.0f);
  416. g->DrawImage(image, dst, 3, 100, 100, 600, 400, UnitPixel);
  417. g->ResetTransform();
  418. delete image;
  419. }
  420. // Non-trivial cropping combined with a vertical flip and a world transform
  421. VOID DrawVFlip(Graphics *g)
  422. {
  423. Image *image = new Bitmap(FileName);
  424. PointF dst[4];
  425. dst[0].X = 0;
  426. dst[0].Y = 500;
  427. dst[1].X = 400;
  428. dst[1].Y = 500;
  429. dst[2].X = 0;
  430. dst[2].Y = 200;
  431. g->TranslateTransform(0, 100.0f);
  432. g->DrawImage(image, dst, 3, 100, 100, 600, 400, UnitPixel);
  433. g->ResetTransform();
  434. delete image;
  435. }
  436. // Draw stretched image.
  437. VOID DrawStretchS(Graphics *g)
  438. {
  439. Image *image = new Bitmap(FileName);
  440. RectF r;
  441. for(int i=6; i<15; i++)
  442. {
  443. g->DrawImage(image, (i+1)*i*10/2-200, 300, i*10, i*10);
  444. }
  445. g->DrawImage(image, 0, 0, 470, 200);
  446. g->DrawImage(image, 500, 100, 300, 300);
  447. g->DrawImage(image, 100, 500, 400, 300);
  448. g->DrawImage(image, 500, 500, 300, 80);
  449. delete image;
  450. }
  451. // Draw stretched image.
  452. VOID DrawStretchB(Graphics *g)
  453. {
  454. Image *image = new Bitmap(FileName);
  455. g->DrawImage(image, 100, 100, 603, 603);
  456. delete image;
  457. }
  458. // Draw a rotated outcropped image.
  459. VOID DrawOutCropR(Graphics *g)
  460. {
  461. Image *image = new Bitmap(FileName);
  462. PointF dst[4];
  463. dst[0].X = 20;
  464. dst[0].Y = 0;
  465. dst[1].X = 180;
  466. dst[1].Y = 20;
  467. dst[2].X = 0;
  468. dst[2].Y = 140;
  469. g->DrawImage(image, dst, 3, -50,-50,600,400, UnitPixel);
  470. delete image;
  471. }
  472. // Simple no rotation, origin based source clip.
  473. VOID DrawTest2(Graphics *g)
  474. {
  475. Image *image = new Bitmap(FileName);
  476. g->DrawImage(image, 0, 0, 0, 0,100,100, UnitPixel);
  477. delete image;
  478. }
  479. /***************************************************************************\
  480. * DoTest
  481. *
  482. * Sets up the graphics according to the selected parameters on the menu
  483. * and then invokes the appropriate test routine from above.
  484. \***************************************************************************/
  485. VOID
  486. DoTest(
  487. HWND hwnd
  488. )
  489. {
  490. // Create a Graphics in the window.
  491. // Graphics *g = Graphics::GetFromHwnd(hwnd, uICMBack==IDM_ICM_BACK);
  492. HDC hdc = GetDC(hwnd);
  493. SetICMMode(hdc, (uICMBack==IDM_ICM_BACK)?ICM_ON:ICM_OFF);
  494. Graphics *g = new Graphics(hdc);
  495. g->SetSmoothingMode(SmoothingModeNone);
  496. // Choose the resampling mode.
  497. switch(uResample) {
  498. case IDM_BILINEAR:
  499. g->SetInterpolationMode(InterpolationModeBilinear);
  500. break;
  501. case IDM_BICUBIC:
  502. g->SetInterpolationMode(InterpolationModeBicubic);
  503. break;
  504. case IDM_NEARESTNEIGHBOR:
  505. g->SetInterpolationMode(InterpolationModeNearestNeighbor);
  506. break;
  507. case IDM_HIGHBILINEAR:
  508. g->SetInterpolationMode(InterpolationModeHighQualityBilinear);
  509. break;
  510. case IDM_HIGHBICUBIC:
  511. g->SetInterpolationMode(InterpolationModeHighQualityBicubic);
  512. break;
  513. default:
  514. break;
  515. }
  516. g->SetPixelOffsetMode(bPixelMode?PixelOffsetModeHalf:PixelOffsetModeNone);
  517. Img = new ImageAttributes();
  518. switch(uWrapMode)
  519. {
  520. case IDM_WRAPMODETILE:
  521. Img->SetWrapMode(WrapModeTile, Color(0), FALSE);
  522. break;
  523. case IDM_WRAPMODEFLIPX:
  524. Img->SetWrapMode(WrapModeTileFlipX, Color(0), FALSE);
  525. break;
  526. case IDM_WRAPMODEFLIPY:
  527. Img->SetWrapMode(WrapModeTileFlipY, Color(0), FALSE);
  528. break;
  529. case IDM_WRAPMODEFLIPXY:
  530. Img->SetWrapMode(WrapModeTileFlipXY, Color(0), FALSE);
  531. break;
  532. case IDM_WRAPMODECLAMP0:
  533. Img->SetWrapMode(WrapModeClamp, Color(0), FALSE);
  534. break;
  535. case IDM_WRAPMODECLAMPFF:
  536. Img->SetWrapMode(WrapModeClamp, Color(0xffff0000), FALSE);
  537. break;
  538. }
  539. // Choose the test to run
  540. switch(uCategory) {
  541. case IDM_ALL:
  542. DrawSimple(g);
  543. DrawStretchRotation(g);
  544. DrawShrinkRotation(g);
  545. DrawCropRotation(g);
  546. DrawCopyCrop(g);
  547. DrawICM(g);
  548. DrawTest2(g);
  549. DrawOutCrop(g);
  550. DrawOutCropR(g);
  551. DrawCropWT(g);
  552. DrawHFlip(g);
  553. DrawVFlip(g);
  554. DrawStretchB(g);
  555. DrawCachedBitmap(g);
  556. DrawStretchS(g);
  557. DrawPalette(g);
  558. DrawPixelCenter(g);
  559. DrawSpecialRotate(g);
  560. break;
  561. case IDM_OUTCROPR:
  562. DrawOutCropR(g);
  563. break;
  564. case IDM_OUTCROP:
  565. DrawOutCrop(g);
  566. break;
  567. case IDM_SIMPLE:
  568. DrawSimple(g);
  569. break;
  570. case IDM_STRETCHROTATION:
  571. DrawStretchRotation(g);
  572. break;
  573. case IDM_SHRINKROTATION:
  574. DrawShrinkRotation(g);
  575. break;
  576. case IDM_CROPROTATION: //who says programmers don't do real work??
  577. DrawCropRotation(g);
  578. break;
  579. case IDM_PIXELCENTER:
  580. DrawPixelCenter(g);
  581. break;
  582. case IDM_COPYCROP:
  583. DrawCopyCrop(g);
  584. break;
  585. case IDM_DRAWPALETTE:
  586. DrawPalette(g);
  587. break;
  588. case IDM_DRAWICM:
  589. DrawICM(g);
  590. break;
  591. case IDM_DRAWIMAGE2:
  592. DrawTest2(g);
  593. break;
  594. case IDM_STRETCHB:
  595. DrawStretchB(g);
  596. break;
  597. case IDM_STRETCHS:
  598. DrawStretchS(g);
  599. break;
  600. case IDM_CACHEDBITMAP:
  601. DrawCachedBitmap(g);
  602. break;
  603. case IDM_CROPWT:
  604. DrawCropWT(g);
  605. break;
  606. case IDM_HFLIP:
  607. DrawHFlip(g);
  608. break;
  609. case IDM_VFLIP:
  610. DrawVFlip(g);
  611. break;
  612. case IDM_SPECIALROTATE:
  613. DrawSpecialRotate(g);
  614. break;
  615. default:
  616. break;
  617. }
  618. delete Img;
  619. Img = NULL;
  620. delete g;
  621. ReleaseDC(hwnd, hdc);
  622. }