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.

646 lines
13 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. xloutput.h
  5. Abstract:
  6. PCL XL low level output
  7. Environment:
  8. Windows Whistler
  9. Revision History:
  10. 03/23/00
  11. Created it.
  12. --*/
  13. #ifndef _XLOUTPUT_H_
  14. #define _XLOUTPUT_H_
  15. #define RECT_WIDTH(pRect) ((pRect)->right - (pRect)->left)
  16. #define RECT_HEIGHT(pRect) ((pRect)->bottom - (pRect)->top)
  17. #define GET_FOREGROUND_ROP3(rop4) ((rop4) & 0xFF)
  18. #define GET_BACKGROUND_ROP3(rop4) (((rop4) >> 8) & 0xFF)
  19. #define ROP3_NEED_PATTERN(rop3) (((rop3 >> 4) & 0x0F) != (rop3 & 0x0F))
  20. #define ROP3_NEED_SOURCE(rop3) (((rop3 >> 2) & 0x33) != (rop3 & 0x33))
  21. #define ROP3_NEED_DEST(rop3) (((rop3 >> 1) & 0x55) != (rop3 & 0x55))
  22. //
  23. // PCLXL number type
  24. //
  25. typedef BYTE ubyte;
  26. typedef WORD uint16;
  27. typedef SHORT sint16;
  28. typedef DWORD uint32;
  29. typedef LONG sint32;
  30. typedef DWORD real32;
  31. class XLWrite
  32. #if DBG
  33. : public XLDebug
  34. #endif
  35. {
  36. SIGNATURE( 'xlwr' )
  37. public:
  38. XLWrite::
  39. XLWrite();
  40. XLWrite::
  41. ~XLWrite();
  42. inline
  43. HRESULT
  44. WriteByte(BYTE ubData);
  45. inline
  46. HRESULT
  47. Write(PBYTE pData, DWORD dwSize);
  48. inline
  49. HRESULT
  50. XLWrite::
  51. WriteFloat(
  52. real32 real32_value);
  53. HRESULT
  54. Flush(PDEVOBJ pdevobj);
  55. HRESULT
  56. Delete(VOID);
  57. #if DBG
  58. VOID
  59. SetDbgLevel(DWORD dwLevel);
  60. #endif
  61. private:
  62. HRESULT
  63. IncreaseBuffer(DWORD dwAdditionalDataSize);
  64. #define XLWrite_INITSIZE 2048
  65. #define XLWrite_ADDSIZE 2048
  66. PBYTE m_pBuffer;
  67. PBYTE m_pCurrentPoint;
  68. DWORD m_dwBufferSize;
  69. DWORD m_dwCurrentDataSize;
  70. };
  71. typedef enum XLCmd {
  72. eBeginSession = 0x41,
  73. eEndSession = 0x42,
  74. eBeginPage = 0x43,
  75. eEndPage = 0x44,
  76. eComment = 0x47,
  77. eOpenDataSource = 0x48,
  78. eCloseDataSource = 0x49,
  79. eBeginFontHeader = 0x4f,
  80. eReadFontHeader = 0x50,
  81. eEndFontHeader = 0x51,
  82. eBeginChar = 0x52,
  83. eReadChar = 0x53,
  84. eEndChar = 0x54,
  85. eRemoveFont = 0x55,
  86. eSetCharAttributes= 0x56,
  87. eBeginStream = 0x5b,
  88. eReadStream = 0x5c,
  89. eEndStream = 0x5d,
  90. eExecStream = 0x5e,
  91. ePopGS = 0x60,
  92. ePushGS = 0x61,
  93. eSetClipReplace = 0x62,
  94. eSetBrushSource = 0x63,
  95. eSetCharAngle = 0x64,
  96. eSetCharScale = 0x65,
  97. eSetCharShear = 0x66,
  98. eSetClipIntersect = 0x67,
  99. eSetClipRectangle = 0x68,
  100. eSetClipToPage = 0x69,
  101. eSetColorSpace = 0x6a,
  102. eSetCursor = 0x6b,
  103. eSetCursorRel = 0x6c,
  104. eSetHalftoneMethod = 0x6d,
  105. eSetFillMode = 0x6e,
  106. eSetFont = 0x6f,
  107. eSetLineDash = 0x70,
  108. eSetLineCap = 0x71,
  109. eSetLineJoin = 0x72,
  110. eSetMiterLimit = 0x73,
  111. eSetPageDefaultCTM = 0x74,
  112. eSetPageOrigin = 0x75,
  113. eSetPageRotation = 0x76,
  114. eSetPageScale = 0x77,
  115. eSetPatternTxMode = 0x78,
  116. eSetPenSource = 0x79,
  117. eSetPenWidth = 0x7a,
  118. eSetROP = 0x7b,
  119. eSetSourceTxMode = 0x7c,
  120. eSetCharBoldValue = 0x7d,
  121. eSetClipMode = 0x7f,
  122. eSetPathToClip = 0x80,
  123. eSetCharSubMode = 0x81,
  124. eCloseSubPath = 0x84,
  125. eNewPath = 0x85,
  126. ePaintPath = 0x86,
  127. eArcPath = 0x91,
  128. eBezierPath = 0x93,
  129. eBezierRelPath = 0x95,
  130. eChord = 0x96,
  131. eChordPath = 0x97,
  132. eEllipse = 0x98,
  133. eEllipsePath = 0x99,
  134. eLinePath = 0x9b,
  135. eLineRelPath = 0x9d,
  136. ePie = 0x9e,
  137. ePiePath = 0x9f,
  138. eRectangle = 0xa0,
  139. eRectanglePath = 0xa1,
  140. eRoundRectangle = 0xa2,
  141. eRoundRectanglePath = 0xa3,
  142. eText = 0xa8,
  143. eTextPath = 0xa9,
  144. eBeginImage = 0xb0,
  145. eReadImage = 0xb1,
  146. eEndImage = 0xb2,
  147. eBeginRastPattern = 0xb3,
  148. eReadRastPattern = 0xb4,
  149. eEndRastPattern = 0xb5,
  150. eBeginScan = 0xb6,
  151. eEndScan = 0xb8,
  152. eScanLineRel = 0xb9
  153. };
  154. //
  155. // Note: It is necessary to initialize HatchBrushAvailability when creating
  156. // XLOutput.
  157. //
  158. // BUGBUG: Brush management object has to be implemented
  159. //
  160. class XLGState;
  161. class XLOutput: public XLWrite,
  162. public XLGState
  163. {
  164. SIGNATURE( 'tolx' )
  165. public:
  166. XLOutput::
  167. XLOutput(VOID);
  168. XLOutput::
  169. ~XLOutput(VOID);
  170. //
  171. // Set scaling factor
  172. //
  173. DWORD
  174. GetResolutionForBrush();
  175. VOID
  176. SetResolutionForBrush(DWORD dwRes);
  177. //
  178. // Set device color depth (color/monochrome)
  179. //
  180. HRESULT
  181. SetDeviceColorDepth(ColorDepth DeviceColorDepth);
  182. ColorDepth
  183. GetDeviceColorDepth(VOID);
  184. //
  185. // HatchBrushAvailability set/get functions
  186. //
  187. VOID
  188. SetHatchBrushAvailability(
  189. DWORD dwHatchBrushAvailability);
  190. DWORD
  191. GetHatchBrushAvailability(
  192. VOID);
  193. //
  194. // Command
  195. //
  196. HRESULT
  197. Send_cmd(XLCmd Cmd);
  198. HRESULT
  199. Send_attr_ubyte(Attribute Attr);
  200. HRESULT
  201. Send_attr_uint16(Attribute Attr);
  202. //
  203. // Number
  204. //
  205. HRESULT
  206. Send_ubyte(ubyte ubyte_data);
  207. HRESULT
  208. Send_ubyte_xy(ubyte ubyte_x, ubyte ubyte_y);
  209. HRESULT
  210. Send_ubyte_box(ubyte ubyte_left, ubyte ubyte_top, ubyte ubyte_right, ubyte ubyte_bottom);
  211. HRESULT
  212. Send_ubyte_array_header(DWORD dwArrayNum);
  213. HRESULT
  214. Send_uint16(uint16 uint16_data);
  215. HRESULT
  216. Send_uint16_xy(uint16 uint16_x, uint16 uint16_y);
  217. HRESULT
  218. Send_uint16_box(uint16 uint16_left, uint16 uint16_top, uint16 uint16_right, uint16 uint16_bottom);
  219. HRESULT
  220. Send_uint16_array_header(DWORD dwArrayNum);
  221. HRESULT
  222. Send_uint32(uint32 uint32_data);
  223. HRESULT
  224. Send_uint32_xy(uint32 uint32_x, uint32 uint32_y);
  225. HRESULT
  226. Send_uint32_box(uint32 uint32_left, uint32 uint32_top, uint32 uint32_right, uint32 uint32_bottom);
  227. HRESULT
  228. Send_uint32_array_header(DWORD dwArrayNum);
  229. HRESULT
  230. Send_sint16(sint16 sint16_data);
  231. HRESULT
  232. Send_sint16_xy(sint16 sint16_x, sint16 sint16_y);
  233. HRESULT
  234. Send_sint16_box(sint16 sint16_left, sint16 sint16_top, sint16 sint16_right, sint16 sint16_bottom);
  235. HRESULT
  236. Send_sint16_array_header(DWORD dwArrayNum);
  237. HRESULT
  238. Send_sint32(sint32 sint32_data);
  239. HRESULT
  240. Send_sint32_xy(sint32 sint32_x, sint32 sint32_y);
  241. HRESULT
  242. Send_sint32_box(sint32 sint32_left, sint32 sint32_top, sint32 sint32_right, sint32 sint32_bottom);
  243. HRESULT
  244. Send_sint32_array_header(DWORD dwArrayNum);
  245. HRESULT
  246. Send_real32(real32 real32_data);
  247. HRESULT
  248. Send_real32_xy(real32 real32_x, real32 real32_y);
  249. HRESULT
  250. Send_real32_box(real32 real32_left, real32 real32_top, real32 real32_right, real32 real32_bottom);
  251. HRESULT
  252. Send_real32_array_header(DWORD dwArrayNum);
  253. //
  254. // Attribute
  255. //
  256. HRESULT
  257. SetArcDirection(ArcDirection value);
  258. HRESULT
  259. SetCharSubModeArray(CharSubModeArray value);
  260. HRESULT
  261. SetClipMode(ClipMode value);
  262. HRESULT
  263. SetClipRegion(ClipRegion value);
  264. HRESULT
  265. SetColorDepth(ColorDepth value);
  266. HRESULT
  267. SetColorimetricColorSpace(ColorimetricColorSpace value);
  268. HRESULT
  269. SetColorMapping(ColorMapping value);
  270. HRESULT
  271. SetColorSpace(ColorSpace value);
  272. HRESULT
  273. SetCompressMode(CompressMode value);
  274. HRESULT
  275. SetDataOrg(DataOrg value);
  276. #if 0
  277. HRESULT
  278. SetDataSource(DataSource value);
  279. #endif
  280. #if 0
  281. HRESULT
  282. SetDataType(DataType value);
  283. #endif
  284. #if 0
  285. HRESULT
  286. SetDitherMatrix(DitherMatrix value);
  287. #endif
  288. HRESULT
  289. SetDuplexPageMode(DuplexPageMode value);
  290. HRESULT
  291. SetDuplexPageSide(DuplexPageSide value);
  292. HRESULT
  293. SetErrorReport(ErrorReport value);
  294. HRESULT
  295. SetFillMode(FillMode value);
  296. HRESULT
  297. SetLineCap(LineCap value);
  298. HRESULT
  299. SetLineJoin(LineJoin value);
  300. HRESULT
  301. SetMiterLimit(uint16 uint16_miter);
  302. HRESULT
  303. SetMeasure(Measure value);
  304. HRESULT
  305. SetMediaSize(MediaSize value);
  306. HRESULT
  307. SetMediaSource(MediaSource value);
  308. HRESULT
  309. SetMediaDestination(MediaDestination value);
  310. HRESULT
  311. SetOrientation(Orientation value);
  312. HRESULT
  313. SetPatternPersistence(PatternPersistence value);
  314. HRESULT
  315. SetSimplexPageMode(SimplexPageMode value);
  316. HRESULT
  317. SetTxMode(TxMode value);
  318. #if 0
  319. HRESULT
  320. SetWritingMode(WritingMode value);
  321. #endif
  322. //
  323. // Number/value set function
  324. //
  325. HRESULT
  326. XLOutput::
  327. SetSourceWidth(
  328. uint16 srcwidth);
  329. HRESULT
  330. XLOutput::
  331. SetSourceHeight(
  332. uint16 srcheight);
  333. HRESULT
  334. XLOutput::
  335. SetDestinationSize(
  336. uint16 dstwidth,
  337. uint16 dstheight);
  338. HRESULT
  339. SetBoundingBox(
  340. sint16 left,
  341. sint16 top,
  342. sint16 right,
  343. sint16 bottom);
  344. HRESULT
  345. SetBoundingBox(
  346. uint16 left,
  347. uint16 top,
  348. uint16 right,
  349. uint16 bottom);
  350. HRESULT
  351. SetROP3(ROP3 rop3);
  352. HRESULT
  353. SetGrayLevel(ubyte ubyte_gray);
  354. HRESULT
  355. SetRGBColor(uint32 uint32_RGB);
  356. HRESULT
  357. SetPatternDefineID(
  358. sint16 sint16_patternid);
  359. HRESULT
  360. SetPaletteDepth(
  361. ColorDepth value);
  362. HRESULT
  363. SetPaletteData(
  364. ColorDepth value,
  365. DWORD dwPaletteNum,
  366. DWORD *pdwColorTable);
  367. HRESULT
  368. SetPenWidth(
  369. uint16 uint16_penwidth);
  370. HRESULT
  371. SetPageOrigin(
  372. uint16 uint16_x,
  373. uint16 uint16_y);
  374. HRESULT
  375. SetPageAngle(
  376. sint16 suint16_Angle);
  377. HRESULT
  378. SetPageScale(
  379. real32 real32_x,
  380. real32 real32_y);
  381. //
  382. // High level function
  383. //
  384. HRESULT
  385. BeginImage(
  386. ColorMapping CMapping,
  387. ULONG ulOutputBPP,
  388. ULONG ulSrcWidth,
  389. ULONG ulSrcHeight,
  390. ULONG ulDestWidth,
  391. ULONG ulDestHeight);
  392. HRESULT
  393. XLOutput::
  394. SetOutputBPP(
  395. ColorMapping CMapping,
  396. ULONG ulOutputBPP);
  397. HRESULT
  398. XLOutput::
  399. SetPalette(
  400. ULONG ulOutputBPP,
  401. DWORD dwCEntries,
  402. DWORD *pdwColor);
  403. HRESULT
  404. SetClip(
  405. CLIPOBJ *pco);
  406. HRESULT
  407. RoundRectanglePath(
  408. RECTL *prclBounds);
  409. HRESULT
  410. SetCursor(
  411. LONG lX,
  412. LONG lY);
  413. HRESULT
  414. ReadImage(
  415. DWORD dwBlockHeight,
  416. CompressMode CMode);
  417. HRESULT
  418. ReadImage(
  419. DWORD dwStartBlock,
  420. DWORD dwBlockHeight,
  421. CompressMode CMode);
  422. HRESULT
  423. ReadRasterPattern(
  424. DWORD dwBlockHeight,
  425. CompressMode CMode);
  426. HRESULT
  427. RectanglePath(RECTL *prclRect);
  428. HRESULT
  429. BezierPath(POINTFIX *pptfx, LONG lPoints);
  430. HRESULT
  431. LinePath(POINTFIX *pptfx, LONG lPoints);
  432. HRESULT
  433. Path(PATHOBJ *ppo);
  434. HRESULT
  435. Paint(VOID);
  436. HRESULT
  437. SetBrush(BRUSHOBJ *pbo,
  438. POINTL *pptlBrushOrg);
  439. HRESULT
  440. SetPen(
  441. LINEATTRS *plineattrs,
  442. XFORMOBJ *pxo);
  443. HRESULT
  444. SetPenColor(
  445. BRUSHOBJ *pbo,
  446. POINTL *pptlBrushOrg);
  447. inline
  448. VOID
  449. SetupBrush(
  450. BRUSHOBJ *pbo,
  451. POINTL *pptlBrushOrg,
  452. CMNBRUSH *pcmnbrush);
  453. HRESULT
  454. SetFont(
  455. FontType fonttype,
  456. PBYTE pFontName,
  457. DWORD dwFontHeight,
  458. DWORD dwFontWidth,
  459. DWORD dwSymbolSet,
  460. DWORD dwSimulation);
  461. #define XLOUTPUT_FONTSIM_BOLD 0x00000001
  462. #define XLOUTPUT_FONTSIM_ITALIC 0x00000002
  463. #define XLOUTPUT_FONTSIM_VERTICAL 0x00000004
  464. HRESULT
  465. SetSourceTxMode(TxMode SrcTxMode);
  466. HRESULT
  467. SetPaintTxMode(TxMode PaintTxMode);
  468. //
  469. // Helper function
  470. //
  471. HRESULT
  472. GetCursorPos(
  473. PLONG plx,
  474. PLONG ply);
  475. //
  476. // Set cursor offset value
  477. //
  478. HRESULT
  479. SetCursorOffset(
  480. LONG lX,
  481. LONG lY);
  482. #if DBG
  483. VOID SetOutputDbgLevel(DWORD dwLevel);
  484. VOID SetGStateDbgLevel(DWORD dwLevel);
  485. #endif
  486. private:
  487. #define HORIZONTAL_AVAILABLE 0x00000001
  488. #define VERTICAL_AVAILABLE 0x00000002
  489. #define BDIAGONAL_AVAILABLE 0x00000004
  490. #define FDIAGONAL_AVAILABLE 0x00000008
  491. #define CROSS_AVAILABLE 0x00000010
  492. #define DIAGCROSS_AVAILABLE 0x00000020
  493. DWORD m_dwHatchBrushAvailability;
  494. DWORD m_dwResolution;
  495. ColorDepth m_DeviceColorDepth;
  496. ULONG m_lX;
  497. ULONG m_lY;
  498. ULONG m_lOffsetX;
  499. ULONG m_lOffsetY;
  500. #if DBG
  501. DWORD m_dbglevel;
  502. DWORD m_dwNumber;
  503. #endif
  504. };
  505. #endif // _XLOUTPUT_H_