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.

249 lines
7.7 KiB

  1. /*++
  2. Copyright (c) 1997-1999 Microsoft Corporation
  3. --*/
  4. // NTRAID#NTBUG9-576656-2002/03/14-yasuho-: Possible buffer overrun
  5. typedef struct {
  6. INT iPaperSizeID;
  7. LONG iLogicalPageWidth;
  8. LONG iLogicalPageHeight;
  9. INT iTopMargin;
  10. INT iLeftMargin;
  11. INT iRightMargin;
  12. BOOL bAsfOk;
  13. /* Add new attributes here */
  14. } PAPERSIZE;
  15. typedef struct {
  16. int iCurrentResolution; // current resolution
  17. int iPaperQuality; // paper quality
  18. int iPaperSize; // paper size
  19. int iPaperSource; // paper source
  20. int iTextQuality; // photo or business graphics or character or grayscale
  21. int iModel; // MD-2000, MD-2010 or MD-4000
  22. int iDither; // DITHER_HIGH or DITHER_LOW
  23. BOOL fRequestColor; // 1: user selected color 0: user selected mono
  24. INT iUnitScale;
  25. INT iEmulState; // Current emulation status.
  26. BOOL bXflip; // TRUE if mirror output mode
  27. int y;
  28. PAPERSIZE *pPaperSize;
  29. WORD wRasterOffset[4]; // Temp. counter used for Y move.
  30. WORD wRasterCount; // # or raster lines left in logical page.
  31. INT PlaneColor[4]; // Color ID for each plane
  32. INT iCompMode[4]; // Current compression mode. (arranged by YoshitaO)
  33. BYTE *pData; // Pointer for allocated memory
  34. BYTE *pData2; // Scratch buffer
  35. BYTE *pRaster[4]; // Raster data buffer for each plane
  36. BYTE *pRasterC; // Cyan raster data (pointer to pRaster[x])
  37. BYTE *pRasterM; // Magenta ( " )
  38. BYTE *pRasterY; // Yellow ( " )
  39. BYTE *pRasterK; // Black ( " )
  40. HANDLE TempFile[4]; // Temp. file handles
  41. TCHAR TempName[4][MAX_PATH]; // Temp. file names
  42. BYTE KuroTBL[256];
  43. BYTE UcrTBL[256];
  44. BYTE YellowUcr;
  45. int RGB_Rx;
  46. int RGB_Ry;
  47. int RGB_Gx;
  48. int RGB_Gy;
  49. int RGB_Bx;
  50. int RGB_By;
  51. int RGB_Wx;
  52. int RGB_Wy;
  53. int RGB_Cx;
  54. int RGB_Cy;
  55. int RGB_Mx;
  56. int RGB_My;
  57. int RGB_Yx;
  58. int RGB_Yy;
  59. int CMY_Cx;
  60. int CMY_Cy;
  61. int CMY_Mx;
  62. int CMY_My;
  63. int CMY_Yx;
  64. int CMY_Yy;
  65. int CMY_Rx;
  66. int CMY_Ry;
  67. int CMY_Gx;
  68. int CMY_Gy;
  69. int CMY_Bx;
  70. int CMY_By;
  71. int CMY_Wx;
  72. int CMY_Wy;
  73. int CMY_Cd;
  74. int CMY_Md;
  75. int CMY_Yd;
  76. int CMY_Rd;
  77. int CMY_Gd;
  78. int CMY_Bd;
  79. int RedAdj;
  80. int RedStart;
  81. int GreenAdj;
  82. int GreenStart;
  83. int BlueAdj;
  84. int BlueStart;
  85. BYTE RedHosei[256];
  86. BYTE GreenHosei[256];
  87. BYTE BlueHosei[256];
  88. } CURRENTSTATUS, *PCURRENTSTATUS;
  89. #define CMDID_PSIZE_FIRST 1
  90. #define CMDID_PSIZE_A4 1
  91. #define CMDID_PSIZE_B5 2
  92. #define CMDID_PSIZE_EXECTIVE 3
  93. #define CMDID_PSIZE_LEGAL 4
  94. #define CMDID_PSIZE_LETTER 5
  95. #define CMDID_PSIZE_POSTCARD 6
  96. #define CMDID_PSIZE_POSTCARD_DOUBLE 7
  97. #define CMDID_PSIZE_PHOTO_COLOR_LABEL 17
  98. #define CMDID_PSIZE_GLOSSY_LABEL 18
  99. #define CMDID_PSIZE_CD_MASTER 19
  100. #define CMDID_PSIZE_VD_PHOTO_POSTCARD 22
  101. #define CMDID_RESOLUTION_1200_MONO 10
  102. #define CMDID_RESOLUTION_600 11
  103. #define CMDID_RESOLUTION_300 12
  104. #define CMDID_COLORMODE_MONO 15
  105. #define CMDID_COLORMODE_COLOR 16
  106. #define CMDID_CURSOR_RELATIVE 20
  107. #define CMDID_TEXTQUALITY_PHOTO 30
  108. #define CMDID_TEXTQUALITY_GRAPHIC 31
  109. #define CMDID_TEXTQUALITY_CHARACTER 32
  110. #define CMDID_TEXTQUALITY_GRAY 33
  111. #define CMDID_PAPERQUALITY_FIRST 40
  112. #define CMDID_PAPERQUALITY_PPC_NORMAL 40
  113. #define CMDID_PAPERQUALITY_PPC_FINE 41
  114. #define CMDID_PAPERQUALITY_OHP_NORMAL 42
  115. #define CMDID_PAPERQUALITY_OHP_FINE 43
  116. #define CMDID_PAPERQUALITY_OHP_EXCL_NORMAL 44
  117. #define CMDID_PAPERQUALITY_OHP_EXCL_FINE 45
  118. #define CMDID_PAPERQUALITY_IRON_PPC 46
  119. #define CMDID_PAPERQUALITY_IRON_OHP 47
  120. #define CMDID_PAPERQUALITY_THICK 48
  121. #define CMDID_PAPERQUALITY_POSTCARD 49
  122. #define CMDID_PAPERQUALITY_HIGRADE 50
  123. #define CMDID_PAPERQUALITY_BACKPRINTFILM 51
  124. #define CMDID_PAPERQUALITY_LABECA_SHEET 52
  125. #define CMDID_PAPERQUALITY_CD_MASTER 53
  126. #define CMDID_PAPERQUALITY_DYE_SUB_PAPER 54
  127. #define CMDID_PAPERQUALITY_DYE_SUB_LABEL 55
  128. #define CMDID_PAPERQUALITY_GLOSSY_PAPER 56
  129. #define CMDID_PAPERQUALITY_VD_PHOTO_FILM 57
  130. #define CMDID_PAPERQUALITY_VD_PHOTO_CARD 58
  131. #define CMDID_PAPERQUALITY_LAST 58
  132. #define MAX_MEDIATYPES (CMDID_PAPERQUALITY_LAST - CMDID_PAPERQUALITY_FIRST + 1)
  133. #define CMDID_BEGINDOC_FIRST 60
  134. #define CMDID_BEGINDOC_MD2000 60
  135. #define CMDID_BEGINDOC_MD2010 61
  136. #define CMDID_BEGINDOC_MD5000 65
  137. #define CMDID_BEGINPAGE 62
  138. #define CMDID_ENDPAGE 63
  139. #define CMDID_ENDDOC 64
  140. #define CMDID_PAPERSOURCE_CSF 70
  141. #define CMDID_PAPERSOURCE_MANUAL 71
  142. #define CMDID_MIRROR_ON 80
  143. #define CMDID_MIRROR_OFF 81
  144. #define NONE 0
  145. #define YELLOW 1
  146. #define CYAN 2
  147. #define MAGENTA 3
  148. #define BLACK 4
  149. #define DPI1200 1200
  150. #define DPI600 600
  151. #define DPI300 300
  152. #define TEMP_NAME_PREFIX __TEXT("~AL")
  153. // Macros to get current plane model. We have following
  154. // three types of the plane model:
  155. //
  156. // K - 1 plane/composite, send order K.
  157. // MCY - 3 planes, send order M, C, Y.
  158. // YMC - 3 planes, send order Y, C, M.
  159. // CMYK - 4 planes, send order C, M, Y, K.
  160. //
  161. // NTRAID#NTBUG9-24281-2002/03/14-yasuho-:
  162. // large bitmap does not printed on 1200dpi.
  163. // Do not use black plane (K) on the 1200dpi with color mode.
  164. #define bPlaneSendOrderCMY(p) \
  165. ((p)->fRequestColor && (p)->iCurrentResolution == DPI1200)
  166. #define bPlaneSendOrderMCY(p) \
  167. (((p)->iPaperQuality == CMDID_PAPERQUALITY_OHP_EXCL_NORMAL) || \
  168. ((p)->iPaperQuality == CMDID_PAPERQUALITY_OHP_EXCL_FINE))
  169. #define bPlaneSendOrderYMC(p) \
  170. (((p)->iPaperQuality == CMDID_PAPERQUALITY_DYE_SUB_PAPER) || \
  171. ((p)->iPaperQuality == CMDID_PAPERQUALITY_DYE_SUB_LABEL) || \
  172. ((p)->iPaperQuality == CMDID_PAPERQUALITY_GLOSSY_PAPER) || \
  173. ((p)->iPaperQuality == CMDID_PAPERQUALITY_IRON_OHP))
  174. #define bPlaneSendOrderCMYK(p) \
  175. (!bPlaneSendOrderCMY(p) && !bPlaneSendOrderMCY(p) && !bPlaneSendOrderYMC(p))
  176. //
  177. // Printer emulation state. MD-xxxx printers have three major
  178. // state and what kind of printer commands can be issued at a time
  179. // will be decided by in which emulation state currently the printer
  180. // is at.
  181. //
  182. #define EMUL_IDLE 0
  183. #define EMUL_RGL 1
  184. #define EMUL_DATA_TRANSFER 2
  185. //
  186. // Compression modes.
  187. //
  188. #define COMP_NONE 0
  189. #define COMP_TIFF4 1
  190. //
  191. // The following switch is to force use of black ribbon whenever
  192. // the data to print is black. Originally, the dither algprithm
  193. // is designed so that this mode is only used with text objects
  194. // in the docouemnt (graphics images are output by using composite
  195. // blacks).
  196. //
  197. // Unfortunately in Unidriver <-> Minidriver model the data is
  198. // passed to Minidriver after rendering. This means that Minidriver
  199. // cannot distinguish between text objects and graphics objects.
  200. // We may have some degree of quality degrade, however it is better
  201. // than the customers claiming the printer wastes his/her color
  202. // ribbons.
  203. //
  204. #define BLACK_RIBBON_HACK 1
  205. //
  206. // We cache each plane data in a temporary file. We can omit
  207. // caching the first plane (so that the data is send to the printer
  208. // immediately) by setting following flag to 0.
  209. //
  210. #define CACHE_FIRST_PLANE 0