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.

299 lines
20 KiB

  1. //***************************************************************************************************
  2. // COMDIZ.H
  3. //
  4. // C Header (Functions of dither and color matching (For N5-XX1 printer))
  5. //---------------------------------------------------------------------------------------------------
  6. // copyright(C) 1997-2000 CASIO COMPUTER CO.,LTD. / CASIO ELECTRONICS MANUFACTURING CO.,LTD.
  7. //***************************************************************************************************
  8. //***************************************************************************************************
  9. // Data define
  10. //***************************************************************************************************
  11. //---------------------------------------------------------------------------------------------------
  12. // DLL file name
  13. //---------------------------------------------------------------------------------------------------
  14. #if defined(CASIO)
  15. #if defined(COLPRINTER)
  16. #define N403_DIZDLL TEXT("CPN4DT32.DLL")
  17. #else
  18. #define N403_DIZDLL TEXT("CP70DT32.DLL")
  19. #endif
  20. #else
  21. #if defined(MINOLTA)
  22. #define N403_DIZDLL TEXT("MWXDT32.DLL")
  23. #endif
  24. #endif
  25. #define N501_DIZDLL TEXT("CPN5DT32.DLL")
  26. #define E800_DIZDLL TEXT("CP80DT32.DLL")
  27. //---------------------------------------------------------------------------------------------------
  28. // Error code (N501 Only)
  29. //---------------------------------------------------------------------------------------------------
  30. #define ERRNON 0 // Normal completion
  31. #define ERRILLPRM 1 // Invalid paramater
  32. #define ERRDIZHED 2 // Dither Invalid Header
  33. #define ERRDIZNON 3 // Dither Not found
  34. #define ERRDIZSLS 4 // Dither Invalid Threshold sizes
  35. #define ERRDIZSIZ 5 // Dither Invalid X/Y size
  36. #define ERRDIZADJ 6 // Dither Invalid Adjustment value
  37. //---------------------------------------------------------------------------------------------------
  38. // Color / Mono mode
  39. //---------------------------------------------------------------------------------------------------
  40. #define CMMCOL 0 // Color
  41. #define CMMMON 1 // Mono
  42. //---------------------------------------------------------------------------------------------------
  43. // Engine kind
  44. //---------------------------------------------------------------------------------------------------
  45. #define ENG621 0 // IX-621
  46. #define ENG516 1 // IX-516
  47. //---------------------------------------------------------------------------------------------------
  48. // Printer mode *1:N501 Only *2:CP-E8000 Only
  49. //---------------------------------------------------------------------------------------------------
  50. #define PRM302 0 // 300DPI 2value
  51. #define PRM316 1 // 300DPI 16value
  52. #define PRM602 2 // 600DPI 2value
  53. #define PRM604 3 // 600DPI 4value
  54. #define PRM616 4 // 600DPI 16value *1
  55. #define PRM122 5 // 1200DPI 2value *2
  56. //---------------------------------------------------------------------------------------------------
  57. // Color matching mode
  58. //---------------------------------------------------------------------------------------------------
  59. #define MCHFST 0 // LUT First
  60. #define MCHNML 1 // LUT Normal
  61. #define MCHSLD 2 // No (Solid)
  62. #define MCHPRG 3 // Primary color (progressive)
  63. #define MCHMON 4 // Monochrome
  64. //---------------------------------------------------------------------------------------------------
  65. // Printer model (CP70 Only)
  66. //---------------------------------------------------------------------------------------------------
  67. #define CP7100_MON 0 // Mono printer(CP-7100)
  68. #define CP7200_MON 1 // Mono printer(CP-7200)
  69. #define CP7300_MON 2 // Mono printer(CP-7300)
  70. #define CP7400_MON 3 // Mono printer(CP-7400)
  71. #define CP7500_MON 4 // Mono printer(CP-7500)
  72. //---------------------------------------------------------------------------------------------------
  73. // Black Tonaer replacement mode
  74. //---------------------------------------------------------------------------------------------------
  75. #define KCGNON 0 // No
  76. #define KCGBLA 1 // Black (RGB=0)
  77. #define KCGGRY 2 // Glay (R=G=B)
  78. //---------------------------------------------------------------------------------------------------
  79. // UCR mode
  80. //---------------------------------------------------------------------------------------------------
  81. #define UCRNOO 0 // No
  82. #define UCR001 1 // UCR (Type�T)
  83. #define UCR002 2 // UCR (Type�U)
  84. //---------------------------------------------------------------------------------------------------
  85. // LUT mode (N501 Only)
  86. //---------------------------------------------------------------------------------------------------
  87. #define LUT_XD 0 // Brightness
  88. #define LUT_YD 1 // Tincture
  89. #define LUT_XL 2 // Brightness(linear)
  90. #define LUT_YL 3 // Tincture(linear)
  91. //---------------------------------------------------------------------------------------------------
  92. // Dither mode (N501 Only)
  93. //---------------------------------------------------------------------------------------------------
  94. #define KNDCHR 0 // Text / Graphic
  95. #define KNDIMG 1 // Image
  96. //---------------------------------------------------------------------------------------------------
  97. // Dither Pattern
  98. //---------------------------------------------------------------------------------------------------
  99. #define DIZCHA 0 // Text / Graphic *
  100. #define DIZSML 1 // Small
  101. #define DIZMID 2 // middle
  102. #define DIZRUG 3 // Rough
  103. #define DIZGOS 4 // Error dispersion *
  104. #define DIZSTO 5 // Random number
  105. //---------------------------------------------------------------------------------------------------
  106. // Dither pattern Tone (N4/N403/CP70 Only)
  107. //---------------------------------------------------------------------------------------------------
  108. #define ALLDIZNUM 64 // All dither nuber
  109. #define DIZSPC 4 // Dithering interval
  110. //---------------------------------------------------------------------------------------------------
  111. // Necessary size of each table(Byte) (N4/N403/CP70 Only)
  112. //---------------------------------------------------------------------------------------------------
  113. // N403
  114. #define DIZSIZ_B1 (34 * 34) // Dither table size(2value)
  115. #define DIZSIZ_B2 (34 * 34 * 3) // Dither table size(4value)
  116. #define DIZSIZ_B4 (12 * 12 * 15) // Dither table size(16value)
  117. // N4
  118. #define DIZSIZ_CM (17 * 17) // Dither table size(CM)
  119. #define DIZSIZ_YK (16 * 16) // Dither table size(YK)
  120. // CP70
  121. #define DIZSIZ (32 * 32) // Dither table size
  122. //---------------------------------------------------------------------------------------------------
  123. // LUT table RBG -> CMYK (old version)
  124. //---------------------------------------------------------------------------------------------------
  125. // N4/N403/CP70
  126. #define GLDNUM 32 // Table grid number
  127. #define GLDSPC 8 // Table grid interval
  128. #define LUTSIZ ((DWORD)GLDNUM * GLDNUM * GLDNUM)// LUT size(*CMYK=128k)
  129. #define LUTTBLSIZ ((DWORD)LUTSIZ * sizeof(CMYK))
  130. // N501
  131. #define GLDNUM016 16 // Table grid number
  132. #define GLDNUM032 32 // Table grid number
  133. #define LUTSIZ016 GLDNUM016 * GLDNUM016 * GLDNUM016 // LUT size
  134. #define LUTSIZ032 GLDNUM032 * GLDNUM032 * GLDNUM032 // LUT size
  135. #define LUTSIZRGB LUTSIZ016 * sizeof(RGBS) // LUT size
  136. #define LUTSIZCMY LUTSIZ016 * sizeof(CMYK) // LUT size
  137. //---------------------------------------------------------------------------------------------------
  138. // Color transformation table (N4/N403/CP70 Only)
  139. //---------------------------------------------------------------------------------------------------
  140. #define TNRTBLSIZ 256 // Toner density table size
  141. #define CCHRGBSIZ (CCHTBLSIZ * sizeof(RGBS)) // Cache table size(RGB)
  142. #define CCHCMYSIZ (CCHTBLSIZ * sizeof(CMYK)) // Cache table size(CMYK)
  143. //---------------------------------------------------------------------------------------------------
  144. // Cashe table size
  145. //---------------------------------------------------------------------------------------------------
  146. #define CCHTBLSIZ 256 // Cache table size
  147. //---------------------------------------------------------------------------------------------------
  148. // Work area size (N501 Only)
  149. //---------------------------------------------------------------------------------------------------
  150. #define LUTGLBWRK 32768 // Sum LUT work area size
  151. #define LUT032WRK 32768 // First LUT work area size
  152. #define DIZINFWRK 32768 // Dither work area size
  153. //***************************************************************************************************
  154. // Functions
  155. //***************************************************************************************************
  156. //===================================================================================================
  157. // Color designated table structure (N501 Only)
  158. //===================================================================================================
  159. typedef struct {
  160. BYTE Red; // Red (0 to 255)
  161. BYTE Grn; // Green (0 to 255)
  162. BYTE Blu; // Blue (0 to 255)
  163. BYTE Cyn; // Cyan (0 to 255)
  164. BYTE Mgt; // Magenta (0 to 255)
  165. BYTE Yel; // Yellow (0 to 255)
  166. BYTE Bla; // Black (0 to 255)
  167. } COLCOLDEF, FAR* LPCOLCOLDEF;
  168. //===================================================================================================
  169. // RGB Color Control structure
  170. //===================================================================================================
  171. typedef struct {
  172. LONG Lgt; // brightness (-100 to 100)
  173. LONG Con; // Contrast (-100 to 100)
  174. LONG Crm; // Chroma (-100 to 100)
  175. LONG Gmr; // Gamma(R) (1 to 30)
  176. LONG Gmg; // Gamma(G) (1 to 30)
  177. LONG Gmb; // Gamma(B) (1 to 30)
  178. LPBYTE Dns; // Toner density table [DNSTBLSIZ]
  179. LONG DnsRgb; // RGB density (-30 to 30)
  180. } RGBINF, FAR* LPRGBINF;
  181. //===================================================================================================
  182. // CMYK Color Control structure
  183. //===================================================================================================
  184. typedef struct {
  185. LONG Viv; // Vivid (-100 to 100)
  186. LPBYTE Dns; // Toner density table [DNSTBLSIZ]
  187. LONG DnsCyn; // Toner density(C) (-30 to 30)
  188. LONG DnsMgt; // Toner density(M) (-30 to 30)
  189. LONG DnsYel; // Toner density(Y) (-30 to 30)
  190. LONG DnsBla; // Toner density(K) (-30 to 30)
  191. } CMYKINF, FAR* LPCMYKINF;
  192. //===================================================================================================
  193. // Color Matching information structure *N4/N403/CP70
  194. //===================================================================================================
  195. typedef struct {
  196. DWORD Mch; // Color Matching def
  197. DWORD Bla; // Black replacement def
  198. DWORD Ucr; // UCR def
  199. DWORD UcrCmy; // UCR (UCR quantity)
  200. DWORD UcrBla; // UCR (Ink version generation quantity)
  201. DWORD UcrTnr; //+UCR (Toner gross weight) CASIO 2001/02/15
  202. LPCMYK UcrTbl; // UCR table
  203. LPBYTE GryTbl; // Gray transfer table
  204. DWORD LutGld; // LUT Grid number *
  205. LPCMYK LutAdr; // LUT address
  206. DWORD ColQty; // Color designated number
  207. LPCOLCOLDEF ColAdr; // Color designated table
  208. LPRGB CchRgb; // RGB Cache table[CCHTBLSIZ]
  209. LPCMYK CchCmy; // CMYK Cache table[CCHTBLSIZ]
  210. } COLMCHINF, FAR* LPCOLMCHINF;
  211. //===================================================================================================
  212. // Dither pattern information structure *1:N4/N403/CP70 *2:N501(IX-621)/CP-E8000(IX-516)
  213. //===================================================================================================
  214. #ifndef LPSHORT
  215. typedef SHORT FAR* LPSHORT;
  216. #endif
  217. typedef struct {
  218. DWORD ColMon; // Color mode def
  219. DWORD PrnMod; // DPI / TONE def
  220. DWORD PrnEng; // Engin kind def *2
  221. DWORD PrnKnd; // Printer(Mono only) *1
  222. DWORD DizKnd; // Dither kind def
  223. DWORD DizPat; // Dither pattern def
  224. DWORD DizSls; // Dither pattern Threshold
  225. DWORD SizCyn; // Dither pattern size Cyan
  226. DWORD SizMgt; // Dither pattern size Magenta
  227. DWORD SizYel; // Dither pattern size Yellow
  228. DWORD SizBla; // Dither pattern size Black
  229. LPBYTE TblCyn; // Dither pattern table Cyan
  230. LPBYTE TblMgt; // Dither pattern table Magenta
  231. LPBYTE TblYel; // Dither pattern table Yellow
  232. LPBYTE TblBla; // Dither pattern table Black
  233. } DIZINF, FAR* LPDIZINF;
  234. //===================================================================================================
  235. // Drawing information structure
  236. //===================================================================================================
  237. typedef struct {
  238. DWORD XaxSiz; // X Pixel size
  239. DWORD StrXax; // Start position for drawing X(dot)
  240. DWORD StrYax; // Start position for drawing Y(dot)
  241. DWORD XaxNrt; // X Magnification numerator
  242. DWORD XaxDnt; // X Magnification denominator
  243. DWORD YaxNrt; // Y Magnification numerator
  244. DWORD YaxDnt; // Y Magnification denominator
  245. DWORD XaxOfs; // X Offset
  246. DWORD YaxOfs; // Y Offset
  247. DWORD LinDot; // Destination, 1 line dot number
  248. DWORD LinByt; // Destination, 1 line byte number
  249. LPCMYK CmyBuf; // CMYK data buffer
  250. LPBYTE LinBufCyn; // Line buffer(C)
  251. LPBYTE LinBufMgt; // Line buffer(M)
  252. LPBYTE LinBufYel; // Line buffer(Y)
  253. LPBYTE LinBufBla; // Line buffer(K)
  254. DWORD AllLinNum; // Housing line number
  255. } DRWINF, FAR* LPDRWINF;
  256. //===================================================================================================
  257. // Error dispersion information structure
  258. //===================================================================================================
  259. typedef struct {
  260. struct {
  261. DWORD Num; // Current table array number(0 to 1)
  262. DWORD Siz[2]; // Data table size
  263. DWORD Yax[2]; // Setting data table Y coordinate
  264. LPSHORT Tbl[2][2]; // Data table
  265. } GosRGB;
  266. struct { // Error dispersion table information(CMYK)
  267. DWORD Num; // Current table array number(0 to 1)
  268. DWORD Siz[2]; // Data table size
  269. DWORD Yax[2]; // Setting data table Y coordinate
  270. LPSHORT Tbl[2][2]; // Data table
  271. } GosCMYK;
  272. } GOSINF, FAR* LPGOSINF;
  273. // End of COMDIZ.H