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.

2475 lines
67 KiB

  1. /****************************************************************************
  2. * Handlers.c - Handlers for the Win32 metafile records
  3. *
  4. * DATE: 11-Dec-1991
  5. * Author: Jeffrey Newman (c-jeffn)
  6. *
  7. * Copyright (c) Microsoft Inc. 1991
  8. ****************************************************************************/
  9. #include "precomp.h"
  10. #include <wtypes.h>
  11. #pragma hdrstop
  12. extern fnSetVirtualResolution pfnSetVirtualResolution;
  13. // Max number of pointl's allowed on stack before explicit memory allocation.
  14. #define MAX_STACK_POINTL 128
  15. // Convert array of POINTSs to POINTLs.
  16. #define POINTS_TO_POINTL(pptl, ppts, cpt) \
  17. { \
  18. DWORD i; \
  19. for (i = 0; i < (cpt); i++) \
  20. { \
  21. (pptl)[i].x = (LONG) (ppts)[i].x; \
  22. (pptl)[i].y = (LONG) (ppts)[i].y; \
  23. } \
  24. }
  25. DWORD GetCodePage(HDC hdc);
  26. /**************************************************************************
  27. * Handler - NotImplemented
  28. *
  29. * The following 32-bit records have no equivalent 16-bit metafile records:
  30. * SETBRUSHORGEX
  31. *
  32. *************************************************************************/
  33. BOOL bHandleNotImplemented(PVOID pVoid, PLOCALDC pLocalDC)
  34. {
  35. PENHMETARECORD pemr ;
  36. INT iType ;
  37. NOTUSED(pLocalDC) ;
  38. pemr = (PENHMETARECORD) pVoid ;
  39. iType = pemr->iType ;
  40. if (iType != EMR_SETBRUSHORGEX
  41. && iType != EMR_SETCOLORADJUSTMENT
  42. && iType != EMR_SETMITERLIMIT
  43. && iType != EMR_SETICMMODE
  44. && iType != EMR_CREATECOLORSPACE
  45. && iType != EMR_SETCOLORSPACE
  46. && iType != EMR_DELETECOLORSPACE
  47. && iType != EMR_GLSRECORD
  48. && iType != EMR_GLSBOUNDEDRECORD
  49. && iType != EMR_PIXELFORMAT)
  50. {
  51. PUTS1("MF3216: bHandleNotImplemented - record not supported: %d\n", iType) ;
  52. }
  53. return(TRUE) ;
  54. }
  55. /**************************************************************************
  56. * Handler - GdiComment
  57. *************************************************************************/
  58. BOOL bHandleGdiComment(PVOID pVoid, PLOCALDC pLocalDC)
  59. {
  60. return(DoGdiComment(pLocalDC, (PEMR) pVoid));
  61. }
  62. /**************************************************************************
  63. * Handler - SetPaletteEntries
  64. *************************************************************************/
  65. BOOL bHandleSetPaletteEntries(PVOID pVoid, PLOCALDC pLocalDC)
  66. {
  67. BOOL b ;
  68. PEMRSETPALETTEENTRIES pMfSetPaletteEntries ;
  69. DWORD ihPal, iStart, cEntries ;
  70. PPALETTEENTRY pPalEntry ;
  71. pMfSetPaletteEntries = (PEMRSETPALETTEENTRIES) pVoid ;
  72. // Now do the translation.
  73. ihPal = pMfSetPaletteEntries->ihPal ;
  74. iStart = pMfSetPaletteEntries->iStart ;
  75. cEntries = pMfSetPaletteEntries->cEntries ;
  76. pPalEntry = pMfSetPaletteEntries->aPalEntries ;
  77. b = DoSetPaletteEntries(pLocalDC, ihPal, iStart, cEntries, pPalEntry) ;
  78. return (b) ;
  79. }
  80. /**************************************************************************
  81. * Handler - CreatePalette
  82. *************************************************************************/
  83. BOOL bHandleCreatePalette(PVOID pVoid, PLOCALDC pLocalDC)
  84. {
  85. BOOL b ;
  86. PEMRCREATEPALETTE pMfCreatePalette ;
  87. LPLOGPALETTE lpLogPal ;
  88. DWORD ihPal ;
  89. pMfCreatePalette = (PEMRCREATEPALETTE) pVoid ;
  90. // Now do the translation.
  91. ihPal = pMfCreatePalette->ihPal ;
  92. lpLogPal = &pMfCreatePalette->lgpl ;
  93. b = DoCreatePalette(pLocalDC, ihPal, lpLogPal) ;
  94. return (b) ;
  95. }
  96. /**************************************************************************
  97. * Handler - RealizePalette
  98. *************************************************************************/
  99. BOOL bHandleRealizePalette(PVOID pVoid, PLOCALDC pLocalDC)
  100. {
  101. BOOL b ;
  102. NOTUSED(pVoid);
  103. // Now do the translation.
  104. b = DoRealizePalette(pLocalDC) ;
  105. return (b) ;
  106. }
  107. /**************************************************************************
  108. * Handler - ResizePalette
  109. *************************************************************************/
  110. BOOL bHandleResizePalette(PVOID pVoid, PLOCALDC pLocalDC)
  111. {
  112. BOOL b ;
  113. PEMRRESIZEPALETTE pMfResizePalette ;
  114. DWORD ihPal, cEntries ;
  115. pMfResizePalette = (PEMRRESIZEPALETTE) pVoid ;
  116. // Now do the translation.
  117. ihPal = pMfResizePalette->ihPal ;
  118. cEntries = pMfResizePalette->cEntries ;
  119. b = DoResizePalette(pLocalDC, ihPal, cEntries) ;
  120. return (b) ;
  121. }
  122. /**************************************************************************
  123. * Handler - SelectPalette
  124. *************************************************************************/
  125. BOOL bHandleSelectPalette(PVOID pVoid, PLOCALDC pLocalDC)
  126. {
  127. BOOL b ;
  128. PEMRSELECTPALETTE pMfSelectPalette ;
  129. DWORD ihPal ;
  130. pMfSelectPalette = (PEMRSELECTPALETTE) pVoid ;
  131. // Now do the translation.
  132. ihPal = pMfSelectPalette->ihPal ;
  133. b = DoSelectPalette(pLocalDC, ihPal) ;
  134. return (b) ;
  135. }
  136. /**************************************************************************
  137. * Handler - OffsetClipRgn
  138. *************************************************************************/
  139. BOOL bHandleOffsetClipRgn(PVOID pVoid, PLOCALDC pLocalDC)
  140. {
  141. BOOL b ;
  142. PEMROFFSETCLIPRGN pMfOffsetClipRgn ;
  143. INT x, y ;
  144. pMfOffsetClipRgn = (PEMROFFSETCLIPRGN) pVoid ;
  145. // Now do the translation.
  146. x = pMfOffsetClipRgn->ptlOffset.x ;
  147. y = pMfOffsetClipRgn->ptlOffset.y ;
  148. b = DoOffsetClipRgn(pLocalDC, x, y) ;
  149. return (b) ;
  150. }
  151. /**************************************************************************
  152. * Handler - ExtSelectClipRgn
  153. *************************************************************************/
  154. BOOL bHandleExtSelectClipRgn(PVOID pVoid, PLOCALDC pLocalDC)
  155. {
  156. BOOL b ;
  157. PEMREXTSELECTCLIPRGN pMfExtSelectClipRgn ;
  158. INT cbRgnData, iMode ;
  159. LPRGNDATA pRgnData ;
  160. pMfExtSelectClipRgn = (PEMREXTSELECTCLIPRGN) pVoid ;
  161. // Now do the translation.
  162. cbRgnData = pMfExtSelectClipRgn->cbRgnData ;
  163. pRgnData = (LPRGNDATA) pMfExtSelectClipRgn->RgnData;
  164. iMode = pMfExtSelectClipRgn->iMode ;
  165. b = DoExtSelectClipRgn(pLocalDC, cbRgnData, pRgnData, iMode) ;
  166. return (b) ;
  167. }
  168. /**************************************************************************
  169. * Handler - SetMetaRgn
  170. *************************************************************************/
  171. BOOL bHandleSetMetaRgn(PVOID pVoid, PLOCALDC pLocalDC)
  172. {
  173. BOOL b ;
  174. NOTUSED(pVoid) ;
  175. b = DoSetMetaRgn(pLocalDC) ;
  176. return(b) ;
  177. }
  178. /**************************************************************************
  179. * Handler - PaintRgn
  180. *************************************************************************/
  181. BOOL bHandlePaintRgn(PVOID pVoid, PLOCALDC pLocalDC)
  182. {
  183. BOOL b ;
  184. PEMRPAINTRGN pMfPaintRgn ;
  185. INT cbRgnData;
  186. LPRGNDATA pRgnData ;
  187. pMfPaintRgn = (PEMRPAINTRGN) pVoid ;
  188. // Now do the translation.
  189. cbRgnData = pMfPaintRgn->cbRgnData ;
  190. pRgnData = (LPRGNDATA) pMfPaintRgn->RgnData;
  191. b = DoDrawRgn(pLocalDC, 0, 0, 0, cbRgnData, pRgnData, EMR_PAINTRGN);
  192. return (b) ;
  193. }
  194. /**************************************************************************
  195. * Handler - InvertRgn
  196. *************************************************************************/
  197. BOOL bHandleInvertRgn(PVOID pVoid, PLOCALDC pLocalDC)
  198. {
  199. BOOL b ;
  200. PEMRINVERTRGN pMfInvertRgn ;
  201. INT cbRgnData;
  202. LPRGNDATA pRgnData ;
  203. pMfInvertRgn = (PEMRINVERTRGN) pVoid ;
  204. // Now do the translation.
  205. cbRgnData = pMfInvertRgn->cbRgnData ;
  206. pRgnData = (LPRGNDATA) pMfInvertRgn->RgnData;
  207. b = DoDrawRgn(pLocalDC, 0, 0, 0, cbRgnData, pRgnData, EMR_INVERTRGN);
  208. return (b) ;
  209. }
  210. /**************************************************************************
  211. * Handler - FrameRgn
  212. *************************************************************************/
  213. BOOL bHandleFrameRgn(PVOID pVoid, PLOCALDC pLocalDC)
  214. {
  215. BOOL b ;
  216. PEMRFRAMERGN pMfFrameRgn ;
  217. INT ihBrush,
  218. cbRgnData,
  219. nWidth,
  220. nHeight ;
  221. LPRGNDATA pRgnData ;
  222. pMfFrameRgn = (PEMRFRAMERGN) pVoid ;
  223. // Now do the translation.
  224. ihBrush = pMfFrameRgn->ihBrush ;
  225. nWidth = pMfFrameRgn->szlStroke.cx ;
  226. nHeight = pMfFrameRgn->szlStroke.cy ;
  227. cbRgnData = pMfFrameRgn->cbRgnData ;
  228. pRgnData = (LPRGNDATA) pMfFrameRgn->RgnData;
  229. b = DoDrawRgn(pLocalDC, ihBrush, nWidth, nHeight, cbRgnData, pRgnData, EMR_FRAMERGN);
  230. return (b) ;
  231. }
  232. /**************************************************************************
  233. * Handler - FillRgn
  234. *************************************************************************/
  235. BOOL bHandleFillRgn(PVOID pVoid, PLOCALDC pLocalDC)
  236. {
  237. BOOL b ;
  238. PEMRFILLRGN pMfFillRgn ;
  239. INT ihBrush,
  240. cbRgnData;
  241. LPRGNDATA pRgnData ;
  242. // Set up the pointer the Doer uses to reference the
  243. // the Win32 drawing order. Also setup the drawing order specific
  244. // pointer.
  245. pMfFillRgn = (PEMRFILLRGN) pVoid ;
  246. // Now do the translation.
  247. ihBrush = pMfFillRgn->ihBrush ;
  248. cbRgnData = pMfFillRgn->cbRgnData ;
  249. pRgnData = (LPRGNDATA) pMfFillRgn->RgnData;
  250. b = DoDrawRgn(pLocalDC, ihBrush, 0, 0, cbRgnData, pRgnData, EMR_FILLRGN);
  251. return (b) ;
  252. }
  253. /**************************************************************************
  254. * Handler - IntersectClipRect
  255. *************************************************************************/
  256. BOOL bHandleIntersectClipRect(PVOID pVoid, PLOCALDC pLocalDC)
  257. {
  258. BOOL b ;
  259. PEMRINTERSECTCLIPRECT pMfIntersectClipRect ;
  260. INT xLeft, yTop, xRight, yBottom ;
  261. pMfIntersectClipRect = (PEMRINTERSECTCLIPRECT) pVoid ;
  262. // Now do the translation.
  263. xLeft = pMfIntersectClipRect->rclClip.left ;
  264. yTop = pMfIntersectClipRect->rclClip.top ;
  265. xRight = pMfIntersectClipRect->rclClip.right ;
  266. yBottom = pMfIntersectClipRect->rclClip.bottom ;
  267. b = DoClipRect(pLocalDC, xLeft, yTop, xRight, yBottom, EMR_INTERSECTCLIPRECT) ;
  268. return (b) ;
  269. }
  270. /**************************************************************************
  271. * Handler - ExcludeClipRect
  272. *************************************************************************/
  273. BOOL bHandleExcludeClipRect(PVOID pVoid, PLOCALDC pLocalDC)
  274. {
  275. BOOL b ;
  276. PEMREXCLUDECLIPRECT pMfExcludeClipRect ;
  277. INT xLeft, yTop, xRight, yBottom ;
  278. pMfExcludeClipRect = (PEMREXCLUDECLIPRECT) pVoid ;
  279. // Now do the translation.
  280. xLeft = pMfExcludeClipRect->rclClip.left ;
  281. yTop = pMfExcludeClipRect->rclClip.top ;
  282. xRight = pMfExcludeClipRect->rclClip.right ;
  283. yBottom = pMfExcludeClipRect->rclClip.bottom ;
  284. b = DoClipRect(pLocalDC, xLeft, yTop, xRight, yBottom, EMR_EXCLUDECLIPRECT) ;
  285. return (b) ;
  286. }
  287. /**************************************************************************
  288. * Handler - SetPixel
  289. *************************************************************************/
  290. BOOL bHandleSetPixel(PVOID pVoid, PLOCALDC pLocalDC)
  291. {
  292. BOOL b ;
  293. PEMRSETPIXELV pMfSetPixel ;
  294. INT x, y ;
  295. COLORREF crColor ;
  296. pMfSetPixel = (PEMRSETPIXELV) pVoid ;
  297. // Now do the translation.
  298. x = (INT) pMfSetPixel->ptlPixel.x ;
  299. y = (INT) pMfSetPixel->ptlPixel.y ;
  300. crColor = pMfSetPixel->crColor ;
  301. b = DoSetPixel(pLocalDC, x, y, crColor) ;
  302. return (b) ;
  303. }
  304. /**************************************************************************
  305. * Handler - ExtFloodFill
  306. *************************************************************************/
  307. BOOL bHandleExtFloodFill(PVOID pVoid, PLOCALDC pLocalDC)
  308. {
  309. BOOL b ;
  310. PEMREXTFLOODFILL pMfExtFloodFill ;
  311. INT x, y ;
  312. COLORREF crColor ;
  313. DWORD iMode ;
  314. pMfExtFloodFill = (PEMREXTFLOODFILL) pVoid ;
  315. // Now do the translation.
  316. x = (INT) pMfExtFloodFill->ptlStart.x ;
  317. y = (INT) pMfExtFloodFill->ptlStart.y ;
  318. crColor = pMfExtFloodFill->crColor ;
  319. iMode = pMfExtFloodFill->iMode ;
  320. b = DoExtFloodFill(pLocalDC, x, y, crColor, iMode) ;
  321. return (b) ;
  322. }
  323. /**************************************************************************
  324. * Handler - ModifyWorldTransform
  325. *************************************************************************/
  326. BOOL bHandleModifyWorldTransform(PVOID pVoid, PLOCALDC pLocalDC)
  327. {
  328. BOOL b ;
  329. PEMRMODIFYWORLDTRANSFORM pMfModifyWorldTransform ;
  330. PXFORM pxform ;
  331. DWORD iMode ;
  332. pMfModifyWorldTransform = (PEMRMODIFYWORLDTRANSFORM) pVoid ;
  333. // get a pointer to the xform matrix
  334. pxform = &pMfModifyWorldTransform->xform ;
  335. iMode = pMfModifyWorldTransform->iMode ;
  336. // Now do the translation.
  337. b = DoModifyWorldTransform(pLocalDC, pxform, iMode) ;
  338. return (b) ;
  339. }
  340. /**************************************************************************
  341. * Handler - SetWorldTransform
  342. *************************************************************************/
  343. BOOL bHandleSetWorldTransform(PVOID pVoid, PLOCALDC pLocalDC)
  344. {
  345. BOOL b ;
  346. PEMRSETWORLDTRANSFORM pMfSetWorldTransform ;
  347. PXFORM pxform ;
  348. pMfSetWorldTransform = (PEMRSETWORLDTRANSFORM) pVoid ;
  349. // get a pointer to the xform matrix
  350. pxform = &pMfSetWorldTransform->xform ;
  351. // Now do the translation.
  352. b = DoSetWorldTransform(pLocalDC, pxform) ;
  353. return (b) ;
  354. }
  355. /**************************************************************************
  356. * Handler - PolyBezierTo
  357. *************************************************************************/
  358. BOOL bHandlePolyBezierTo(PVOID pVoid, PLOCALDC pLocalDC)
  359. {
  360. BOOL b ;
  361. PEMRPOLYBEZIERTO pMfPolyBezierTo ;
  362. DWORD nCount ;
  363. PPOINTL pptl ;
  364. pMfPolyBezierTo = (PEMRPOLYBEZIERTO) pVoid ;
  365. // Copy the BezierTo count and the polyBezierTo verticies to
  366. // the record.
  367. nCount = pMfPolyBezierTo->cptl ;
  368. pptl = pMfPolyBezierTo->aptl ;
  369. // Now do the translation.
  370. b = DoPolyBezierTo(pLocalDC, (LPPOINT) pptl, nCount) ;
  371. return (b) ;
  372. }
  373. /**************************************************************************
  374. * Handler - PolyDraw
  375. *************************************************************************/
  376. BOOL bHandlePolyDraw(PVOID pVoid, PLOCALDC pLocalDC)
  377. {
  378. BOOL b ;
  379. PEMRPOLYDRAW pMfPolyDraw ;
  380. DWORD nCount ;
  381. PPOINTL pptl ;
  382. PBYTE pb ;
  383. pMfPolyDraw = (PEMRPOLYDRAW) pVoid ;
  384. // Copy the Draw count and the polyDraw verticies to
  385. // the record.
  386. nCount = pMfPolyDraw->cptl ;
  387. pptl = pMfPolyDraw->aptl ;
  388. pb = (PBYTE) &pMfPolyDraw->aptl[nCount];
  389. // Now do the translation.
  390. b = DoPolyDraw(pLocalDC, (LPPOINT) pptl, pb, nCount) ;
  391. return (b) ;
  392. }
  393. /**************************************************************************
  394. * Handler - PolyBezier
  395. *************************************************************************/
  396. BOOL bHandlePolyBezier(PVOID pVoid, PLOCALDC pLocalDC)
  397. {
  398. BOOL b ;
  399. PEMRPOLYBEZIER pMfPolyBezier ;
  400. DWORD nCount ;
  401. PPOINTL pptl ;
  402. pMfPolyBezier = (PEMRPOLYBEZIER) pVoid ;
  403. // Copy the Bezier count and the polyBezier verticies to
  404. // the record.
  405. nCount = pMfPolyBezier->cptl ;
  406. pptl = pMfPolyBezier->aptl ;
  407. // Now do the translation.
  408. b = DoPolyBezier(pLocalDC, (LPPOINT) pptl, nCount) ;
  409. return (b) ;
  410. }
  411. /**************************************************************************
  412. * Handler - Begin Path
  413. *************************************************************************/
  414. BOOL bHandleBeginPath(PVOID pVoid, PLOCALDC pLocalDC)
  415. {
  416. BOOL b ;
  417. NOTUSED(pVoid) ;
  418. b = DoBeginPath(pLocalDC) ;
  419. return (b) ;
  420. }
  421. /**************************************************************************
  422. * Handler - End Path
  423. *************************************************************************/
  424. BOOL bHandleEndPath(PVOID pVoid, PLOCALDC pLocalDC)
  425. {
  426. BOOL b ;
  427. NOTUSED(pVoid) ;
  428. b = DoEndPath(pLocalDC) ;
  429. return (b) ;
  430. }
  431. /**************************************************************************
  432. * Handler - Flatten Path
  433. *************************************************************************/
  434. BOOL bHandleFlattenPath(PVOID pVoid, PLOCALDC pLocalDC)
  435. {
  436. BOOL b ;
  437. NOTUSED(pVoid) ;
  438. b = DoFlattenPath(pLocalDC) ;
  439. return (b) ;
  440. }
  441. /**************************************************************************
  442. * Handler - CloseFigure
  443. *************************************************************************/
  444. BOOL bHandleCloseFigure(PVOID pVoid, PLOCALDC pLocalDC)
  445. {
  446. BOOL b ;
  447. NOTUSED(pVoid) ;
  448. b = DoCloseFigure(pLocalDC) ;
  449. return (b) ;
  450. }
  451. /**************************************************************************
  452. * Handler - Abort Path
  453. *************************************************************************/
  454. BOOL bHandleAbortPath(PVOID pVoid, PLOCALDC pLocalDC)
  455. {
  456. BOOL b ;
  457. NOTUSED(pVoid) ;
  458. b = DoAbortPath(pLocalDC) ;
  459. return (b) ;
  460. }
  461. /**************************************************************************
  462. * Handler - Stroke Path
  463. *************************************************************************/
  464. BOOL bHandleStrokePath(PVOID pVoid, PLOCALDC pLocalDC)
  465. {
  466. NOTUSED(pVoid) ;
  467. return(DoRenderPath(pLocalDC, EMR_STROKEPATH, FALSE));
  468. }
  469. /**************************************************************************
  470. * Handler - Fill Path
  471. *************************************************************************/
  472. BOOL bHandleFillPath(PVOID pVoid, PLOCALDC pLocalDC)
  473. {
  474. NOTUSED(pVoid) ;
  475. return(DoRenderPath(pLocalDC, EMR_FILLPATH, FALSE));
  476. }
  477. /**************************************************************************
  478. * Handler - Stroke and Fill Path
  479. *************************************************************************/
  480. BOOL bHandleStrokeAndFillPath(PVOID pVoid, PLOCALDC pLocalDC)
  481. {
  482. NOTUSED(pVoid) ;
  483. return(DoRenderPath(pLocalDC, EMR_STROKEANDFILLPATH, FALSE));
  484. }
  485. /**************************************************************************
  486. * Handler - Widen Path
  487. *************************************************************************/
  488. BOOL bHandleWidenPath(PVOID pVoid, PLOCALDC pLocalDC)
  489. {
  490. BOOL b ;
  491. NOTUSED(pVoid) ;
  492. b = DoWidenPath(pLocalDC) ;
  493. return(b) ;
  494. }
  495. /**************************************************************************
  496. * Handler - Select Clip Path
  497. *************************************************************************/
  498. BOOL bHandleSelectClipPath(PVOID pVoid, PLOCALDC pLocalDC)
  499. {
  500. BOOL b ;
  501. PEMRSELECTCLIPPATH pMfSelectClipPath ;
  502. INT iMode ;
  503. pMfSelectClipPath = (PEMRSELECTCLIPPATH) pVoid ;
  504. iMode = (INT) pMfSelectClipPath->iMode ;
  505. b = DoSelectClipPath(pLocalDC, iMode) ;
  506. return(b) ;
  507. }
  508. /**************************************************************************
  509. * Handler - StretchDIBits
  510. *************************************************************************/
  511. BOOL bHandleStretchDIBits(PVOID pVoid, PLOCALDC pLocalDC)
  512. {
  513. PEMRSTRETCHDIBITS pMfStretchDIBits ;
  514. BOOL b ;
  515. LONG xDest ;
  516. LONG yDest ;
  517. LONG xSrc ;
  518. LONG ySrc ;
  519. LONG cxSrc ;
  520. LONG cySrc ;
  521. DWORD offBmiSrc ;
  522. DWORD cbBmiSrc ;
  523. DWORD offBitsSrc ;
  524. DWORD cbBitsSrc ;
  525. DWORD iUsageSrc ;
  526. DWORD dwRop ;
  527. LONG cxDest ;
  528. LONG cyDest ;
  529. LPBITMAPINFO lpBitmapInfo ;
  530. LPBYTE lpBits ;
  531. pMfStretchDIBits = (PEMRSTRETCHDIBITS) pVoid ;
  532. xDest = pMfStretchDIBits->xDest ;
  533. yDest = pMfStretchDIBits->yDest ;
  534. xSrc = pMfStretchDIBits->xSrc ;
  535. ySrc = pMfStretchDIBits->ySrc ;
  536. cxSrc = pMfStretchDIBits->cxSrc ;
  537. cySrc = pMfStretchDIBits->cySrc ;
  538. offBmiSrc = pMfStretchDIBits->offBmiSrc ;
  539. cbBmiSrc = pMfStretchDIBits->cbBmiSrc ;
  540. offBitsSrc = pMfStretchDIBits->offBitsSrc ;
  541. cbBitsSrc = pMfStretchDIBits->cbBitsSrc ;
  542. iUsageSrc = pMfStretchDIBits->iUsageSrc ;
  543. dwRop = pMfStretchDIBits->dwRop;
  544. cxDest = pMfStretchDIBits->cxDest ;
  545. cyDest = pMfStretchDIBits->cyDest ;
  546. lpBitmapInfo = (LPBITMAPINFO) ((PBYTE) pMfStretchDIBits + offBmiSrc) ;
  547. lpBits = (PBYTE) pMfStretchDIBits + offBitsSrc ;
  548. b = DoStretchDIBits(pLocalDC,
  549. xDest,
  550. yDest,
  551. cxDest,
  552. cyDest,
  553. dwRop,
  554. xSrc,
  555. ySrc,
  556. cxSrc,
  557. cySrc,
  558. iUsageSrc,
  559. lpBitmapInfo,
  560. cbBmiSrc,
  561. lpBits,
  562. cbBitsSrc ) ;
  563. return(b) ;
  564. }
  565. /**************************************************************************
  566. * Handler - SetDIBitsToDevice
  567. *************************************************************************/
  568. BOOL bHandleSetDIBitsToDevice(PVOID pVoid, PLOCALDC pLocalDC)
  569. {
  570. PEMRSETDIBITSTODEVICE pMfSetDIBitsToDevice ;
  571. BOOL b ;
  572. LONG xDest ;
  573. LONG yDest ;
  574. LONG xSrc ;
  575. LONG ySrc ;
  576. LONG cxSrc ;
  577. LONG cySrc ;
  578. DWORD offBmiSrc ;
  579. DWORD cbBmiSrc ;
  580. DWORD offBitsSrc ;
  581. DWORD cbBitsSrc ;
  582. DWORD iUsageSrc ;
  583. DWORD iStartScan ;
  584. DWORD cScans ;
  585. LPBITMAPINFO lpBitmapInfo ;
  586. LPBYTE lpBits ;
  587. pMfSetDIBitsToDevice = (PEMRSETDIBITSTODEVICE) pVoid ;
  588. xDest = pMfSetDIBitsToDevice->xDest ;
  589. yDest = pMfSetDIBitsToDevice->yDest ;
  590. xSrc = pMfSetDIBitsToDevice->xSrc ;
  591. ySrc = pMfSetDIBitsToDevice->ySrc ;
  592. cxSrc = pMfSetDIBitsToDevice->cxSrc ;
  593. cySrc = pMfSetDIBitsToDevice->cySrc ;
  594. offBmiSrc = pMfSetDIBitsToDevice->offBmiSrc ;
  595. cbBmiSrc = pMfSetDIBitsToDevice->cbBmiSrc ;
  596. offBitsSrc = pMfSetDIBitsToDevice->offBitsSrc ;
  597. cbBitsSrc = pMfSetDIBitsToDevice->cbBitsSrc ;
  598. iUsageSrc = pMfSetDIBitsToDevice->iUsageSrc ;
  599. iStartScan = pMfSetDIBitsToDevice->iStartScan ;
  600. cScans = pMfSetDIBitsToDevice->cScans ;
  601. lpBitmapInfo = (LPBITMAPINFO) ((PBYTE) pMfSetDIBitsToDevice + offBmiSrc) ;
  602. lpBits = (PBYTE) pMfSetDIBitsToDevice + offBitsSrc ;
  603. b = DoSetDIBitsToDevice(pLocalDC,
  604. xDest,
  605. yDest,
  606. xSrc,
  607. ySrc,
  608. cxSrc,
  609. cySrc,
  610. iUsageSrc,
  611. iStartScan,
  612. cScans,
  613. lpBitmapInfo,
  614. cbBmiSrc,
  615. lpBits,
  616. cbBitsSrc ) ;
  617. return(b) ;
  618. }
  619. /**************************************************************************
  620. * Handler - BitBlt
  621. *************************************************************************/
  622. BOOL bHandleBitBlt(PVOID pVoid, PLOCALDC pLocalDC)
  623. {
  624. BOOL b ;
  625. PEMRBITBLT pMfBitBlt ;
  626. LONG xDest ;
  627. LONG yDest ;
  628. LONG cxDest ;
  629. LONG cyDest ;
  630. DWORD dwRop ;
  631. LONG xSrc ;
  632. LONG ySrc ;
  633. PXFORM pxformSrc ;
  634. COLORREF crBkColorSrc ;
  635. DWORD iUsageSrc ;
  636. DWORD offBmiSrc ;
  637. DWORD cbBmiSrc ;
  638. DWORD offBitsSrc ;
  639. DWORD cbBitsSrc ;
  640. PBITMAPINFO pbmi ;
  641. LPBYTE lpBits ;
  642. pMfBitBlt = (PEMRBITBLT) pVoid ;
  643. xDest = pMfBitBlt->xDest ;
  644. yDest = pMfBitBlt->yDest ;
  645. cxDest = pMfBitBlt->cxDest ;
  646. cyDest = pMfBitBlt->cyDest ;
  647. dwRop = pMfBitBlt->dwRop ;
  648. xSrc = pMfBitBlt->xSrc ;
  649. ySrc = pMfBitBlt->ySrc ;
  650. pxformSrc =&(pMfBitBlt->xformSrc) ;
  651. crBkColorSrc = pMfBitBlt->crBkColorSrc ; // not used
  652. iUsageSrc = pMfBitBlt->iUsageSrc ;
  653. offBmiSrc = pMfBitBlt->offBmiSrc ;
  654. cbBmiSrc = pMfBitBlt->cbBmiSrc ;
  655. offBitsSrc = pMfBitBlt->offBitsSrc ;
  656. cbBitsSrc = pMfBitBlt->cbBitsSrc ;
  657. lpBits = (PBYTE) pMfBitBlt + offBitsSrc ;
  658. pbmi = (PBITMAPINFO) ((PBYTE) pMfBitBlt + offBmiSrc) ;
  659. b = DoStretchBlt(pLocalDC,
  660. xDest,
  661. yDest,
  662. cxDest,
  663. cyDest,
  664. dwRop,
  665. xSrc,
  666. ySrc,
  667. cxDest,
  668. cyDest,
  669. pxformSrc,
  670. iUsageSrc,
  671. pbmi,
  672. cbBmiSrc,
  673. lpBits,
  674. cbBitsSrc);
  675. return(b) ;
  676. }
  677. /**************************************************************************
  678. * Handler - StretchBlt
  679. *************************************************************************/
  680. BOOL bHandleStretchBlt(PVOID pVoid, PLOCALDC pLocalDC)
  681. {
  682. BOOL b ;
  683. PEMRSTRETCHBLT pMfStretchBlt ;
  684. LONG xDest ;
  685. LONG yDest ;
  686. LONG cxDest ;
  687. LONG cyDest ;
  688. DWORD dwRop ;
  689. LONG xSrc ;
  690. LONG ySrc ;
  691. LONG cxSrc ;
  692. LONG cySrc ;
  693. PXFORM pxformSrc ;
  694. COLORREF crBkColorSrc ;
  695. DWORD iUsageSrc ;
  696. DWORD offBmiSrc ;
  697. DWORD cbBmiSrc ;
  698. DWORD offBitsSrc ;
  699. DWORD cbBitsSrc ;
  700. PBITMAPINFO pbmi ;
  701. LPBYTE lpBits ;
  702. pMfStretchBlt = (PEMRSTRETCHBLT) pVoid ;
  703. xDest = pMfStretchBlt->xDest ;
  704. yDest = pMfStretchBlt->yDest ;
  705. cxDest = pMfStretchBlt->cxDest ;
  706. cyDest = pMfStretchBlt->cyDest ;
  707. dwRop = pMfStretchBlt->dwRop ;
  708. xSrc = pMfStretchBlt->xSrc ;
  709. ySrc = pMfStretchBlt->ySrc ;
  710. pxformSrc =&(pMfStretchBlt->xformSrc) ;
  711. crBkColorSrc = pMfStretchBlt->crBkColorSrc ; // not used
  712. iUsageSrc = pMfStretchBlt->iUsageSrc ;
  713. offBmiSrc = pMfStretchBlt->offBmiSrc ;
  714. cbBmiSrc = pMfStretchBlt->cbBmiSrc ;
  715. offBitsSrc = pMfStretchBlt->offBitsSrc ;
  716. cbBitsSrc = pMfStretchBlt->cbBitsSrc ;
  717. lpBits = (PBYTE) pMfStretchBlt + offBitsSrc ;
  718. pbmi = (PBITMAPINFO) ((PBYTE) pMfStretchBlt + offBmiSrc) ;
  719. cxSrc = pMfStretchBlt->cxSrc ;
  720. cySrc = pMfStretchBlt->cySrc ;
  721. b = DoStretchBlt(pLocalDC,
  722. xDest,
  723. yDest,
  724. cxDest,
  725. cyDest,
  726. dwRop,
  727. xSrc,
  728. ySrc,
  729. cxSrc,
  730. cySrc,
  731. pxformSrc,
  732. iUsageSrc,
  733. pbmi,
  734. cbBmiSrc,
  735. lpBits,
  736. cbBitsSrc);
  737. return(b) ;
  738. }
  739. /**************************************************************************
  740. * Handler - MaskBlt
  741. *************************************************************************/
  742. BOOL bHandleMaskBlt(PVOID pVoid, PLOCALDC pLocalDC)
  743. {
  744. BOOL b ;
  745. PEMRMASKBLT pMfMaskBlt ;
  746. LONG xDest ;
  747. LONG yDest ;
  748. LONG cxDest ;
  749. LONG cyDest ;
  750. DWORD dwRop ;
  751. LONG xSrc ;
  752. LONG ySrc ;
  753. PXFORM pxformSrc ;
  754. COLORREF crBkColorSrc ;
  755. DWORD iUsageSrc ;
  756. DWORD offBmiSrc ;
  757. DWORD cbBmiSrc ;
  758. DWORD offBitsSrc ;
  759. DWORD cbBitsSrc ;
  760. PBITMAPINFO pbmi ;
  761. LPBYTE lpBits ;
  762. LONG xMask ;
  763. LONG yMask ;
  764. DWORD iUsageMask ;
  765. DWORD offBmiMask ;
  766. DWORD cbBmiMask ;
  767. DWORD offBitsMask ;
  768. DWORD cbBitsMask ;
  769. PBITMAPINFO pbmiMask ;
  770. LPBYTE lpMaskBits ;
  771. pMfMaskBlt = (PEMRMASKBLT) pVoid ;
  772. xDest = pMfMaskBlt->xDest ;
  773. yDest = pMfMaskBlt->yDest ;
  774. cxDest = pMfMaskBlt->cxDest ;
  775. cyDest = pMfMaskBlt->cyDest ;
  776. dwRop = pMfMaskBlt->dwRop ;
  777. xSrc = pMfMaskBlt->xSrc ;
  778. ySrc = pMfMaskBlt->ySrc ;
  779. pxformSrc =&(pMfMaskBlt->xformSrc) ;
  780. crBkColorSrc = pMfMaskBlt->crBkColorSrc ; // not used
  781. iUsageSrc = pMfMaskBlt->iUsageSrc ;
  782. offBmiSrc = pMfMaskBlt->offBmiSrc ;
  783. cbBmiSrc = pMfMaskBlt->cbBmiSrc ;
  784. offBitsSrc = pMfMaskBlt->offBitsSrc ;
  785. cbBitsSrc = pMfMaskBlt->cbBitsSrc ;
  786. lpBits = (PBYTE) pMfMaskBlt + offBitsSrc ;
  787. pbmi = (PBITMAPINFO) ((PBYTE) pMfMaskBlt + offBmiSrc) ;
  788. xMask = pMfMaskBlt->xMask ;
  789. yMask = pMfMaskBlt->yMask ;
  790. iUsageMask = pMfMaskBlt->iUsageMask ;
  791. offBmiMask = pMfMaskBlt->offBmiMask ;
  792. cbBmiMask = pMfMaskBlt->cbBmiMask ;
  793. offBitsMask = pMfMaskBlt->offBitsMask ;
  794. cbBitsMask = pMfMaskBlt->cbBitsMask ;
  795. lpMaskBits = (PBYTE) pMfMaskBlt + offBitsMask ;
  796. pbmiMask = (PBITMAPINFO) ((PBYTE) pMfMaskBlt + offBmiMask) ;
  797. b = DoMaskBlt(pLocalDC,
  798. xDest,
  799. yDest,
  800. cxDest,
  801. cyDest,
  802. dwRop,
  803. xSrc,
  804. ySrc,
  805. pxformSrc,
  806. iUsageSrc,
  807. pbmi,
  808. cbBmiSrc,
  809. lpBits,
  810. cbBitsSrc,
  811. xMask,
  812. yMask,
  813. iUsageMask,
  814. pbmiMask,
  815. cbBmiMask,
  816. lpMaskBits,
  817. cbBitsMask);
  818. return(b) ;
  819. }
  820. /**************************************************************************
  821. * Handler - PlgBlt
  822. *************************************************************************/
  823. BOOL bHandlePlgBlt(PVOID pVoid, PLOCALDC pLocalDC)
  824. {
  825. BOOL b ;
  826. PEMRPLGBLT pMfPlgBlt ;
  827. PPOINTL pptlDest ;
  828. LONG xSrc ;
  829. LONG ySrc ;
  830. LONG cxSrc ;
  831. LONG cySrc ;
  832. PXFORM pxformSrc ;
  833. COLORREF crBkColorSrc ;
  834. DWORD iUsageSrc ;
  835. DWORD offBmiSrc ;
  836. DWORD cbBmiSrc ;
  837. DWORD offBitsSrc ;
  838. DWORD cbBitsSrc ;
  839. PBITMAPINFO pbmi ;
  840. LPBYTE lpBits ;
  841. LONG xMask ;
  842. LONG yMask ;
  843. DWORD iUsageMask ;
  844. DWORD offBmiMask ;
  845. DWORD cbBmiMask ;
  846. DWORD offBitsMask ;
  847. DWORD cbBitsMask ;
  848. PBITMAPINFO pbmiMask ;
  849. LPBYTE lpMaskBits ;
  850. pMfPlgBlt = (PEMRPLGBLT) pVoid ;
  851. pptlDest = pMfPlgBlt->aptlDest ;
  852. xSrc = pMfPlgBlt->xSrc ;
  853. ySrc = pMfPlgBlt->ySrc ;
  854. cxSrc = pMfPlgBlt->cxSrc ;
  855. cySrc = pMfPlgBlt->cySrc ;
  856. pxformSrc =&(pMfPlgBlt->xformSrc) ;
  857. crBkColorSrc = pMfPlgBlt->crBkColorSrc ; // not used
  858. iUsageSrc = pMfPlgBlt->iUsageSrc ;
  859. offBmiSrc = pMfPlgBlt->offBmiSrc ;
  860. cbBmiSrc = pMfPlgBlt->cbBmiSrc ;
  861. offBitsSrc = pMfPlgBlt->offBitsSrc ;
  862. cbBitsSrc = pMfPlgBlt->cbBitsSrc ;
  863. lpBits = (PBYTE) pMfPlgBlt + offBitsSrc ;
  864. pbmi = (PBITMAPINFO) ((PBYTE) pMfPlgBlt + offBmiSrc) ;
  865. xMask = pMfPlgBlt->xMask ;
  866. yMask = pMfPlgBlt->yMask ;
  867. iUsageMask = pMfPlgBlt->iUsageMask ;
  868. offBmiMask = pMfPlgBlt->offBmiMask ;
  869. cbBmiMask = pMfPlgBlt->cbBmiMask ;
  870. offBitsMask = pMfPlgBlt->offBitsMask ;
  871. cbBitsMask = pMfPlgBlt->cbBitsMask ;
  872. lpMaskBits = (PBYTE) pMfPlgBlt + offBitsMask ;
  873. pbmiMask = (PBITMAPINFO) ((PBYTE) pMfPlgBlt + offBmiMask) ;
  874. b = DoPlgBlt(pLocalDC,
  875. pptlDest,
  876. xSrc,
  877. ySrc,
  878. cxSrc,
  879. cySrc,
  880. pxformSrc,
  881. iUsageSrc,
  882. pbmi,
  883. cbBmiSrc,
  884. lpBits,
  885. cbBitsSrc,
  886. xMask,
  887. yMask,
  888. iUsageMask,
  889. pbmiMask,
  890. cbBmiMask,
  891. lpMaskBits,
  892. cbBitsMask);
  893. return(b) ;
  894. }
  895. /**************************************************************************
  896. * Handler - Save DC
  897. *************************************************************************/
  898. BOOL bHandleSaveDC(PVOID pVoid, PLOCALDC pLocalDC)
  899. {
  900. BOOL b ;
  901. NOTUSED(pVoid) ;
  902. b = DoSaveDC(pLocalDC) ;
  903. return(b) ;
  904. }
  905. /**************************************************************************
  906. * Handler - Restore DC
  907. *************************************************************************/
  908. BOOL bHandleRestoreDC(PVOID pVoid, PLOCALDC pLocalDC)
  909. {
  910. BOOL b ;
  911. PEMRRESTOREDC pMfRestoreDc ;
  912. INT nSavedDC ;
  913. pMfRestoreDc = (PEMRRESTOREDC) pVoid ;
  914. nSavedDC = (INT) pMfRestoreDc->iRelative ;
  915. b = DoRestoreDC(pLocalDC, nSavedDC) ;
  916. return(b) ;
  917. }
  918. /**************************************************************************
  919. * Handler - End of File
  920. *************************************************************************/
  921. BOOL bHandleEOF(PVOID pVoid, PLOCALDC pLocalDC)
  922. {
  923. NOTUSED(pVoid) ;
  924. DoEOF(pLocalDC) ;
  925. return (TRUE) ;
  926. }
  927. /**************************************************************************
  928. * Handler - Header
  929. *************************************************************************/
  930. BOOL bHandleHeader(PVOID pVoid, PLOCALDC pLocalDC)
  931. {
  932. BOOL b ;
  933. PENHMETAHEADER pemfheader ;
  934. pemfheader = (PENHMETAHEADER) pVoid ;
  935. b = DoHeader(pLocalDC, pemfheader) ;
  936. return (b) ;
  937. }
  938. /**************************************************************************
  939. * Handler - ScaleWindowExtEx
  940. *************************************************************************/
  941. BOOL bHandleScaleWindowExt(PVOID pVoid, PLOCALDC pLocalDC)
  942. {
  943. BOOL b ;
  944. PEMRSCALEWINDOWEXTEX pMfScaleWindowExt ;
  945. INT Xnum,
  946. Xdenom,
  947. Ynum,
  948. Ydenom ;
  949. pMfScaleWindowExt = (PEMRSCALEWINDOWEXTEX) pVoid ;
  950. // Scale the MapMode Mode
  951. Xnum = (INT) pMfScaleWindowExt->xNum ;
  952. Xdenom = (INT) pMfScaleWindowExt->xDenom ;
  953. Ynum = (INT) pMfScaleWindowExt->yNum ;
  954. Ydenom = (INT) pMfScaleWindowExt->yDenom ;
  955. // Do the translation.
  956. b = DoScaleWindowExt(pLocalDC, Xnum, Xdenom, Ynum, Ydenom) ;
  957. return (b) ;
  958. }
  959. /**************************************************************************
  960. * Handler - ScaleViewportExtEx
  961. *************************************************************************/
  962. BOOL bHandleScaleViewportExt(PVOID pVoid, PLOCALDC pLocalDC)
  963. {
  964. BOOL b ;
  965. PEMRSCALEVIEWPORTEXTEX pMfScaleViewportExt ;
  966. INT Xnum,
  967. Xdenom,
  968. Ynum,
  969. Ydenom ;
  970. pMfScaleViewportExt = (PEMRSCALEVIEWPORTEXTEX) pVoid ;
  971. // Scale the MapMode Mode
  972. Xnum = (INT) pMfScaleViewportExt->xNum ;
  973. Xdenom = (INT) pMfScaleViewportExt->xDenom ;
  974. Ynum = (INT) pMfScaleViewportExt->yNum ;
  975. Ydenom = (INT) pMfScaleViewportExt->yDenom ;
  976. // Do the translation.
  977. b = DoScaleViewportExt(pLocalDC, Xnum, Xdenom, Ynum, Ydenom) ;
  978. return (b) ;
  979. }
  980. /**************************************************************************
  981. * Handler - SetViewportExtEx
  982. *************************************************************************/
  983. BOOL bHandleSetViewportExt(PVOID pVoid, PLOCALDC pLocalDC)
  984. {
  985. BOOL b ;
  986. PEMRSETVIEWPORTEXTEX pMfSetViewportExt ;
  987. LONG x, y ;
  988. pMfSetViewportExt = (PEMRSETVIEWPORTEXTEX) pVoid ;
  989. // Set the MapMode Mode
  990. x = pMfSetViewportExt->szlExtent.cx ;
  991. y = pMfSetViewportExt->szlExtent.cy ;
  992. // Do the translation.
  993. b = DoSetViewportExt(pLocalDC, (INT) x, (INT) y) ;
  994. return (b) ;
  995. }
  996. /**************************************************************************
  997. * Handler - SetViewportOrgEx
  998. *************************************************************************/
  999. BOOL bHandleSetViewportOrg(PVOID pVoid, PLOCALDC pLocalDC)
  1000. {
  1001. BOOL b ;
  1002. PEMRSETVIEWPORTORGEX pMfSetViewportOrg ;
  1003. LONG x, y ;
  1004. pMfSetViewportOrg = (PEMRSETVIEWPORTORGEX) pVoid ;
  1005. // Set the MapMode Mode
  1006. x = pMfSetViewportOrg->ptlOrigin.x ;
  1007. y = pMfSetViewportOrg->ptlOrigin.y ;
  1008. // Do the translation.
  1009. b = DoSetViewportOrg(pLocalDC, (INT) x, (INT) y) ;
  1010. return (b) ;
  1011. }
  1012. /**************************************************************************
  1013. * Handler - SetWindowExtEx
  1014. *************************************************************************/
  1015. BOOL bHandleSetWindowExt(PVOID pVoid, PLOCALDC pLocalDC)
  1016. {
  1017. BOOL b ;
  1018. PEMRSETWINDOWEXTEX pMfSetWindowExt ;
  1019. LONG x, y ;
  1020. pMfSetWindowExt = (PEMRSETWINDOWEXTEX) pVoid ;
  1021. // Set the MapMode Mode
  1022. x = pMfSetWindowExt->szlExtent.cx ;
  1023. y = pMfSetWindowExt->szlExtent.cy ;
  1024. // Do the translation.
  1025. b = DoSetWindowExt(pLocalDC, (INT) x, (INT) y) ;
  1026. return (b) ;
  1027. }
  1028. /**************************************************************************
  1029. * Handler - SetWindowOrgEx
  1030. *************************************************************************/
  1031. BOOL bHandleSetWindowOrg(PVOID pVoid, PLOCALDC pLocalDC)
  1032. {
  1033. BOOL b ;
  1034. PEMRSETWINDOWORGEX pMfSetWindowOrg ;
  1035. LONG x, y ;
  1036. pMfSetWindowOrg = (PEMRSETWINDOWORGEX) pVoid ;
  1037. // Set the MapMode Mode
  1038. x = pMfSetWindowOrg->ptlOrigin.x ;
  1039. y = pMfSetWindowOrg->ptlOrigin.y ;
  1040. // Do the translation.
  1041. b = DoSetWindowOrg(pLocalDC, (INT) x, (INT) y) ;
  1042. return (b) ;
  1043. }
  1044. /**************************************************************************
  1045. * Handler - SetMapMode
  1046. *************************************************************************/
  1047. BOOL bHandleSetMapMode(PVOID pVoid, PLOCALDC pLocalDC)
  1048. {
  1049. BOOL b ;
  1050. DWORD iMapMode ;
  1051. PEMRSETMAPMODE pMfSetMapMode ;
  1052. pMfSetMapMode = (PEMRSETMAPMODE) pVoid ;
  1053. // Set the MapMode Mode
  1054. iMapMode = pMfSetMapMode->iMode ;
  1055. // Do the translation.
  1056. b = DoSetMapMode(pLocalDC, iMapMode) ;
  1057. return (b) ;
  1058. }
  1059. /**************************************************************************
  1060. * Handler - SetArcDirection
  1061. *************************************************************************/
  1062. BOOL bHandleSetArcDirection(PVOID pVoid, PLOCALDC pLocalDC)
  1063. {
  1064. PEMRSETARCDIRECTION pMfSetArcDirection ;
  1065. INT iArcDirection ;
  1066. BOOL b ;
  1067. pMfSetArcDirection = (PEMRSETARCDIRECTION) pVoid ;
  1068. iArcDirection = (INT) pMfSetArcDirection->iArcDirection ;
  1069. b = DoSetArcDirection(pLocalDC, iArcDirection) ;
  1070. return (b) ;
  1071. }
  1072. /**************************************************************************
  1073. * Handler - AngleArc
  1074. *************************************************************************/
  1075. BOOL bHandleAngleArc(PVOID pVoid, PLOCALDC pLocalDC)
  1076. {
  1077. BOOL b ;
  1078. PEMRANGLEARC pMfAngleArc ;
  1079. int x, y;
  1080. DWORD nRadius ;
  1081. FLOAT eStartAngle,
  1082. eSweepAngle ;
  1083. pMfAngleArc = (PEMRANGLEARC) pVoid ;
  1084. // Set the Arc center
  1085. x = (int) pMfAngleArc->ptlCenter.x ;
  1086. y = (int) pMfAngleArc->ptlCenter.y ;
  1087. // Get the radius of the Arc
  1088. nRadius = (INT) pMfAngleArc->nRadius ;
  1089. // Set the start & sweep angles
  1090. eStartAngle = pMfAngleArc->eStartAngle ;
  1091. eSweepAngle = pMfAngleArc->eSweepAngle ;
  1092. b = DoAngleArc(pLocalDC, x, y, nRadius, eStartAngle, eSweepAngle) ;
  1093. return (b) ;
  1094. }
  1095. /**************************************************************************
  1096. * Handler - ArcTo
  1097. *************************************************************************/
  1098. BOOL bHandleArcTo(PVOID pVoid, PLOCALDC pLocalDC)
  1099. {
  1100. BOOL b ;
  1101. PEMRARCTO pMfArcTo ;
  1102. INT x1, x2, x3, x4,
  1103. y1, y2, y3, y4 ;
  1104. pMfArcTo = (PEMRARCTO) pVoid ;
  1105. // Set up the ellipse box, this will be the same as the bounding
  1106. // rectangle.
  1107. x1 = (INT) pMfArcTo->rclBox.left ;
  1108. y1 = (INT) pMfArcTo->rclBox.top ;
  1109. x2 = (INT) pMfArcTo->rclBox.right ;
  1110. y2 = (INT) pMfArcTo->rclBox.bottom ;
  1111. // Set the start point.
  1112. x3 = (INT) pMfArcTo->ptlStart.x ;
  1113. y3 = (INT) pMfArcTo->ptlStart.y ;
  1114. // Set the end point.
  1115. x4 = (INT) pMfArcTo->ptlEnd.x ;
  1116. y4 = (INT) pMfArcTo->ptlEnd.y ;
  1117. b = DoArcTo(pLocalDC, x1, y1, x2, y2, x3, y3, x4, y4) ;
  1118. return (b) ;
  1119. }
  1120. /**************************************************************************
  1121. * Handler - Arc
  1122. *************************************************************************/
  1123. BOOL bHandleArc(PVOID pVoid, PLOCALDC pLocalDC)
  1124. {
  1125. BOOL b ;
  1126. PEMRARC pMfArc ;
  1127. INT x1, x2, x3, x4,
  1128. y1, y2, y3, y4 ;
  1129. pMfArc = (PEMRARC) pVoid ;
  1130. // Set up the ellipse box, this will be the same as the bounding
  1131. // rectangle.
  1132. x1 = (INT) pMfArc->rclBox.left ;
  1133. y1 = (INT) pMfArc->rclBox.top ;
  1134. x2 = (INT) pMfArc->rclBox.right ;
  1135. y2 = (INT) pMfArc->rclBox.bottom ;
  1136. // Set the start point.
  1137. x3 = (INT) pMfArc->ptlStart.x ;
  1138. y3 = (INT) pMfArc->ptlStart.y ;
  1139. // Set the end point.
  1140. x4 = (INT) pMfArc->ptlEnd.x ;
  1141. y4 = (INT) pMfArc->ptlEnd.y ;
  1142. b = DoArc(pLocalDC, x1, y1, x2, y2, x3, y3, x4, y4) ;
  1143. return (b) ;
  1144. }
  1145. /**************************************************************************
  1146. * Handler - Ellipse
  1147. *************************************************************************/
  1148. BOOL bHandleEllipse(PVOID pVoid, PLOCALDC pLocalDC)
  1149. {
  1150. BOOL b ;
  1151. INT x1, y1, x2, y2 ;
  1152. PEMRELLIPSE pMfEllipse ;
  1153. pMfEllipse = (PEMRELLIPSE) pVoid ;
  1154. // Set up the ellipse box, this will be the same as the bounding
  1155. // rectangle.
  1156. x1 = (INT) pMfEllipse->rclBox.left ;
  1157. y1 = (INT) pMfEllipse->rclBox.top ;
  1158. x2 = (INT) pMfEllipse->rclBox.right ;
  1159. y2 = (INT) pMfEllipse->rclBox.bottom ;
  1160. // Do the Ellipse translation.
  1161. b = DoEllipse(pLocalDC, x1, y1, x2, y2) ;
  1162. return (b) ;
  1163. }
  1164. /**************************************************************************
  1165. * Handler - SelectObject
  1166. *************************************************************************/
  1167. BOOL bHandleSelectObject(PVOID pVoid, PLOCALDC pLocalDC)
  1168. {
  1169. BOOL b ;
  1170. PEMRSELECTOBJECT pMfSelectObject ;
  1171. INT ihObject ;
  1172. pMfSelectObject = (PEMRSELECTOBJECT) pVoid ;
  1173. // Get the Object (it's really a Long)
  1174. ihObject = (INT) pMfSelectObject->ihObject ;
  1175. // Do the translation
  1176. b = DoSelectObject(pLocalDC, ihObject) ;
  1177. return (b) ;
  1178. }
  1179. /**************************************************************************
  1180. * Handler - DeleteObject
  1181. *************************************************************************/
  1182. BOOL bHandleDeleteObject(PVOID pVoid, PLOCALDC pLocalDC)
  1183. {
  1184. BOOL b ;
  1185. PEMRDELETEOBJECT pMfDeleteObject ;
  1186. INT ihObject ;
  1187. pMfDeleteObject = (PEMRDELETEOBJECT) pVoid ;
  1188. ihObject = (INT) pMfDeleteObject->ihObject ;
  1189. b = DoDeleteObject(pLocalDC, ihObject) ;
  1190. return(b) ;
  1191. }
  1192. /**************************************************************************
  1193. * Handler - CreateBrushIndirect
  1194. *************************************************************************/
  1195. BOOL bHandleCreateBrushIndirect(PVOID pVoid, PLOCALDC pLocalDC)
  1196. {
  1197. BOOL b ;
  1198. PEMRCREATEBRUSHINDIRECT pMfCreateBrushIndirect ;
  1199. LOGBRUSH LogBrush ;
  1200. INT ihBrush ;
  1201. pMfCreateBrushIndirect = (PEMRCREATEBRUSHINDIRECT) pVoid ;
  1202. // Get the Brush parameters.
  1203. LogBrush.lbStyle = pMfCreateBrushIndirect->lb.lbStyle;
  1204. LogBrush.lbColor = pMfCreateBrushIndirect->lb.lbColor;
  1205. LogBrush.lbHatch = (ULONG_PTR)pMfCreateBrushIndirect->lb.lbHatch;
  1206. ihBrush = pMfCreateBrushIndirect->ihBrush ;
  1207. // Do the translation.
  1208. b = DoCreateBrushIndirect(pLocalDC, ihBrush, &LogBrush) ;
  1209. return (b) ;
  1210. }
  1211. /**************************************************************************
  1212. * Handler - CreateMonoBrush
  1213. *************************************************************************/
  1214. BOOL bHandleCreateMonoBrush(PVOID pVoid, PLOCALDC pLocalDC)
  1215. {
  1216. BOOL b ;
  1217. PEMRCREATEMONOBRUSH pMfCreateMonoBrush ;
  1218. DWORD ihBrush ;
  1219. DWORD iUsage ;
  1220. DWORD offBmi ;
  1221. DWORD cbBmi ;
  1222. DWORD offBits ;
  1223. DWORD cbBits ;
  1224. PBITMAPINFO pBmi ;
  1225. PBYTE pBits ;
  1226. pMfCreateMonoBrush = (PEMRCREATEMONOBRUSH) pVoid ;
  1227. ihBrush = pMfCreateMonoBrush->ihBrush ;
  1228. iUsage = pMfCreateMonoBrush->iUsage ;
  1229. offBmi = pMfCreateMonoBrush->offBmi ;
  1230. cbBmi = pMfCreateMonoBrush->cbBmi ;
  1231. offBits = pMfCreateMonoBrush->offBits ;
  1232. cbBits = pMfCreateMonoBrush->cbBits ;
  1233. pBmi = (PBITMAPINFO) ((PBYTE) pVoid + offBmi) ;
  1234. pBits = (PBYTE) pVoid + offBits ;
  1235. b = DoCreateMonoBrush(pLocalDC, ihBrush,
  1236. pBmi, cbBmi,
  1237. pBits, cbBits,
  1238. iUsage) ;
  1239. return (b) ;
  1240. }
  1241. /**************************************************************************
  1242. * Handler - CreateDIBPatternBrush
  1243. *************************************************************************/
  1244. BOOL bHandleCreateDIBPatternBrush(PVOID pVoid, PLOCALDC pLocalDC)
  1245. {
  1246. BOOL b ;
  1247. PEMRCREATEDIBPATTERNBRUSHPT pMfCreateDIBPatternBrush ;
  1248. DWORD ihBrush ;
  1249. DWORD iUsage ;
  1250. DWORD offBmi ;
  1251. DWORD cbBmi ;
  1252. DWORD offBits ;
  1253. DWORD cbBits ;
  1254. PBITMAPINFO pBmi ;
  1255. PBYTE pBits ;
  1256. pMfCreateDIBPatternBrush = (PEMRCREATEDIBPATTERNBRUSHPT) pVoid ;
  1257. ihBrush = pMfCreateDIBPatternBrush->ihBrush ;
  1258. iUsage = pMfCreateDIBPatternBrush->iUsage ;
  1259. offBmi = pMfCreateDIBPatternBrush->offBmi ;
  1260. cbBmi = pMfCreateDIBPatternBrush->cbBmi ;
  1261. offBits = pMfCreateDIBPatternBrush->offBits ;
  1262. cbBits = pMfCreateDIBPatternBrush->cbBits ;
  1263. pBmi = (PBITMAPINFO) ((PBYTE) pVoid + offBmi) ;
  1264. pBits = (PBYTE) pVoid + offBits ;
  1265. b = DoCreateDIBPatternBrush(pLocalDC, ihBrush,
  1266. pBmi, cbBmi,
  1267. pBits, cbBits,
  1268. iUsage) ;
  1269. return (b) ;
  1270. }
  1271. /**************************************************************************
  1272. * Handler - CreatePen
  1273. *************************************************************************/
  1274. BOOL bHandleCreatePen(PVOID pVoid, PLOCALDC pLocalDC)
  1275. {
  1276. PEMRCREATEPEN pMfCreatePen ;
  1277. INT ihPen ;
  1278. PLOGPEN pLogPen ;
  1279. BOOL b ;
  1280. pMfCreatePen = (PEMRCREATEPEN) pVoid ;
  1281. ihPen = pMfCreatePen->ihPen ;
  1282. pLogPen = &pMfCreatePen->lopn ;
  1283. b = DoCreatePen(pLocalDC, ihPen, pLogPen) ;
  1284. return(b) ;
  1285. }
  1286. /**************************************************************************
  1287. * Handler - ExtCreatePen
  1288. *************************************************************************/
  1289. BOOL bHandleExtCreatePen(PVOID pVoid, PLOCALDC pLocalDC)
  1290. {
  1291. BOOL b ;
  1292. PEMREXTCREATEPEN pMfExtCreatePen ;
  1293. PEXTLOGPEN pExtLogPen ;
  1294. INT ihPen ;
  1295. pMfExtCreatePen = (PEMREXTCREATEPEN) pVoid ;
  1296. pExtLogPen = &pMfExtCreatePen->elp ;
  1297. ihPen = pMfExtCreatePen->ihPen ;
  1298. b = DoExtCreatePen(pLocalDC, ihPen, pExtLogPen) ;
  1299. return (b) ;
  1300. }
  1301. /**************************************************************************
  1302. * Handler - MoveToEx
  1303. *************************************************************************/
  1304. BOOL bHandleMoveTo(PVOID pVoid, PLOCALDC pLocalDC)
  1305. {
  1306. BOOL b ;
  1307. PEMRMOVETOEX pMfMoveTo ;
  1308. INT x, y ;
  1309. pMfMoveTo = (PEMRMOVETOEX) pVoid ;
  1310. // Get the position.
  1311. x = (INT) pMfMoveTo->ptl.x ;
  1312. y = (INT) pMfMoveTo->ptl.y ;
  1313. // Do the translation.
  1314. b = DoMoveTo(pLocalDC, x, y) ;
  1315. return (b) ;
  1316. }
  1317. /**************************************************************************
  1318. * Handler - LineTo
  1319. *************************************************************************/
  1320. BOOL bHandleLineTo(PVOID pVoid, PLOCALDC pLocalDC)
  1321. {
  1322. BOOL b ;
  1323. PEMRLINETO pMfLineTo ;
  1324. INT x, y ;
  1325. pMfLineTo = (PEMRLINETO) pVoid ;
  1326. // Get the new point.
  1327. x = (INT) pMfLineTo->ptl.x ;
  1328. y = (INT) pMfLineTo->ptl.y ;
  1329. // Do the translation.
  1330. b = DoLineTo(pLocalDC, x, y) ;
  1331. return (b) ;
  1332. }
  1333. /**************************************************************************
  1334. * Handler - Chord
  1335. *************************************************************************/
  1336. BOOL bHandleChord(PVOID pVoid, PLOCALDC pLocalDC)
  1337. {
  1338. BOOL b ;
  1339. PEMRCHORD pMfChord ;
  1340. INT x1, x2, x3, x4,
  1341. y1, y2, y3, y4 ;
  1342. pMfChord = (PEMRCHORD) pVoid ;
  1343. // Set the rectangle
  1344. x1 = (INT) pMfChord->rclBox.left ;
  1345. y1 = (INT) pMfChord->rclBox.top ;
  1346. x2 = (INT) pMfChord->rclBox.right ;
  1347. y2 = (INT) pMfChord->rclBox.bottom ;
  1348. // Set the start point.
  1349. x3 = (INT) pMfChord->ptlStart.x ;
  1350. y3 = (INT) pMfChord->ptlStart.y ;
  1351. // Set the end point.
  1352. x4 = (INT) pMfChord->ptlEnd.x ;
  1353. y4 = (INT) pMfChord->ptlEnd.y ;
  1354. // Do the translation
  1355. b = DoChord(pLocalDC, x1, y1, x2, y2, x3, y3, x4, y4) ;
  1356. return (b) ;
  1357. }
  1358. /**************************************************************************
  1359. * Handler - Pie
  1360. *************************************************************************/
  1361. BOOL bHandlePie(PVOID pVoid, PLOCALDC pLocalDC)
  1362. {
  1363. BOOL b ;
  1364. PEMRPIE pMfPie ;
  1365. INT x1, x2, x3, x4,
  1366. y1, y2, y3, y4 ;
  1367. pMfPie = (PEMRPIE) pVoid ;
  1368. // Set up the ellipse box
  1369. x1 = (INT) pMfPie->rclBox.left ;
  1370. y1 = (INT) pMfPie->rclBox.top ;
  1371. x2 = (INT) pMfPie->rclBox.right ;
  1372. y2 = (INT) pMfPie->rclBox.bottom ;
  1373. // Set the start point.
  1374. x3 = (INT) pMfPie->ptlStart.x ;
  1375. y3 = (INT) pMfPie->ptlStart.y ;
  1376. // Set the end point.
  1377. x4 = (INT) pMfPie->ptlEnd.x ;
  1378. y4 = (INT) pMfPie->ptlEnd.y ;
  1379. // Do the Pie translation.
  1380. b = DoPie(pLocalDC, x1, y1, x2, y2, x3, y3, x4, y4) ;
  1381. return (b) ;
  1382. }
  1383. /**************************************************************************
  1384. * Handler - Polyline
  1385. *************************************************************************/
  1386. BOOL bHandlePolyline(PVOID pVoid, PLOCALDC pLocalDC)
  1387. {
  1388. BOOL b ;
  1389. PEMRPOLYLINE pMfPolyline ;
  1390. INT nCount ;
  1391. PPOINTL pptl ;
  1392. pMfPolyline = (PEMRPOLYLINE) pVoid ;
  1393. // Copy the line count and the polyline verticies to
  1394. // the record.
  1395. nCount = (INT) pMfPolyline->cptl ;
  1396. pptl = pMfPolyline->aptl ;
  1397. // Now do the translation.
  1398. b = DoPoly(pLocalDC, pptl, nCount, EMR_POLYLINE, TRUE) ;
  1399. return (b) ;
  1400. }
  1401. /**************************************************************************
  1402. * Handler - PolylineTo
  1403. *************************************************************************/
  1404. BOOL bHandlePolylineTo (PVOID pVoid, PLOCALDC pLocalDC)
  1405. {
  1406. BOOL b ;
  1407. PEMRPOLYLINETO pMfPolylineTo ;
  1408. INT nCount ;
  1409. PPOINTL pptl ;
  1410. pMfPolylineTo = (PEMRPOLYLINETO) pVoid ;
  1411. // Copy the line count and the polyline verticies to
  1412. // the record.
  1413. nCount = (INT) pMfPolylineTo->cptl ;
  1414. pptl = pMfPolylineTo->aptl ;
  1415. // Now do the translation.
  1416. b = DoPolylineTo(pLocalDC, pptl, nCount) ;
  1417. return (b) ;
  1418. }
  1419. /**************************************************************************
  1420. * Handler - PolyBezier16,Polygon16,Polyline16,PolyBezierTo16,PolylineTo16
  1421. * PolyDraw16
  1422. *************************************************************************/
  1423. BOOL bHandlePoly16 (PVOID pVoid, PLOCALDC pLocalDC)
  1424. {
  1425. BOOL b = FALSE;
  1426. PEMRPOLYLINE16 pMfPoly16 ; // common structure for the poly16 records
  1427. PEMRPOLYDRAW16 pMfPolyDraw16 ;
  1428. POINTL aptl[MAX_STACK_POINTL];
  1429. PPOINTL pptl ;
  1430. INT nCount ;
  1431. PBYTE pb ;
  1432. // PolyDraw16 contains the structure of Poly16 followed by the byte array.
  1433. pMfPoly16 = (PEMRPOLYLINE16) pVoid ;
  1434. nCount = (INT) pMfPoly16->cpts ;
  1435. if (nCount <= MAX_STACK_POINTL)
  1436. pptl = aptl;
  1437. else if (!(pptl = (PPOINTL) LocalAlloc(LMEM_FIXED, nCount * sizeof(POINTL))))
  1438. return(b);
  1439. POINTS_TO_POINTL(pptl, pMfPoly16->apts, (DWORD) nCount);
  1440. // Now do the translation.
  1441. switch (pMfPoly16->emr.iType)
  1442. {
  1443. case EMR_POLYBEZIER16:
  1444. b = DoPolyBezier(pLocalDC, (LPPOINT) pptl, nCount) ;
  1445. break;
  1446. case EMR_POLYGON16:
  1447. b = DoPoly(pLocalDC, pptl, nCount, EMR_POLYGON, TRUE) ;
  1448. break;
  1449. case EMR_POLYLINE16:
  1450. b = DoPoly(pLocalDC, pptl, nCount, EMR_POLYLINE, TRUE) ;
  1451. break;
  1452. case EMR_POLYBEZIERTO16:
  1453. b = DoPolyBezierTo(pLocalDC, (LPPOINT) pptl, nCount) ;
  1454. break;
  1455. case EMR_POLYLINETO16:
  1456. b = DoPolylineTo(pLocalDC, pptl, nCount) ;
  1457. break;
  1458. case EMR_POLYDRAW16:
  1459. if (pfnSetVirtualResolution != NULL)
  1460. {
  1461. pMfPolyDraw16 = (PEMRPOLYDRAW16) pVoid ;
  1462. pb = (PBYTE) &pMfPolyDraw16->apts[nCount];
  1463. b = DoPolyDraw(pLocalDC, (LPPOINT) pptl, pb, nCount);
  1464. break;
  1465. }
  1466. // Fall through for win9x
  1467. default:
  1468. ASSERTGDI(FALSE, "Bad record type");
  1469. break;
  1470. }
  1471. if (nCount > MAX_STACK_POINTL)
  1472. if (LocalFree(pptl))
  1473. ASSERTGDI(FALSE, "bHandlePoly16: LocalFree failed");
  1474. return (b) ;
  1475. }
  1476. /**************************************************************************
  1477. * Handler - PolyPolyline
  1478. *************************************************************************/
  1479. BOOL bHandlePolyPolyline(PVOID pVoid, PLOCALDC pLocalDC)
  1480. {
  1481. BOOL b ;
  1482. PEMRPOLYPOLYLINE pMfPolyPolyline ;
  1483. PDWORD pPolyCount ;
  1484. PPOINTL pptl ;
  1485. INT nPolys ;
  1486. pMfPolyPolyline = (PEMRPOLYPOLYLINE) pVoid ;
  1487. // Copy the Polycount count, the polycount array
  1488. // and the polyline verticies to
  1489. // the record.
  1490. nPolys = (INT) pMfPolyPolyline->nPolys ;
  1491. pPolyCount = pMfPolyPolyline->aPolyCounts ;
  1492. pptl = (PPOINTL) &pMfPolyPolyline->aPolyCounts[nPolys] ;
  1493. // Now do the translation.
  1494. b = DoPolyPolyline(pLocalDC, pptl, pPolyCount, nPolys, TRUE) ;
  1495. return (b) ;
  1496. }
  1497. /**************************************************************************
  1498. * Handler - PolyPolyline16,PolyPolygon16
  1499. *************************************************************************/
  1500. BOOL bHandlePolyPoly16 (PVOID pVoid, PLOCALDC pLocalDC)
  1501. {
  1502. BOOL b = FALSE;
  1503. PEMRPOLYPOLYLINE16 pMfPolyPoly16 ; // common structure for polypoly16 records
  1504. PDWORD pPolyCount ;
  1505. POINTL aptl[MAX_STACK_POINTL];
  1506. PPOINTL pptl ;
  1507. INT nCount;
  1508. DWORD cpts ;
  1509. pMfPolyPoly16 = (PEMRPOLYPOLYLINE16) pVoid ;
  1510. nCount = (INT) pMfPolyPoly16->nPolys ;
  1511. cpts = pMfPolyPoly16->cpts;
  1512. pPolyCount = pMfPolyPoly16->aPolyCounts ;
  1513. if (cpts <= MAX_STACK_POINTL)
  1514. pptl = aptl;
  1515. else if (!(pptl = (PPOINTL) LocalAlloc(LMEM_FIXED, cpts * sizeof(POINTL))))
  1516. return(b);
  1517. POINTS_TO_POINTL(pptl, (PPOINTS) &pMfPolyPoly16->aPolyCounts[nCount], cpts);
  1518. // Now do the translation.
  1519. switch (pMfPolyPoly16->emr.iType)
  1520. {
  1521. case EMR_POLYPOLYLINE16:
  1522. b = DoPolyPolyline(pLocalDC, pptl, pPolyCount, nCount, TRUE) ;
  1523. break;
  1524. case EMR_POLYPOLYGON16:
  1525. b = DoPolyPolygon(pLocalDC, pptl, pPolyCount, cpts, nCount, TRUE) ;
  1526. break;
  1527. default:
  1528. ASSERTGDI(FALSE, "Bad record type");
  1529. break;
  1530. }
  1531. if (cpts > MAX_STACK_POINTL)
  1532. if (LocalFree(pptl))
  1533. ASSERTGDI(FALSE, "bHandlePolyPoly16: LocalFree failed");
  1534. return (b) ;
  1535. }
  1536. /**************************************************************************
  1537. * Handler - Polygon
  1538. *************************************************************************/
  1539. BOOL bHandlePolygon (PVOID pVoid, PLOCALDC pLocalDC)
  1540. {
  1541. BOOL b ;
  1542. PEMRPOLYGON pMfPolygon ;
  1543. PPOINTL pptl ;
  1544. INT nCount ;
  1545. pMfPolygon = (PEMRPOLYGON) pVoid ;
  1546. // Copy the line count and the Polygon verticies to
  1547. // the record.
  1548. nCount = (INT) pMfPolygon->cptl ;
  1549. pptl = pMfPolygon->aptl ;
  1550. // Now do the translation.
  1551. b = DoPoly(pLocalDC, pptl, nCount, EMR_POLYGON, TRUE) ;
  1552. return (b) ;
  1553. }
  1554. /**************************************************************************
  1555. * Handler - PolyPolygon
  1556. *************************************************************************/
  1557. BOOL bHandlePolyPolygon(PVOID pVoid, PLOCALDC pLocalDC)
  1558. {
  1559. BOOL b ;
  1560. PEMRPOLYPOLYGON pMfPolyPolygon ;
  1561. PDWORD pPolyCount ;
  1562. PPOINTL pptl ;
  1563. DWORD cptl ;
  1564. INT nPolys ;
  1565. pMfPolyPolygon = (PEMRPOLYPOLYGON) pVoid ;
  1566. // Copy the Polycount count, the polycount array
  1567. // and the polygon verticies to
  1568. // the record.
  1569. nPolys = (INT) pMfPolyPolygon->nPolys ;
  1570. pPolyCount = pMfPolyPolygon->aPolyCounts ;
  1571. pptl = (PPOINTL) &pMfPolyPolygon->aPolyCounts[nPolys] ;
  1572. cptl = pMfPolyPolygon->cptl ;
  1573. // Now do the translation.
  1574. b = DoPolyPolygon(pLocalDC, pptl, pPolyCount, cptl, nPolys, TRUE) ;
  1575. return (b) ;
  1576. }
  1577. /**************************************************************************
  1578. * Handler - Rectangle
  1579. *************************************************************************/
  1580. BOOL bHandleRectangle(PVOID pVoid, PLOCALDC pLocalDC)
  1581. {
  1582. BOOL b ;
  1583. PEMRRECTANGLE pMfRectangle ;
  1584. INT x1, y1, x2, y2 ;
  1585. pMfRectangle = (PEMRRECTANGLE) pVoid ;
  1586. // Set up the Rectangle box, this will be the same as the bounding
  1587. // rectangle.
  1588. x1 = (INT) pMfRectangle->rclBox.left ;
  1589. y1 = (INT) pMfRectangle->rclBox.top ;
  1590. x2 = (INT) pMfRectangle->rclBox.right ;
  1591. y2 = (INT) pMfRectangle->rclBox.bottom ;
  1592. // Do the Rectangle translation.
  1593. b = DoRectangle(pLocalDC, x1, y1, x2, y2) ;
  1594. return (b) ;
  1595. }
  1596. /**************************************************************************
  1597. * Handler - RoundRect
  1598. *************************************************************************/
  1599. BOOL bHandleRoundRect (PVOID pVoid, PLOCALDC pLocalDC)
  1600. {
  1601. BOOL b ;
  1602. PEMRROUNDRECT pMfRoundRect ;
  1603. INT x1, y1, x2, y2, x3, y3 ;
  1604. pMfRoundRect = (PEMRROUNDRECT) pVoid ;
  1605. // Set up the RoundRect box, this will be the same as the bounding
  1606. // RoundRect.
  1607. x1 = (INT) pMfRoundRect->rclBox.left ;
  1608. y1 = (INT) pMfRoundRect->rclBox.top ;
  1609. x2 = (INT) pMfRoundRect->rclBox.right ;
  1610. y2 = (INT) pMfRoundRect->rclBox.bottom ;
  1611. x3 = (INT) pMfRoundRect->szlCorner.cx ;
  1612. y3 = (INT) pMfRoundRect->szlCorner.cy ;
  1613. // Do the RoundRect translation.
  1614. b = DoRoundRect(pLocalDC, x1, y1, x2, y2, x3, y3) ;
  1615. return (b) ;
  1616. }
  1617. /**************************************************************************
  1618. * Handler - ExtTextOut for both ANSI and UNICODE characters.
  1619. **************************************************************************/
  1620. BOOL bHandleExtTextOut(PVOID pVoid, PLOCALDC pLocalDC)
  1621. {
  1622. BOOL b ;
  1623. PEMREXTTEXTOUTA pMfExtTextOut ; // same for both ansi and unicode
  1624. INT x, y, nCount ;
  1625. DWORD flOptions ;
  1626. PRECTL pRectl ;
  1627. PLONG pDx ;
  1628. PWCH pwchar ;
  1629. DWORD iGraphicsMode;
  1630. pMfExtTextOut = (PEMREXTTEXTOUTA) pVoid ;
  1631. ASSERTGDI(pMfExtTextOut->emr.iType == EMR_EXTTEXTOUTA
  1632. || pMfExtTextOut->emr.iType == EMR_EXTTEXTOUTW,
  1633. "MF3216: bHandleExtTextOut: bad record type");
  1634. // Copy over the start position for the string.
  1635. x = (INT) pMfExtTextOut->emrtext.ptlReference.x ;
  1636. y = (INT) pMfExtTextOut->emrtext.ptlReference.y ;
  1637. // Now copy over the Options flag, character count,
  1638. // the clip/opaque rectangle, and the Ansi/Unicode string.
  1639. flOptions = pMfExtTextOut->emrtext.fOptions ;
  1640. nCount = (INT) pMfExtTextOut->emrtext.nChars ;
  1641. pRectl = &pMfExtTextOut->emrtext.rcl ;
  1642. pwchar = (PWCH) ((PBYTE) pMfExtTextOut + pMfExtTextOut->emrtext.offString);
  1643. iGraphicsMode = pMfExtTextOut->iGraphicsMode;
  1644. // Set up the spacing vector
  1645. pDx = (PLONG) ((PBYTE) pMfExtTextOut + pMfExtTextOut->emrtext.offDx);
  1646. // Now do the conversion.
  1647. b = DoExtTextOut(pLocalDC, x, y, flOptions,
  1648. pRectl, pwchar, nCount, pDx, iGraphicsMode,
  1649. pMfExtTextOut->emr.iType);
  1650. return (b) ;
  1651. }
  1652. /**************************************************************************
  1653. * Handler - PolyTextOut for both ANSI and UNICODE characters.
  1654. **************************************************************************/
  1655. BOOL bHandlePolyTextOut(PVOID pVoid, PLOCALDC pLocalDC)
  1656. {
  1657. PEMRPOLYTEXTOUTA pMfPolyTextOut; // same for both ansi and unicode
  1658. PWCH pwchar;
  1659. LONG i;
  1660. DWORD iType;
  1661. LONG cStrings;
  1662. PEMRTEXT pemrtext;
  1663. PLONG pDx ;
  1664. DWORD iGraphicsMode;
  1665. pMfPolyTextOut = (PEMRPOLYTEXTOUTA) pVoid ;
  1666. ASSERTGDI(pMfPolyTextOut->emr.iType == EMR_POLYTEXTOUTA
  1667. || pMfPolyTextOut->emr.iType == EMR_POLYTEXTOUTW,
  1668. "MF3216: bHandlePolyTextOut: bad record type");
  1669. iType = pMfPolyTextOut->emr.iType == EMR_POLYTEXTOUTA
  1670. ? EMR_EXTTEXTOUTA
  1671. : EMR_EXTTEXTOUTW;
  1672. cStrings = pMfPolyTextOut->cStrings;
  1673. iGraphicsMode = pMfPolyTextOut->iGraphicsMode;
  1674. // Convert to ExtTextOut
  1675. for (i = 0; i < cStrings; i++)
  1676. {
  1677. pemrtext = &pMfPolyTextOut->aemrtext[i];
  1678. pwchar = (PWCH) ((PBYTE) pMfPolyTextOut + pemrtext->offString);
  1679. pDx = (PLONG) ((PBYTE) pMfPolyTextOut + pemrtext->offDx);
  1680. if (!DoExtTextOut(pLocalDC, pemrtext->ptlReference.x, pemrtext->ptlReference.y,
  1681. pemrtext->fOptions, &pemrtext->rcl,
  1682. pwchar, pemrtext->nChars, pDx, iGraphicsMode, iType))
  1683. return(FALSE);
  1684. }
  1685. return(TRUE);
  1686. }
  1687. /**************************************************************************
  1688. * Handler - ExtCreateFont
  1689. *************************************************************************/
  1690. BOOL bHandleExtCreateFont(PVOID pVoid, PLOCALDC pLocalDC)
  1691. {
  1692. BOOL b;
  1693. PEMREXTCREATEFONTINDIRECTW pMfExtCreateFontW;
  1694. LOGFONTA lfa = {0};
  1695. INT ihFont;
  1696. int iRet = 0;
  1697. pMfExtCreateFontW = (PEMREXTCREATEFONTINDIRECTW) pVoid ;
  1698. // Get the font parameters.
  1699. ihFont = (INT) pMfExtCreateFontW->ihFont ;
  1700. lfa.lfHeight = pMfExtCreateFontW->elfw.elfLogFont.lfHeight;
  1701. lfa.lfWidth = pMfExtCreateFontW->elfw.elfLogFont.lfWidth;
  1702. lfa.lfEscapement = pMfExtCreateFontW->elfw.elfLogFont.lfEscapement;
  1703. lfa.lfOrientation = pMfExtCreateFontW->elfw.elfLogFont.lfOrientation;
  1704. lfa.lfWeight = pMfExtCreateFontW->elfw.elfLogFont.lfWeight;
  1705. lfa.lfItalic = pMfExtCreateFontW->elfw.elfLogFont.lfItalic;
  1706. lfa.lfUnderline = pMfExtCreateFontW->elfw.elfLogFont.lfUnderline;
  1707. lfa.lfStrikeOut = pMfExtCreateFontW->elfw.elfLogFont.lfStrikeOut;
  1708. lfa.lfCharSet = pMfExtCreateFontW->elfw.elfLogFont.lfCharSet;
  1709. lfa.lfOutPrecision = pMfExtCreateFontW->elfw.elfLogFont.lfOutPrecision;
  1710. lfa.lfClipPrecision = pMfExtCreateFontW->elfw.elfLogFont.lfClipPrecision;
  1711. lfa.lfQuality = pMfExtCreateFontW->elfw.elfLogFont.lfQuality;
  1712. lfa.lfPitchAndFamily = pMfExtCreateFontW->elfw.elfLogFont.lfPitchAndFamily;
  1713. iRet = WideCharToMultiByte(CP_ACP,
  1714. 0,
  1715. pMfExtCreateFontW->elfw.elfLogFont.lfFaceName,
  1716. -1,
  1717. lfa.lfFaceName,
  1718. sizeof(lfa.lfFaceName),
  1719. NULL, NULL);
  1720. if (iRet == 0)
  1721. {
  1722. ASSERTGDI(FALSE, "WideCharToMultByte failed to convert lfFaceName");
  1723. return FALSE;
  1724. }
  1725. // Do the translation.
  1726. b = DoExtCreateFont(pLocalDC, ihFont, &lfa);
  1727. return (b) ;
  1728. }
  1729. /**************************************************************************
  1730. * Handler - SetBkColor
  1731. *************************************************************************/
  1732. BOOL bHandleSetBkColor(PVOID pVoid, PLOCALDC pLocalDC)
  1733. {
  1734. BOOL b ;
  1735. PEMRSETBKCOLOR pMfSetBkColor ;
  1736. pMfSetBkColor = (PEMRSETBKCOLOR) pVoid ;
  1737. // Do the translation.
  1738. b = DoSetBkColor(pLocalDC, pMfSetBkColor->crColor) ;
  1739. return (b) ;
  1740. }
  1741. /**************************************************************************
  1742. * Handler - SetBkMode
  1743. *************************************************************************/
  1744. BOOL bHandleSetBkMode(PVOID pVoid, PLOCALDC pLocalDC)
  1745. {
  1746. BOOL b ;
  1747. DWORD iBkMode ;
  1748. PEMRSETBKMODE pMfSetBkMode ;
  1749. pMfSetBkMode = (PEMRSETBKMODE) pVoid ;
  1750. // Set the Background Mode variable
  1751. iBkMode = pMfSetBkMode->iMode ;
  1752. // Do the translation.
  1753. b = DoSetBkMode(pLocalDC, iBkMode) ;
  1754. return (b) ;
  1755. }
  1756. /**************************************************************************
  1757. * Handler - SetMapperFlags
  1758. *************************************************************************/
  1759. BOOL bHandleSetMapperFlags(PVOID pVoid, PLOCALDC pLocalDC)
  1760. {
  1761. BOOL b ;
  1762. DWORD f ;
  1763. PEMRSETMAPPERFLAGS pMfSetMapperFlags ;
  1764. pMfSetMapperFlags = (PEMRSETMAPPERFLAGS) pVoid ;
  1765. f = pMfSetMapperFlags->dwFlags ;
  1766. // Do the translation.
  1767. b = DoSetMapperFlags(pLocalDC, f) ;
  1768. return (b) ;
  1769. }
  1770. /**************************************************************************
  1771. * Handler - SetPolyFillMode
  1772. *************************************************************************/
  1773. BOOL bHandleSetPolyFillMode(PVOID pVoid, PLOCALDC pLocalDC)
  1774. {
  1775. BOOL b ;
  1776. INT iPolyFillMode ;
  1777. PEMRSETPOLYFILLMODE pMfSetPolyFillMode ;
  1778. pMfSetPolyFillMode = (PEMRSETPOLYFILLMODE) pVoid ;
  1779. // Set the PolyFill Mode
  1780. iPolyFillMode = (INT) pMfSetPolyFillMode->iMode ;
  1781. // Do the translation.
  1782. b = DoSetPolyFillMode(pLocalDC, iPolyFillMode) ;
  1783. return (b) ;
  1784. }
  1785. /**************************************************************************
  1786. * Handler - SetRop2
  1787. *************************************************************************/
  1788. BOOL bHandleSetRop2(PVOID pVoid, PLOCALDC pLocalDC)
  1789. {
  1790. BOOL b ;
  1791. DWORD iDrawMode ;
  1792. PEMRSETROP2 pMfSetROP2 ;
  1793. pMfSetROP2 = (PEMRSETROP2) pVoid ;
  1794. // Set the Draw Mode
  1795. iDrawMode = pMfSetROP2->iMode ;
  1796. // Do the translation.
  1797. b = DoSetRop2(pLocalDC, iDrawMode) ;
  1798. return (b) ;
  1799. }
  1800. /**************************************************************************
  1801. * Handler - SetStretchBltMode
  1802. *************************************************************************/
  1803. BOOL bHandleSetStretchBltMode(PVOID pVoid, PLOCALDC pLocalDC)
  1804. {
  1805. BOOL b ;
  1806. DWORD iStretchMode ;
  1807. PEMRSETSTRETCHBLTMODE pMfSetStretchBltMode ;
  1808. pMfSetStretchBltMode = (PEMRSETSTRETCHBLTMODE) pVoid ;
  1809. // Set the StretchBlt Mode
  1810. iStretchMode = pMfSetStretchBltMode->iMode ;
  1811. // Do the translation.
  1812. b = DoSetStretchBltMode(pLocalDC, iStretchMode) ;
  1813. return (b) ;
  1814. }
  1815. /**************************************************************************
  1816. * Handler - SetTextAlign
  1817. *************************************************************************/
  1818. BOOL bHandleSetTextAlign(PVOID pVoid, PLOCALDC pLocalDC)
  1819. {
  1820. BOOL b ;
  1821. DWORD fMode ;
  1822. PEMRSETTEXTALIGN pMfSetTextAlign ;
  1823. pMfSetTextAlign = (PEMRSETTEXTALIGN) pVoid ;
  1824. // Set the TextAlign Mode
  1825. fMode = pMfSetTextAlign->iMode ;
  1826. // Do the translation.
  1827. b = DoSetTextAlign(pLocalDC, fMode) ;
  1828. return (b) ;
  1829. }
  1830. /**************************************************************************
  1831. * Handler - SetTextColor
  1832. *************************************************************************/
  1833. BOOL bHandleSetTextColor(PVOID pVoid, PLOCALDC pLocalDC)
  1834. {
  1835. BOOL b ;
  1836. PEMRSETTEXTCOLOR pMfSetTextColor ;
  1837. pMfSetTextColor = (PEMRSETTEXTCOLOR) pVoid ;
  1838. // Do the translation.
  1839. b = DoSetTextColor(pLocalDC, pMfSetTextColor->crColor) ;
  1840. return (b) ;
  1841. }