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.

2532 lines
28 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. xloutput.cpp
  5. Abstract:
  6. PCL-XL low level command output implementation
  7. Environment:
  8. Windows Whistler
  9. Revision History:
  10. 08/23/99
  11. Created it.
  12. --*/
  13. #include "lib.h"
  14. #include "gpd.h"
  15. #include "winres.h"
  16. #include "pdev.h"
  17. #include "common.h"
  18. #include "xlpdev.h"
  19. #include "pclxle.h"
  20. #include "pclxlcmd.h"
  21. #include "xldebug.h"
  22. #include "xlgstate.h"
  23. #include "xloutput.h"
  24. //
  25. // XLWrite
  26. //
  27. XLWrite::
  28. XLWrite(VOID)
  29. /*++
  30. Routine Description:
  31. Arguments:
  32. Return Value:
  33. Note:
  34. --*/
  35. {
  36. #if DBG
  37. SetDbgLevel(OUTPUTDBG);
  38. #endif
  39. XL_VERBOSE(("XLWrite:Ctor.\n"));
  40. m_pCurrentPoint =
  41. m_pBuffer = (PBYTE)MemAlloc(XLWrite_INITSIZE);
  42. if (NULL == m_pBuffer)
  43. {
  44. XL_ERR(("XLWrite:Ctor: failed to allocate memory.\n"));
  45. m_dwBufferSize = 0;
  46. m_dwCurrentDataSize = 0;
  47. }
  48. else
  49. {
  50. m_dwBufferSize = XLWrite_INITSIZE;
  51. m_dwCurrentDataSize = 0;
  52. }
  53. }
  54. XLWrite::
  55. ~XLWrite(VOID)
  56. /*++
  57. Routine Description:
  58. Arguments:
  59. Return Value:
  60. Note:
  61. --*/
  62. {
  63. XL_VERBOSE(("XLWrite:Dtor.\n"));
  64. if (m_pBuffer)
  65. MemFree(m_pBuffer);
  66. }
  67. HRESULT
  68. XLWrite::
  69. IncreaseBuffer(
  70. DWORD dwAdditionalDataSize)
  71. /*++
  72. Routine Description:
  73. Arguments:
  74. Return Value:
  75. Note:
  76. --*/
  77. {
  78. PBYTE pTemp;
  79. DWORD dwNewBufferSize;
  80. dwNewBufferSize = m_dwBufferSize + XLWrite_ADDSIZE;
  81. dwAdditionalDataSize += m_dwBufferSize;
  82. while (dwAdditionalDataSize > dwNewBufferSize)
  83. dwNewBufferSize += XLWrite_ADDSIZE;
  84. if (!(pTemp = (PBYTE)MemAlloc(dwNewBufferSize)))
  85. {
  86. XL_ERR(("XLWrite::IncreaseBuffer: Memory allocation failed\n"));
  87. return E_UNEXPECTED;
  88. }
  89. if (m_pBuffer)
  90. {
  91. if (m_dwCurrentDataSize > 0)
  92. {
  93. CopyMemory(pTemp, m_pBuffer, m_dwCurrentDataSize);
  94. }
  95. MemFree(m_pBuffer);
  96. }
  97. m_dwBufferSize = dwNewBufferSize;
  98. m_pCurrentPoint = pTemp + m_dwCurrentDataSize;
  99. m_pBuffer = pTemp;
  100. return S_OK;
  101. }
  102. inline
  103. HRESULT
  104. XLWrite::
  105. Write(
  106. PBYTE pData,
  107. DWORD dwSize)
  108. /*++
  109. Routine Description:
  110. Arguments:
  111. Return Value:
  112. Note:
  113. --*/
  114. {
  115. if (m_dwBufferSize < m_dwCurrentDataSize + dwSize)
  116. {
  117. if (S_OK != IncreaseBuffer(dwSize))
  118. {
  119. XL_ERR(("XLWrite::Write: failed to increae memory\n"));
  120. return E_UNEXPECTED;
  121. }
  122. }
  123. if (NULL == m_pBuffer || NULL == pData)
  124. {
  125. XL_ERR(("XLWrite:Write failed\n"));
  126. return E_UNEXPECTED;
  127. }
  128. CopyMemory(m_pCurrentPoint, pData, dwSize);
  129. m_pCurrentPoint += dwSize;
  130. m_dwCurrentDataSize += dwSize;
  131. return S_OK;
  132. }
  133. inline
  134. HRESULT
  135. XLWrite::
  136. WriteByte(
  137. BYTE ubData)
  138. /*++
  139. Routine Description:
  140. Arguments:
  141. Return Value:
  142. Note:
  143. --*/
  144. {
  145. if (m_dwBufferSize < m_dwCurrentDataSize + 2 * sizeof(DWORD))
  146. {
  147. //
  148. // 64 bit alignment
  149. // Increae quadword
  150. //
  151. if (S_OK != IncreaseBuffer(2 * sizeof(DWORD)))
  152. {
  153. XL_ERR(("XLWrite::WriteByte: failed to increae memory\n"));
  154. return E_UNEXPECTED;
  155. }
  156. }
  157. if (NULL == m_pBuffer)
  158. {
  159. XL_ERR(("XLWrite:WriteByte failed\n"));
  160. return E_UNEXPECTED;
  161. }
  162. *m_pCurrentPoint++ = ubData;
  163. m_dwCurrentDataSize ++;
  164. return S_OK;
  165. }
  166. inline
  167. HRESULT
  168. XLWrite::
  169. WriteFloat(
  170. real32 real32_value)
  171. /*++
  172. Routine Description:
  173. Arguments:
  174. Return Value:
  175. Note:
  176. --*/
  177. {
  178. return Write((PBYTE)&real32_value, sizeof(real32_value));
  179. }
  180. HRESULT
  181. XLWrite::
  182. Flush(
  183. PDEVOBJ pdevobj)
  184. /*++
  185. Routine Description:
  186. Arguments:
  187. Return Value:
  188. Note:
  189. --*/
  190. {
  191. ASSERTMSG(m_pBuffer != NULL, ("XLWrite:m_pBuffer = NULL\n"));
  192. if (NULL == m_pBuffer || NULL == pdevobj)
  193. {
  194. return E_UNEXPECTED;
  195. }
  196. WriteSpoolBuf((PPDEV)pdevobj, m_pBuffer, m_dwCurrentDataSize);
  197. m_dwCurrentDataSize = 0;
  198. m_pCurrentPoint = m_pBuffer;
  199. return S_OK;
  200. }
  201. HRESULT
  202. XLWrite::
  203. Delete(
  204. VOID)
  205. /*++
  206. Routine Description:
  207. Arguments:
  208. Return Value:
  209. Note:
  210. --*/
  211. {
  212. ASSERTMSG(m_pBuffer != NULL, ("XLWrite:m_pBuffer = NULL\n"));
  213. if (NULL == m_pBuffer)
  214. {
  215. return E_UNEXPECTED;
  216. }
  217. m_dwCurrentDataSize = 0;
  218. m_pCurrentPoint = m_pBuffer;
  219. return S_OK;
  220. }
  221. #if DBG
  222. VOID
  223. XLWrite::
  224. SetDbgLevel(
  225. DWORD dwLevel)
  226. /*++
  227. Routine Description:
  228. Arguments:
  229. Return Value:
  230. Note:
  231. --*/
  232. {
  233. m_dbglevel = dwLevel;
  234. }
  235. #endif
  236. //
  237. // XLOutput
  238. //
  239. XLOutput::
  240. XLOutput(VOID):
  241. /*++
  242. Routine Description:
  243. Arguments:
  244. Return Value:
  245. Note:
  246. --*/
  247. #if DBG
  248. m_dwNumber(0),
  249. #endif
  250. m_dwHatchBrushAvailability(0)
  251. {
  252. #if DBG
  253. SetOutputDbgLevel(OUTPUTDBG);
  254. #endif
  255. }
  256. XLOutput::
  257. ~XLOutput(VOID)
  258. /*++
  259. Routine Description:
  260. Arguments:
  261. Return Value:
  262. Note:
  263. --*/
  264. {
  265. }
  266. #if DBG
  267. VOID
  268. XLOutput::
  269. SetOutputDbgLevel(
  270. DWORD dwLevel)
  271. /*++
  272. Routine Description:
  273. Arguments:
  274. Return Value:
  275. Note:
  276. --*/
  277. {
  278. this->m_dbglevel = dwLevel;
  279. XLWrite *pXLWrite = this;
  280. pXLWrite->SetDbgLevel(dwLevel);
  281. }
  282. VOID
  283. XLOutput::
  284. SetGStateDbgLevel(
  285. DWORD dwLevel)
  286. /*++
  287. Routine Description:
  288. Arguments:
  289. Return Value:
  290. Note:
  291. --*/
  292. {
  293. XLGState *pGState = this;
  294. pGState->SetAllDbgLevel(dwLevel);
  295. }
  296. #endif
  297. //
  298. // Misc. functions
  299. //
  300. VOID
  301. XLOutput::
  302. SetHatchBrushAvailability(
  303. DWORD dwHatchBrushAvailability)
  304. /*++
  305. Routine Description:
  306. Arguments:
  307. Return Value:
  308. Note:
  309. --*/
  310. {
  311. m_dwHatchBrushAvailability = dwHatchBrushAvailability;
  312. }
  313. DWORD
  314. XLOutput::
  315. GetHatchBrushAvailability(
  316. VOID)
  317. /*++
  318. Routine Description:
  319. Arguments:
  320. Return Value:
  321. Note:
  322. --*/
  323. {
  324. return m_dwHatchBrushAvailability;
  325. }
  326. HRESULT
  327. XLOutput::
  328. SetDeviceColorDepth(
  329. ColorDepth DeviceColorDepth)
  330. /*++
  331. Routine Description:
  332. Arguments:
  333. Return Value:
  334. Note:
  335. --*/
  336. {
  337. m_DeviceColorDepth = DeviceColorDepth;
  338. return S_OK;
  339. }
  340. ColorDepth
  341. XLOutput::
  342. GetDeviceColorDepth(
  343. VOID)
  344. /*++
  345. Routine Description:
  346. Arguments:
  347. Return Value:
  348. Note:
  349. --*/
  350. {
  351. return m_DeviceColorDepth;
  352. }
  353. DWORD
  354. XLOutput::
  355. GetResolutionForBrush(
  356. VOID)
  357. /*++
  358. Routine Description:
  359. Arguments:
  360. Return Value:
  361. Note:
  362. --*/
  363. {
  364. return m_dwResolution;
  365. }
  366. VOID
  367. XLOutput::
  368. SetResolutionForBrush(
  369. DWORD dwRes)
  370. /*++
  371. Routine Description:
  372. Arguments:
  373. Return Value:
  374. Note:
  375. --*/
  376. {
  377. m_dwResolution = dwRes;
  378. }
  379. HRESULT
  380. XLOutput::
  381. SetCursorOffset(
  382. LONG lX,
  383. LONG lY)
  384. {
  385. m_lOffsetX = lX;
  386. m_lOffsetY = lY;
  387. return S_OK;
  388. }
  389. //
  390. // PCL-XL basic send functions
  391. //
  392. HRESULT
  393. XLOutput::
  394. Send_cmd(XLCmd Cmd)
  395. /*++
  396. Routine Description:
  397. Arguments:
  398. Return Value:
  399. Note:
  400. --*/
  401. {
  402. XL_VERBOSE(("XLOutput:Send_cmd(%d).\n", m_dwNumber++));
  403. WriteByte(Cmd);
  404. return S_OK;
  405. }
  406. HRESULT
  407. XLOutput::
  408. Send_attr_ubyte(
  409. Attribute Attr)
  410. /*++
  411. Routine Description:
  412. Arguments:
  413. Return Value:
  414. Note:
  415. --*/
  416. {
  417. WriteByte(PCLXL_attr_ubyte);
  418. WriteByte(Attr);
  419. return S_OK;
  420. }
  421. HRESULT
  422. XLOutput::
  423. Send_attr_uint16(
  424. Attribute Attr)
  425. /*++
  426. Routine Description:
  427. Arguments:
  428. Return Value:
  429. Note:
  430. --*/
  431. {
  432. WriteByte((ubyte)PCLXL_attr_uint16);
  433. Send_uint16((uint16)Attr);
  434. return S_OK;
  435. }
  436. //
  437. // single
  438. //
  439. HRESULT
  440. XLOutput::
  441. Send_ubyte(
  442. ubyte ubyte_data)
  443. /*++
  444. Routine Description:
  445. Arguments:
  446. Return Value:
  447. Note:
  448. --*/
  449. {
  450. WriteByte(PCLXL_ubyte);
  451. WriteByte(ubyte_data);
  452. return S_OK;
  453. }
  454. HRESULT
  455. XLOutput::
  456. Send_uint16(
  457. uint16 uint16_data)
  458. /*++
  459. Routine Description:
  460. Arguments:
  461. Return Value:
  462. Note:
  463. --*/
  464. {
  465. WriteByte(PCLXL_uint16);
  466. Write((PBYTE)&uint16_data, sizeof(uint16));
  467. return S_OK;
  468. }
  469. HRESULT
  470. XLOutput::
  471. Send_uint32(
  472. uint32 uint32_data)
  473. /*++
  474. Routine Description:
  475. Arguments:
  476. Return Value:
  477. Note:
  478. --*/
  479. {
  480. WriteByte(PCLXL_uint32);
  481. Write((PBYTE)&uint32_data, sizeof(uint32));
  482. return S_OK;
  483. }
  484. HRESULT
  485. XLOutput::
  486. Send_sint16(
  487. sint16 sint16_data)
  488. /*++
  489. Routine Description:
  490. Arguments:
  491. Return Value:
  492. Note:
  493. --*/
  494. {
  495. WriteByte(PCLXL_sint16);
  496. Write((PBYTE)&sint16_data, sizeof(sint16));
  497. return S_OK;
  498. }
  499. HRESULT
  500. XLOutput::
  501. Send_sint32(
  502. sint32 sint32_data)
  503. /*++
  504. Routine Description:
  505. Arguments:
  506. Return Value:
  507. Note:
  508. --*/
  509. {
  510. WriteByte(PCLXL_sint32);
  511. Write((PBYTE)&sint32_data, sizeof(sint32));
  512. return S_OK;
  513. }
  514. HRESULT
  515. XLOutput::
  516. Send_real32(
  517. real32 real32_data)
  518. /*++
  519. Routine Description:
  520. Arguments:
  521. Return Value:
  522. Note:
  523. --*/
  524. {
  525. WriteByte(PCLXL_real32);
  526. WriteFloat(real32_data);
  527. return S_OK;
  528. }
  529. //
  530. // xy
  531. //
  532. HRESULT
  533. XLOutput::
  534. Send_ubyte_xy(
  535. ubyte ubyte_x,
  536. ubyte ubyte_y)
  537. /*++
  538. Routine Description:
  539. Arguments:
  540. Return Value:
  541. Note:
  542. --*/
  543. {
  544. WriteByte(PCLXL_ubyte_xy);
  545. WriteByte(ubyte_x);
  546. WriteByte(ubyte_y);
  547. return S_OK;
  548. }
  549. HRESULT
  550. XLOutput::
  551. Send_uint16_xy(
  552. uint16 uint16_x,
  553. uint16 uint16_y)
  554. /*++
  555. Routine Description:
  556. Arguments:
  557. Return Value:
  558. Note:
  559. --*/
  560. {
  561. WriteByte(PCLXL_uint16_xy);
  562. Write((PBYTE)&uint16_x, sizeof(uint16));
  563. Write((PBYTE)&uint16_y, sizeof(uint16));
  564. return S_OK;
  565. }
  566. HRESULT
  567. XLOutput::
  568. Send_uint32_xy(
  569. uint32 uint32_x,
  570. uint32 uint32_y)
  571. /*++
  572. Routine Description:
  573. Arguments:
  574. Return Value:
  575. Note:
  576. --*/
  577. {
  578. WriteByte(PCLXL_uint32_xy);
  579. Write((PBYTE)&uint32_x, sizeof(uint32));
  580. Write((PBYTE)&uint32_y, sizeof(uint32));
  581. return S_OK;
  582. }
  583. HRESULT
  584. XLOutput::
  585. Send_sint16_xy(
  586. sint16 sint16_x,
  587. sint16 sint16_y)
  588. /*++
  589. Routine Description:
  590. Arguments:
  591. Return Value:
  592. Note:
  593. --*/
  594. {
  595. WriteByte(PCLXL_sint16_xy);
  596. Write((PBYTE)&sint16_x, sizeof(sint16));
  597. Write((PBYTE)&sint16_y, sizeof(sint16));
  598. return S_OK;
  599. }
  600. HRESULT
  601. XLOutput::
  602. Send_sint32_xy(
  603. sint32 sint32_x,
  604. sint32 sint32_y)
  605. /*++
  606. Routine Description:
  607. Arguments:
  608. Return Value:
  609. Note:
  610. --*/
  611. {
  612. WriteByte(PCLXL_sint32_xy);
  613. Write((PBYTE)&sint32_x, sizeof(sint32));
  614. Write((PBYTE)&sint32_y, sizeof(sint32));
  615. return S_OK;
  616. }
  617. HRESULT
  618. XLOutput::
  619. Send_real32_xy(
  620. real32 real32_x,
  621. real32 real32_y)
  622. /*++
  623. Routine Description:
  624. Arguments:
  625. Return Value:
  626. Note:
  627. --*/
  628. {
  629. WriteByte(PCLXL_real32_xy);
  630. WriteFloat(real32_x);
  631. WriteFloat(real32_y);
  632. return S_OK;
  633. }
  634. //
  635. // box
  636. //
  637. HRESULT
  638. XLOutput::
  639. Send_ubyte_box(
  640. ubyte ubyte_left,
  641. ubyte ubyte_top,
  642. ubyte ubyte_right,
  643. ubyte ubyte_bottom)
  644. /*++
  645. Routine Description:
  646. Arguments:
  647. Return Value:
  648. Note:
  649. --*/
  650. {
  651. WriteByte(PCLXL_ubyte_box);
  652. WriteByte(ubyte_left);
  653. WriteByte(ubyte_top);
  654. WriteByte(ubyte_right);
  655. WriteByte(ubyte_bottom);
  656. return S_OK;
  657. }
  658. HRESULT
  659. XLOutput::
  660. Send_uint16_box(
  661. uint16 uint16_left,
  662. uint16 uint16_top,
  663. uint16 uint16_right,
  664. uint16 uint16_bottom)
  665. /*++
  666. Routine Description:
  667. Arguments:
  668. Return Value:
  669. Note:
  670. --*/
  671. {
  672. WriteByte(PCLXL_uint16_box);
  673. Write((PBYTE)&uint16_left, sizeof(uint16));
  674. Write((PBYTE)&uint16_top, sizeof(uint16));
  675. Write((PBYTE)&uint16_right, sizeof(uint16));
  676. Write((PBYTE)&uint16_bottom, sizeof(uint16));
  677. return S_OK;
  678. }
  679. HRESULT
  680. XLOutput::
  681. Send_uint32_box(
  682. uint32 uint32_left,
  683. uint32 uint32_top,
  684. uint32 uint32_right,
  685. uint32 uint32_bottom)
  686. /*++
  687. Routine Description:
  688. Arguments:
  689. Return Value:
  690. Note:
  691. --*/
  692. {
  693. WriteByte(PCLXL_uint32_box);
  694. Write((PBYTE)&uint32_left, sizeof(uint32));
  695. Write((PBYTE)&uint32_top, sizeof(uint32));
  696. Write((PBYTE)&uint32_right, sizeof(uint32));
  697. Write((PBYTE)&uint32_bottom, sizeof(uint32));
  698. return S_OK;
  699. }
  700. HRESULT
  701. XLOutput::
  702. Send_sint16_box(
  703. sint16 sint16_left,
  704. sint16 sint16_top,
  705. sint16 sint16_right,
  706. sint16 sint16_bottom)
  707. /*++
  708. Routine Description:
  709. Arguments:
  710. Return Value:
  711. Note:
  712. --*/
  713. {
  714. WriteByte(PCLXL_sint16_box);
  715. Write((PBYTE)&sint16_left, sizeof(sint16));
  716. Write((PBYTE)&sint16_top, sizeof(sint16));
  717. Write((PBYTE)&sint16_right, sizeof(sint16));
  718. Write((PBYTE)&sint16_bottom, sizeof(sint16));
  719. return S_OK;
  720. }
  721. HRESULT
  722. XLOutput::
  723. Send_sint32_box(
  724. sint32 sint32_left,
  725. sint32 sint32_top,
  726. sint32 sint32_right,
  727. sint32 sint32_bottom)
  728. /*++
  729. Routine Description:
  730. Arguments:
  731. Return Value:
  732. Note:
  733. --*/
  734. {
  735. WriteByte(PCLXL_sint32_box);
  736. Write((PBYTE)&sint32_left, sizeof(sint32));
  737. Write((PBYTE)&sint32_top, sizeof(sint32));
  738. Write((PBYTE)&sint32_right, sizeof(sint32));
  739. Write((PBYTE)&sint32_bottom, sizeof(sint32));
  740. return S_OK;
  741. }
  742. HRESULT
  743. XLOutput::
  744. Send_real32_box(
  745. real32 real32_left,
  746. real32 real32_top,
  747. real32 real32_right,
  748. real32 real32_bottom)
  749. /*++
  750. Routine Description:
  751. Arguments:
  752. Return Value:
  753. Note:
  754. --*/
  755. {
  756. WriteByte(PCLXL_real32_box);
  757. //
  758. // left
  759. //
  760. WriteFloat(real32_left);
  761. //
  762. // top
  763. //
  764. WriteFloat(real32_top);
  765. //
  766. // right
  767. //
  768. WriteFloat(real32_right);
  769. //
  770. // bottom
  771. //
  772. WriteFloat(real32_bottom);
  773. return S_OK;
  774. }
  775. //
  776. // array
  777. //
  778. HRESULT
  779. XLOutput::
  780. Send_ubyte_array_header(
  781. DWORD dwArrayNum)
  782. /*++
  783. Routine Description:
  784. Arguments:
  785. Return Value:
  786. Note:
  787. --*/
  788. {
  789. WriteByte(PCLXL_ubyte_array);
  790. Send_uint16((uint16)dwArrayNum);
  791. return S_OK;
  792. }
  793. HRESULT
  794. XLOutput::
  795. Send_uint16_array_header(
  796. DWORD dwArrayNum)
  797. /*++
  798. Routine Description:
  799. Arguments:
  800. Return Value:
  801. Note:
  802. --*/
  803. {
  804. WriteByte(PCLXL_uint16_array);
  805. Send_uint16((uint16)dwArrayNum);
  806. return S_OK;
  807. }
  808. HRESULT
  809. XLOutput::
  810. Send_uint32_array_header(
  811. DWORD dwArrayNum)
  812. /*++
  813. Routine Description:
  814. Arguments:
  815. Return Value:
  816. Note:
  817. --*/
  818. {
  819. WriteByte(PCLXL_uint32_array);
  820. Send_uint16((uint16)dwArrayNum);
  821. return S_OK;
  822. }
  823. HRESULT
  824. XLOutput::
  825. Send_sint16_array_header(
  826. DWORD dwArrayNum)
  827. /*++
  828. Routine Description:
  829. Arguments:
  830. Return Value:
  831. Note:
  832. --*/
  833. {
  834. WriteByte(PCLXL_sint16_array);
  835. Send_uint16((uint16)dwArrayNum);
  836. return S_OK;
  837. }
  838. HRESULT
  839. XLOutput::
  840. Send_sint32_array_header(
  841. DWORD dwArrayNum)
  842. /*++
  843. Routine Description:
  844. Arguments:
  845. Return Value:
  846. Note:
  847. --*/
  848. {
  849. WriteByte(PCLXL_sint32_array);
  850. Send_uint16((uint16)dwArrayNum);
  851. return S_OK;
  852. }
  853. HRESULT
  854. XLOutput::
  855. Send_real32_array_header(
  856. DWORD dwArrayNum)
  857. /*++
  858. Routine Description:
  859. Arguments:
  860. Return Value:
  861. Note:
  862. --*/
  863. {
  864. WriteByte(PCLXL_real32_array);
  865. Send_uint16((uint16)dwArrayNum);
  866. return S_OK;
  867. }
  868. //
  869. // Attributes
  870. //
  871. HRESULT
  872. XLOutput::
  873. SetArcDirection(
  874. ArcDirection value)
  875. /*++
  876. Routine Description:
  877. Arguments:
  878. Return Value:
  879. Note:
  880. --*/
  881. {
  882. WriteByte(PCLXL_ubyte);
  883. WriteByte(value);
  884. WriteByte(PCLXL_attr_ubyte);
  885. WriteByte(PCLXL_ArcDirection);
  886. return S_OK;
  887. }
  888. HRESULT
  889. XLOutput::
  890. SetCharSubModeArray(
  891. CharSubModeArray value)
  892. /*++
  893. Routine Description:
  894. Arguments:
  895. Return Value:
  896. Note:
  897. --*/
  898. {
  899. WriteByte(PCLXL_ubyte);
  900. WriteByte(value);
  901. WriteByte(PCLXL_attr_ubyte);
  902. WriteByte(PCLXL_CharSubModeArray);
  903. return S_OK;
  904. }
  905. HRESULT
  906. XLOutput::
  907. SetClipMode(
  908. ClipMode value)
  909. /*++
  910. Routine Description:
  911. Arguments:
  912. Return Value:
  913. Note:
  914. --*/
  915. {
  916. WriteByte(PCLXL_ubyte);
  917. WriteByte(value);
  918. WriteByte(PCLXL_attr_ubyte);
  919. WriteByte(PCLXL_ClipMode);
  920. WriteByte(PCLXL_SetClipMode);
  921. return S_OK;
  922. }
  923. HRESULT
  924. XLOutput::
  925. SetClipRegion(
  926. ClipRegion value)
  927. /*++
  928. Routine Description:
  929. Arguments:
  930. Return Value:
  931. Note:
  932. --*/
  933. {
  934. WriteByte(PCLXL_ubyte);
  935. WriteByte(value);
  936. WriteByte(PCLXL_attr_ubyte);
  937. WriteByte(PCLXL_ClipRegion);
  938. return S_OK;
  939. }
  940. HRESULT
  941. XLOutput::
  942. SetColorDepth(
  943. ColorDepth value)
  944. /*++
  945. Routine Description:
  946. Arguments:
  947. Return Value:
  948. Note:
  949. --*/
  950. {
  951. WriteByte(PCLXL_ubyte);
  952. WriteByte(value);
  953. WriteByte(PCLXL_attr_ubyte);
  954. WriteByte(PCLXL_ColorDepth);
  955. return S_OK;
  956. }
  957. HRESULT
  958. XLOutput::
  959. SetColorimetricColorSpace(
  960. ColorimetricColorSpace value)
  961. /*++
  962. Routine Description:
  963. Arguments:
  964. Return Value:
  965. Note:
  966. --*/
  967. {
  968. WriteByte(PCLXL_ubyte);
  969. WriteByte(value);
  970. WriteByte(PCLXL_attr_ubyte);
  971. WriteByte(PCLXL_ColorimetricColorSpace);
  972. return S_OK;
  973. }
  974. HRESULT
  975. XLOutput::
  976. SetColorMapping(
  977. ColorMapping value)
  978. /*++
  979. Routine Description:
  980. Arguments:
  981. Return Value:
  982. Note:
  983. --*/
  984. {
  985. WriteByte(PCLXL_ubyte);
  986. WriteByte(value);
  987. WriteByte(PCLXL_attr_ubyte);
  988. WriteByte(PCLXL_ColorMapping);
  989. return S_OK;
  990. }
  991. HRESULT
  992. XLOutput::
  993. SetColorSpace(
  994. ColorSpace value)
  995. /*++
  996. Routine Description:
  997. Arguments:
  998. Return Value:
  999. Note:
  1000. --*/
  1001. {
  1002. WriteByte(PCLXL_ubyte);
  1003. WriteByte(value);
  1004. WriteByte(PCLXL_attr_ubyte);
  1005. WriteByte(PCLXL_ColorSpace);
  1006. return S_OK;
  1007. }
  1008. HRESULT
  1009. XLOutput::
  1010. SetCompressMode(
  1011. CompressMode value)
  1012. /*++
  1013. Routine Description:
  1014. Arguments:
  1015. Return Value:
  1016. Note:
  1017. --*/
  1018. {
  1019. WriteByte(PCLXL_ubyte);
  1020. WriteByte(value);
  1021. WriteByte(PCLXL_attr_ubyte);
  1022. WriteByte(PCLXL_CompressMode);
  1023. return S_OK;
  1024. }
  1025. HRESULT
  1026. XLOutput::
  1027. SetDataOrg(
  1028. DataOrg value)
  1029. /*++
  1030. Routine Description:
  1031. Arguments:
  1032. Return Value:
  1033. Note:
  1034. --*/
  1035. {
  1036. WriteByte(PCLXL_ubyte);
  1037. WriteByte(value);
  1038. WriteByte(PCLXL_attr_ubyte);
  1039. WriteByte(PCLXL_DataOrg);
  1040. return S_OK;
  1041. }
  1042. #if 0
  1043. HRESULT
  1044. XLOutput::
  1045. SetDataSource(
  1046. DataSource value)
  1047. /*++
  1048. Routine Description:
  1049. Arguments:
  1050. Return Value:
  1051. Note:
  1052. --*/
  1053. {
  1054. WriteByte(PCLXL_ubyte);
  1055. WriteByte(value);
  1056. WriteByte(PCLXL_attr_ubyte);
  1057. WriteByte(PCLXL_DataSource);
  1058. return S_OK;
  1059. }
  1060. #endif
  1061. #if 0
  1062. HRESULT
  1063. XLOutput::
  1064. SetDataType(
  1065. DataType value)
  1066. /*++
  1067. Routine Description:
  1068. Arguments:
  1069. Return Value:
  1070. Note:
  1071. --*/
  1072. {
  1073. WriteByte(PCLXL_ubyte);
  1074. WriteByte(value);
  1075. WriteByte(PCLXL_attr_ubyte);
  1076. WriteByte(PCLXL_DataType);
  1077. return S_OK;
  1078. }
  1079. #endif
  1080. #if 0
  1081. HRESULT
  1082. XLOutput::
  1083. SetDitherMatrix(
  1084. DitherMatrix value)
  1085. /*++
  1086. Routine Description:
  1087. Arguments:
  1088. Return Value:
  1089. Note:
  1090. --*/
  1091. {
  1092. WriteByte(PCLXL_ubyte);
  1093. WriteByte(value);
  1094. WriteByte(PCLXL_attr_ubyte);
  1095. WriteByte(PCLXL_DitherMatrix);
  1096. return S_OK;
  1097. }
  1098. #endif
  1099. HRESULT
  1100. XLOutput::
  1101. SetDuplexPageMode(
  1102. DuplexPageMode value)
  1103. /*++
  1104. Routine Description:
  1105. Arguments:
  1106. Return Value:
  1107. Note:
  1108. --*/
  1109. {
  1110. WriteByte(PCLXL_ubyte);
  1111. WriteByte(value);
  1112. WriteByte(PCLXL_attr_ubyte);
  1113. WriteByte(PCLXL_DuplexPageMode);
  1114. return S_OK;
  1115. }
  1116. HRESULT
  1117. XLOutput::
  1118. SetDuplexPageSide(
  1119. DuplexPageSide value)
  1120. /*++
  1121. Routine Description:
  1122. Arguments:
  1123. Return Value:
  1124. Note:
  1125. --*/
  1126. {
  1127. WriteByte(PCLXL_ubyte);
  1128. WriteByte(value);
  1129. WriteByte(PCLXL_attr_ubyte);
  1130. WriteByte(PCLXL_DuplexPageSide);
  1131. return S_OK;
  1132. }
  1133. HRESULT
  1134. XLOutput::
  1135. SetErrorReport(
  1136. ErrorReport value)
  1137. /*++
  1138. Routine Description:
  1139. Arguments:
  1140. Return Value:
  1141. Note:
  1142. --*/
  1143. {
  1144. WriteByte(PCLXL_ubyte);
  1145. WriteByte(PCLXL_attr_ubyte);
  1146. WriteByte(PCLXL_ErrorReport);
  1147. WriteByte(value);
  1148. return S_OK;
  1149. }
  1150. HRESULT
  1151. XLOutput::
  1152. SetLineCap(
  1153. LineCap value)
  1154. /*++
  1155. Routine Description:
  1156. Arguments:
  1157. Return Value:
  1158. Note:
  1159. --*/
  1160. {
  1161. WriteByte(PCLXL_ubyte);
  1162. WriteByte(value);
  1163. WriteByte(PCLXL_attr_ubyte);
  1164. WriteByte(PCLXL_LineCap);
  1165. WriteByte(PCLXL_SetLineCap);
  1166. return S_OK;
  1167. }
  1168. HRESULT
  1169. XLOutput::
  1170. SetLineJoin(
  1171. LineJoin value)
  1172. /*++
  1173. Routine Description:
  1174. Arguments:
  1175. Return Value:
  1176. Note:
  1177. --*/
  1178. {
  1179. WriteByte(PCLXL_ubyte);
  1180. WriteByte(value);
  1181. WriteByte(PCLXL_attr_ubyte);
  1182. WriteByte(PCLXL_LineJoin);
  1183. WriteByte(PCLXL_SetLineJoin);
  1184. return S_OK;
  1185. }
  1186. HRESULT
  1187. XLOutput::
  1188. SetMeasure(
  1189. Measure value)
  1190. /*++
  1191. Routine Description:
  1192. Arguments:
  1193. Return Value:
  1194. Note:
  1195. --*/
  1196. {
  1197. WriteByte(PCLXL_ubyte);
  1198. WriteByte(value);
  1199. WriteByte(PCLXL_attr_ubyte);
  1200. WriteByte(PCLXL_Measure);
  1201. return S_OK;
  1202. }
  1203. HRESULT
  1204. XLOutput::
  1205. SetMediaSize(
  1206. MediaSize value)
  1207. /*++
  1208. Routine Description:
  1209. Arguments:
  1210. Return Value:
  1211. Note:
  1212. --*/
  1213. {
  1214. WriteByte(PCLXL_ubyte);
  1215. WriteByte(value);
  1216. WriteByte(PCLXL_attr_ubyte);
  1217. WriteByte(PCLXL_MediaSize);
  1218. return S_OK;
  1219. }
  1220. HRESULT
  1221. XLOutput::
  1222. SetMediaSource(
  1223. MediaSource value)
  1224. /*++
  1225. Routine Description:
  1226. Arguments:
  1227. Return Value:
  1228. Note:
  1229. --*/
  1230. {
  1231. WriteByte(PCLXL_ubyte);
  1232. WriteByte(value);
  1233. WriteByte(PCLXL_attr_ubyte);
  1234. WriteByte(PCLXL_MediaSource);
  1235. return S_OK;
  1236. }
  1237. HRESULT
  1238. XLOutput::
  1239. SetMediaDestination(
  1240. MediaDestination value)
  1241. /*++
  1242. Routine Description:
  1243. Arguments:
  1244. Return Value:
  1245. Note:
  1246. --*/
  1247. {
  1248. WriteByte(PCLXL_ubyte);
  1249. WriteByte(value);
  1250. WriteByte(PCLXL_attr_ubyte);
  1251. WriteByte(PCLXL_MediaDestination);
  1252. return S_OK;
  1253. }
  1254. HRESULT
  1255. XLOutput::
  1256. SetOrientation(
  1257. Orientation value)
  1258. /*++
  1259. Routine Description:
  1260. Arguments:
  1261. Return Value:
  1262. Note:
  1263. --*/
  1264. {
  1265. WriteByte(PCLXL_ubyte);
  1266. WriteByte(value);
  1267. WriteByte(PCLXL_attr_ubyte);
  1268. WriteByte(PCLXL_Orientation);
  1269. return S_OK;
  1270. }
  1271. HRESULT
  1272. XLOutput::
  1273. SetPatternPersistence(
  1274. PatternPersistence value)
  1275. /*++
  1276. Routine Description:
  1277. Arguments:
  1278. Return Value:
  1279. Note:
  1280. --*/
  1281. {
  1282. WriteByte(PCLXL_ubyte);
  1283. WriteByte(value);
  1284. WriteByte(PCLXL_attr_ubyte);
  1285. WriteByte(PCLXL_PatternPersistence);
  1286. return S_OK;
  1287. }
  1288. HRESULT
  1289. XLOutput::
  1290. SetSimplexPageMode(
  1291. SimplexPageMode value)
  1292. /*++
  1293. Routine Description:
  1294. Arguments:
  1295. Return Value:
  1296. Note:
  1297. --*/
  1298. {
  1299. WriteByte(PCLXL_ubyte);
  1300. WriteByte(value);
  1301. WriteByte(PCLXL_attr_ubyte);
  1302. WriteByte(PCLXL_SimplexPageMode);
  1303. return S_OK;
  1304. }
  1305. HRESULT
  1306. XLOutput::
  1307. SetTxMode(
  1308. TxMode value)
  1309. /*++
  1310. Routine Description:
  1311. Arguments:
  1312. Return Value:
  1313. Note:
  1314. --*/
  1315. {
  1316. WriteByte(PCLXL_ubyte);
  1317. WriteByte(value);
  1318. WriteByte(PCLXL_attr_ubyte);
  1319. WriteByte(PCLXL_TxMode);
  1320. return S_OK;
  1321. }
  1322. #if 0
  1323. HRESULT
  1324. XLOutput::
  1325. SetWritingMode(
  1326. WritingMode value)
  1327. /*++
  1328. Routine Description:
  1329. Arguments:
  1330. Return Value:
  1331. Note:
  1332. --*/
  1333. {
  1334. WriteByte(PCLXL_ubyte);
  1335. WriteByte(value);
  1336. WriteByte(PCLXL_attr_ubyte);
  1337. WriteByte(PCLXL_WritingMode);
  1338. return S_OK;
  1339. }
  1340. #endif
  1341. //
  1342. // Value set function
  1343. //
  1344. HRESULT
  1345. XLOutput::
  1346. SetFillMode(
  1347. FillMode value)
  1348. /*++
  1349. Routine Description:
  1350. Arguments:
  1351. Return Value:
  1352. Note:
  1353. --*/
  1354. {
  1355. Send_ubyte(value);
  1356. Send_attr_ubyte(eFillMode);
  1357. Send_cmd(eSetFillMode);
  1358. return S_OK;
  1359. }
  1360. HRESULT
  1361. XLOutput::
  1362. SetSourceWidth(
  1363. uint16 srcwidth)
  1364. /*++
  1365. Routine Description:
  1366. Arguments:
  1367. Return Value:
  1368. Note:
  1369. --*/
  1370. {
  1371. if (S_OK == Send_uint16(srcwidth) &&
  1372. S_OK == Send_attr_ubyte(eSourceWidth) )
  1373. return S_OK;
  1374. else
  1375. return S_FALSE;
  1376. }
  1377. HRESULT
  1378. XLOutput::
  1379. SetSourceHeight(
  1380. uint16 srcheight)
  1381. /*++
  1382. Routine Description:
  1383. Arguments:
  1384. Return Value:
  1385. Note:
  1386. --*/
  1387. {
  1388. if (S_OK == Send_uint16(srcheight) &&
  1389. S_OK == Send_attr_ubyte(eSourceHeight) )
  1390. return S_OK;
  1391. else
  1392. return S_FALSE;
  1393. }
  1394. HRESULT
  1395. XLOutput::
  1396. SetDestinationSize(
  1397. uint16 dstwidth,
  1398. uint16 dstheight)
  1399. /*++
  1400. Routine Description:
  1401. Arguments:
  1402. Return Value:
  1403. Note:
  1404. --*/
  1405. {
  1406. if (S_OK == Send_uint16_xy(dstwidth, dstheight) &&
  1407. S_OK == Send_attr_ubyte(eDestinationSize) )
  1408. return S_OK;
  1409. else
  1410. return S_FALSE;
  1411. }
  1412. HRESULT
  1413. XLOutput::
  1414. SetBoundingBox(
  1415. uint16 left,
  1416. uint16 top,
  1417. uint16 right,
  1418. uint16 bottom)
  1419. /*++
  1420. Routine Description:
  1421. Arguments:
  1422. Return Value:
  1423. Note:
  1424. --*/
  1425. {
  1426. if (S_OK == Send_uint16_box(left, top, right, bottom) &&
  1427. S_OK == Send_attr_ubyte(eBoundingBox) )
  1428. return S_OK;
  1429. else
  1430. return S_FALSE;
  1431. }
  1432. HRESULT
  1433. XLOutput::
  1434. SetBoundingBox(
  1435. sint16 left,
  1436. sint16 top,
  1437. sint16 right,
  1438. sint16 bottom)
  1439. /*++
  1440. Routine Description:
  1441. Arguments:
  1442. Return Value:
  1443. Note:
  1444. --*/
  1445. {
  1446. if (S_OK == Send_sint16_box(left, top, right, bottom) &&
  1447. S_OK == Send_attr_ubyte(eBoundingBox) )
  1448. return S_OK;
  1449. else
  1450. return S_FALSE;
  1451. }
  1452. HRESULT
  1453. XLOutput::
  1454. SetROP3(
  1455. ROP3 rop3)
  1456. /*++
  1457. Routine Description:
  1458. Arguments:
  1459. Return Value:
  1460. Note:
  1461. --*/
  1462. {
  1463. XLGState *pGState = this;
  1464. if (S_OK == pGState->CheckROP3(rop3))
  1465. return S_OK;
  1466. if (S_OK == Send_ubyte((ubyte)rop3) &&
  1467. S_OK == Send_attr_ubyte(eROP3) &&
  1468. S_OK == Send_cmd(eSetROP) &&
  1469. S_OK == pGState->SetROP3(rop3))
  1470. return S_OK;
  1471. else
  1472. return S_FALSE;
  1473. }
  1474. HRESULT
  1475. XLOutput::
  1476. SetPatternDefineID(
  1477. sint16 sint16_patternid)
  1478. /*++
  1479. Routine Description:
  1480. Arguments:
  1481. Return Value:
  1482. Note:
  1483. --*/
  1484. {
  1485. if (S_OK == Send_sint16(sint16_patternid) &&
  1486. S_OK == Send_attr_ubyte(ePatternDefineID))
  1487. return S_OK;
  1488. else
  1489. return S_FALSE;
  1490. }
  1491. HRESULT
  1492. XLOutput::
  1493. SetPaletteDepth(
  1494. ColorDepth value)
  1495. /*++
  1496. Routine Description:
  1497. Arguments:
  1498. Return Value:
  1499. Note:
  1500. --*/
  1501. {
  1502. if (S_OK == WriteByte(PCLXL_ubyte) &&
  1503. S_OK == WriteByte(value) &&
  1504. S_OK == WriteByte(PCLXL_attr_ubyte) &&
  1505. S_OK == WriteByte(PCLXL_PaletteDepth) )
  1506. return S_OK;
  1507. else
  1508. return S_FALSE;
  1509. }
  1510. HRESULT
  1511. XLOutput::
  1512. SetPenWidth(
  1513. uint16 uint16_penwidth)
  1514. /*++
  1515. Routine Description:
  1516. Arguments:
  1517. Return Value:
  1518. Note:
  1519. --*/
  1520. {
  1521. if (S_OK == Send_uint16(uint16_penwidth) &&
  1522. S_OK == Send_attr_ubyte(ePenWidth) &&
  1523. S_OK == Send_cmd(eSetPenWidth) )
  1524. return S_OK;
  1525. else
  1526. return S_FALSE;
  1527. }
  1528. HRESULT
  1529. XLOutput::
  1530. SetMiterLimit(
  1531. uint16 uint16_miter)
  1532. /*++
  1533. Routine Description:
  1534. Arguments:
  1535. Return Value:
  1536. Note:
  1537. --*/
  1538. {
  1539. if (S_OK == Send_uint16(uint16_miter) &&
  1540. S_OK == Send_attr_ubyte(eMiterLength) &&
  1541. S_OK == Send_cmd(eSetMiterLimit))
  1542. return S_OK;
  1543. else
  1544. return S_FALSE;
  1545. }
  1546. HRESULT
  1547. XLOutput::
  1548. SetPageOrigin(
  1549. uint16 uint16_x,
  1550. uint16 uint16_y)
  1551. /*++
  1552. Routine Description:
  1553. Arguments:
  1554. Return Value:
  1555. Note:
  1556. --*/
  1557. {
  1558. if (S_OK == Send_uint16_xy(uint16_x, uint16_y) &&
  1559. S_OK == Send_attr_ubyte(ePageOrigin) &&
  1560. S_OK == Send_cmd(eSetPageOrigin))
  1561. return S_OK;
  1562. else
  1563. return S_FALSE;
  1564. }
  1565. HRESULT
  1566. XLOutput::
  1567. SetPageAngle(
  1568. sint16 sint16_Angle)
  1569. /*++
  1570. Routine Description:
  1571. Arguments:
  1572. Return Value:
  1573. Note:
  1574. --*/
  1575. {
  1576. if (S_OK == Send_sint16(sint16_Angle) &&
  1577. S_OK == Send_attr_ubyte(ePageAngle) &&
  1578. S_OK == Send_cmd(eSetPageRotation))
  1579. return S_OK;
  1580. else
  1581. return S_FALSE;
  1582. }
  1583. HRESULT
  1584. XLOutput::
  1585. SetPageScale(
  1586. real32 real32_x,
  1587. real32 real32_y)
  1588. /*++
  1589. Routine Description:
  1590. Arguments:
  1591. Return Value:
  1592. Note:
  1593. --*/
  1594. {
  1595. if (S_OK == Send_real32_xy(real32_x, real32_y) &&
  1596. S_OK == Send_attr_ubyte(ePageScale) &&
  1597. S_OK == Send_cmd(eSetPageScale))
  1598. return S_OK;
  1599. else
  1600. return S_FALSE;
  1601. }