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.

2941 lines
109 KiB

  1. //***************************************************************************************************
  2. // N403DIZ.C
  3. //
  4. // Functions of dither and color matching (For N4-612 printer)
  5. //---------------------------------------------------------------------------------------------------
  6. // copyright(C) 1997-1999 CASIO COMPUTER CO.,LTD. / CASIO ELECTRONICS MANUFACTURING CO.,LTD.
  7. //***************************************************************************************************
  8. #include <WINDOWS.H>
  9. #include <WINBASE.H>
  10. #include "PDEV.H"
  11. #include "strsafe.h" // Security-Code 2002.3.6
  12. static BYTE InnTblCmy[256];
  13. /*----------------------------------------------------------------------------
  14. Pattern original(300dpi)
  15. ----------------------------------------------------------------------------*/
  16. /*---- magenta(cyan) ----*/
  17. //const static BYTE StrMgt002 = 16;
  18. static BYTE StrMgt002 = 16;
  19. //const static BYTE MgtTil302[4][4] = {
  20. static BYTE MgtTil302[4][4] = {
  21. { 6, 4, 14, 12 },
  22. { 10, 8, 3, 1 },
  23. { 15, 13, 7, 5 },
  24. { 2, 0, 11, 9 }
  25. };
  26. /*---- yellow ----*/
  27. //const static BYTE YelTil302[4][4] = {
  28. static BYTE YelTil302[4][4] = {
  29. { 15, 13, 7, 5 },
  30. { 2, 0, 11, 9 },
  31. { 6, 4, 14, 12 },
  32. { 10, 8, 3, 1 }
  33. };
  34. /*---- black ----*/
  35. //const static BYTE BlaTil302[4][4] = {
  36. static BYTE BlaTil302[4][4] = {
  37. { 6, 4, 14, 12 },
  38. { 10, 8, 3, 1 },
  39. { 15, 13, 7, 5 },
  40. { 2, 0, 11, 9 }
  41. };
  42. /*----------------------------------------------------------------------------
  43. Pattern original(300dpi)
  44. ----------------------------------------------------------------------------*/
  45. /*---- magenta (cyan) ----*/
  46. //const static BYTE MgtTil304[5][5][3] = {
  47. static BYTE MgtTil304[5][5][3] = {
  48. { {27,37,47},{10,20,30},{ 0, 5,15},{58,68,73},{42,52,62} },
  49. { {59,69,74},{40,50,60},{25,35,45},{13,23,33},{ 3, 8,18} },
  50. { {14,24,34},{ 4, 9,19},{56,66,71},{43,53,63},{28,38,48} },
  51. { {44,54,64},{29,39,49},{11,21,31},{ 1, 6,16},{57,67,72} },
  52. { { 2, 7,17},{55,65,70},{41,51,61},{26,36,46},{12,22,32} }
  53. };
  54. /*---- yellow ----*/
  55. //const static BYTE YelTil304[4][4][3] = {
  56. static BYTE YelTil304[4][4][3] = {
  57. { {32,40,44},{ 8,16,24},{34,42,46},{10,18,26} },
  58. { { 0, 4,12},{20,28,36},{ 2, 6,14},{22,30,38} },
  59. { {35,43,47},{11,19,27},{33,41,45},{ 9,17,25} },
  60. { { 3, 7,15},{23,31,39},{ 1, 5,13},{21,29,37} }
  61. };
  62. /*---- black ----*/
  63. //const static BYTE BlaTil304[4][4][3] = {
  64. static BYTE BlaTil304[4][4][3] = {
  65. { { 0, 4,12},{20,28,36},{ 1, 5,13},{21,29,37} },
  66. { {32,40,44},{ 8,16,24},{33,41,45},{ 9,17,25} },
  67. { { 3, 7,15},{23,31,39},{ 2, 6,14},{22,30,38} },
  68. { {35,43,47},{11,19,27},{34,42,46},{10,18,26} }
  69. };
  70. /*----------------------------------------------------------------------------
  71. Pattern original(300dpi)
  72. ----------------------------------------------------------------------------*/
  73. /*---- magenta(cyan) ----*/
  74. //const static BYTE MgtTil316[5][5] = {
  75. static BYTE MgtTil316[5][5] = {
  76. { 12, 5, 0, 23, 17 },
  77. { 24, 15, 10, 8, 3 },
  78. { 9, 4, 21, 18, 13 },
  79. { 19, 14, 6, 1, 22 },
  80. { 2, 20, 16, 11, 7 }
  81. };
  82. /*---- yellow ----*/
  83. //const static BYTE YelTil316[4][4] = {
  84. static BYTE YelTil316[4][4] = {
  85. // { 12, 4, 14, 6 },
  86. // { 0, 8, 2, 10 },
  87. // { 15, 7, 13, 5 },
  88. // { 3, 11, 1, 9 }
  89. { 6, 4, 15, 13 },
  90. { 10, 8, 3, 1 },
  91. { 14, 12, 7, 5 },
  92. { 2, 0, 11, 9 }
  93. };
  94. /*---- black ----*/
  95. //const static BYTE BlaTil316[4][4] = {
  96. static BYTE BlaTil316[4][4] = {
  97. { 0, 8, 1, 9 },
  98. { 12, 4, 13, 5 },
  99. { 3, 11, 2, 10 },
  100. { 15, 7, 14, 6 }
  101. };
  102. /*----------------------------------------------------------------------------
  103. Pattern original(600dpi)
  104. ----------------------------------------------------------------------------*/
  105. /*---- cyan ----*/
  106. //const static BYTE CynTil600[10][10] = {
  107. static BYTE CynTil600[10][10] = {
  108. { 4, 24, 72, 57, 37, 77, 94, 99, 54, 9 },
  109. { 14, 44, 80, 85, 65, 25, 45, 60, 34, 19 },
  110. { 39, 79, 90, 95, 50, 5, 0, 20, 74, 59 },
  111. { 66, 26, 46, 61, 30, 15, 10, 40, 81, 86 },
  112. { 51, 6, 1, 21, 70, 55, 35, 75, 91, 96 },
  113. { 31, 16, 11, 41, 83, 88, 68, 28, 48, 63 },
  114. { 71, 56, 36, 76, 93, 98, 53, 8, 3, 23 },
  115. { 82, 87, 67, 27, 47, 62, 33, 18, 13, 43 },
  116. { 92, 97, 52, 7, 2, 22, 73, 58, 38, 78 },
  117. { 49, 64, 32, 17, 12, 42, 84, 89, 69, 29 }
  118. };
  119. /*---- magenta ----*/
  120. //const static BYTE MgtTil600[10][10] = {
  121. static BYTE MgtTil600[10][10] = {
  122. { 4, 54, 99, 94, 77, 37, 57, 72, 24, 9 },
  123. { 14, 34, 60, 45, 25, 65, 85, 80, 44, 19 },
  124. { 59, 74, 20, 5, 0, 50, 95, 90, 79, 39 },
  125. { 86, 81, 40, 15, 10, 30, 61, 46, 26, 66 },
  126. { 96, 91, 75, 35, 55, 70, 21, 6, 1, 51 },
  127. { 63, 48, 28, 68, 88, 83, 41, 16, 11, 31 },
  128. { 23, 8, 3, 53, 98, 93, 76, 36, 56, 71 },
  129. { 43, 18, 13, 33, 62, 47, 27, 67, 87, 82 },
  130. { 78, 38, 58, 73, 22, 7, 2, 52, 97, 92 },
  131. { 29, 69, 89, 84, 42, 17, 12, 32, 64, 49 }
  132. };
  133. /*---- yellow ----*/
  134. //const static BYTE YelTil600[6][6] = {
  135. static BYTE YelTil600[6][6] = {
  136. // { 5, 17, 35, 33, 21, 7 },
  137. // { 27, 8, 22, 14, 10, 19 },
  138. // { 30, 12, 2, 0, 24, 28 },
  139. // { 32, 20, 6, 4, 16, 34 },
  140. // { 15, 11, 18, 26, 9, 23 },
  141. // { 1, 25, 29, 31, 13, 3 }
  142. /* for smoothing */
  143. { 5, 13, 31, 29, 15, 7 },
  144. { 9, 21, 35, 33, 23, 11 },
  145. { 24, 16, 2, 0, 18, 26 },
  146. { 28, 14, 6, 4, 12, 30 },
  147. { 32, 22, 10, 8, 20, 34 },
  148. { 1, 19, 27, 25, 17, 3 }
  149. };
  150. /*---- black ----*/
  151. //const static BYTE BlaTil600[4][4] = {
  152. static BYTE BlaTil600[4][4] = {
  153. { 12, 9, 5, 13 },
  154. { 4, 1, 0, 10 },
  155. { 8, 3, 2, 6 },
  156. { 15, 7, 11, 14 }
  157. };
  158. /*----------------------------------------------------------------------------
  159. Pattern original(600dpi)
  160. ----------------------------------------------------------------------------*/
  161. //const static BYTE DizPatPrn[4][64] = {
  162. static BYTE DizPatPrn[4][64] = {
  163. /*---- cyan ----*/
  164. { 61, 45, 20, 12, 8, 28, 41, 57,
  165. 1, 25, 36, 52, 48, 32, 17, 5,
  166. 9, 29, 43, 59, 63, 47, 21, 13,
  167. 49, 33, 19, 7, 3, 27, 37, 53,
  168. 62, 46, 23, 15, 11, 31, 42, 58,
  169. 2, 26, 39, 55, 51, 35, 18, 6,
  170. 10, 30, 40, 56, 60, 44, 22, 14,
  171. 50, 34, 16, 4, 0, 24, 38, 54 },
  172. /*---- magenta ----*/
  173. { 49, 13, 9, 61, 50, 14, 10, 62,
  174. 33, 29, 25, 45, 34, 30, 26, 46,
  175. 16, 40, 39, 23, 19, 43, 36, 20,
  176. 0, 56, 55, 7, 3, 59, 52, 4,
  177. 8, 60, 51, 15, 11, 63, 48, 12,
  178. 24, 44, 35, 31, 27, 47, 32, 28,
  179. 37, 21, 17, 41, 38, 22, 18, 42,
  180. 53, 5, 1, 57, 54, 6, 2, 58 },
  181. /*---- yellow ----*/
  182. { 48, 36, 20, 52, 50, 38, 22, 54,
  183. 16, 4, 0, 40, 18, 6, 2, 42,
  184. 32, 12, 8, 24, 34, 14, 10, 26,
  185. 60, 28, 44, 56, 62, 30, 46, 58,
  186. 51, 39, 23, 55, 49, 37, 21, 53,
  187. 19, 7, 3, 43, 17, 5, 1, 41,
  188. 35, 15, 11, 27, 33, 13, 9, 25,
  189. 63, 31, 47, 59, 61, 29, 45, 57 },
  190. /*---- black ----*/
  191. { 9, 25, 35, 15, 11, 27, 33, 13,
  192. 45, 57, 63, 31, 47, 59, 61, 29,
  193. 22, 54, 48, 36, 20, 52, 50, 38,
  194. 2, 42, 16, 4, 0, 40, 18, 6,
  195. 10, 26, 32, 12, 8, 24, 34, 14,
  196. 46, 58, 60, 28, 44, 56, 62, 30,
  197. 21, 53, 51, 39, 23, 55, 49, 37,
  198. 1, 41, 19, 7, 3, 43, 17, 5 }
  199. };
  200. /*----------------------------------------------------------------------------
  201. Pattern original(monochrome)
  202. ----------------------------------------------------------------------------*/
  203. //const static BYTE Mon4x4Bun[8 * 8] = {
  204. static BYTE Mon4x4Bun[8 * 8] = {
  205. 0, 32, 8, 40, 2, 34, 10, 42,
  206. 48, 16, 56, 24, 50, 18, 58, 26,
  207. 12, 44, 4, 36, 14, 46, 6, 38,
  208. 60, 28, 52, 20, 62, 30, 54, 22,
  209. 3, 35, 11, 43, 1, 33, 9, 41,
  210. 51, 19, 59, 27, 49, 17, 57, 25,
  211. 15, 47, 7, 39, 13, 45, 5, 37,
  212. 63, 31, 55, 23, 61, 29, 53, 21
  213. };
  214. //const static BYTE Mon4x4Ami[8 * 8] = {
  215. static BYTE Mon4x4Ami[8 * 8] = {
  216. 8, 0, 56, 48, 10, 2, 58, 50,
  217. 40, 32, 28, 20, 42, 34, 30, 22,
  218. 60, 52, 12, 4, 62, 54, 14, 6,
  219. 24, 16, 44, 36, 26, 18, 46, 38,
  220. 11, 3, 59, 51, 9, 1, 57, 49,
  221. 43, 35, 31, 23, 41, 33, 29, 21,
  222. 63, 55, 15, 7, 61, 53, 13, 5,
  223. 27, 19, 47, 39, 25, 17, 45, 37
  224. };
  225. //const static BYTE Mon4x4Syu[8 * 8] = {
  226. static BYTE Mon4x4Syu[8 * 8] = {
  227. 48, 36, 20, 52, 50, 38, 22, 54,
  228. 16, 4, 0, 40, 18, 6, 2, 42,
  229. 32, 12, 8, 24, 34, 14, 10, 26,
  230. 60, 28, 44, 56, 62, 30, 46, 58,
  231. 51, 39, 23, 55, 49, 37, 21, 53,
  232. 19, 7, 3, 43, 17, 5, 1, 41,
  233. 35, 15, 11, 27, 33, 13, 9, 25,
  234. 63, 31, 47, 59, 61, 29, 45, 57
  235. };
  236. //const static BYTE Mon8x8Ami[8 * 8] = {
  237. static BYTE Mon8x8Ami[8 * 8] = {
  238. 7, 13, 39, 59, 58, 43, 17, 5,
  239. 23, 31, 49, 44, 36, 50, 25, 15,
  240. 41, 52, 26, 18, 10, 28, 53, 33,
  241. 61, 34, 8, 2, 0, 20, 46, 60,
  242. 62, 42, 16, 6, 4, 12, 38, 63,
  243. 37, 55, 24, 14, 22, 30, 54, 45,
  244. 11, 29, 48, 32, 40, 51, 27, 19,
  245. 3, 21, 47, 56, 57, 35, 9, 1
  246. };
  247. //const static BYTE Mon8x8Syu[8 * 8] = {
  248. static BYTE Mon8x8Syu[8 * 8] = {
  249. 60, 57, 49, 34, 33, 45, 53, 61,
  250. 52, 40, 29, 21, 17, 25, 41, 58,
  251. 44, 24, 12, 9, 5, 13, 30, 50,
  252. 32, 16, 4, 1, 0, 10, 22, 38,
  253. 36, 20, 8, 3, 2, 6, 18, 34,
  254. 48, 28, 15, 7, 11, 14, 26, 46,
  255. 56, 43, 27, 19, 23, 31, 42, 54,
  256. 63, 55, 47, 35, 39, 51, 59, 62
  257. };
  258. /*----------------------------------------------------------------------------
  259. pattern disposition table
  260. ----------------------------------------------------------------------------*/
  261. //const static BYTE MgtTilNum[17] = {
  262. static BYTE MgtTilNum[17] = {
  263. 2, 11, 13, 4, 15, 6, 3, 12, 1, 10, 16, 7, 14, 5, 8, 0, 9
  264. };
  265. //const static BYTE Bun6x6All[36] = {
  266. static BYTE Bun6x6All[36] = {
  267. 0, 32, 8, 2, 34, 10,
  268. 20, 16, 28, 22, 18, 30,
  269. 12, 24, 4, 14, 26, 6,
  270. 3, 35, 11, 1, 33, 9,
  271. 23, 19, 31, 21, 17, 29,
  272. 15, 27, 7, 13, 25, 5
  273. };
  274. //const static BYTE Bun4x4All[16] = {
  275. static BYTE Bun4x4All[16] = {
  276. 0, 8, 2, 10,
  277. 12, 4, 14 , 6,
  278. 3, 11, 1, 9,
  279. 15, 7, 13, 5
  280. };
  281. //const static BYTE Bun3x3All[9] = {
  282. static BYTE Bun3x3All[9] = {
  283. 8, 3, 6,
  284. 2, 4, 0,
  285. 5, 1, 7
  286. };
  287. //const static BYTE Bun2x2All[4] = {
  288. static BYTE Bun2x2All[4] = {
  289. 0, 2,
  290. 3, 1
  291. };
  292. /*============================================================================
  293. dot gain revision table
  294. ============================================================================*/
  295. //const static BYTE GinTblP05[256] = {
  296. static BYTE GinTblP05[256] = {
  297. /* 00 */ 0x00,0x01,0x02,0x03,0x04,0x06,0x07,0x08,
  298. /* 08 */ 0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x11,
  299. /* 10 */ 0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,
  300. /* 18 */ 0x1a,0x1c,0x1d,0x1e,0x1f,0x20,0x21,0x22,
  301. /* 20 */ 0x23,0x24,0x25,0x27,0x28,0x29,0x2a,0x2b,
  302. /* 28 */ 0x2c,0x2d,0x2e,0x2f,0x30,0x32,0x33,0x34,
  303. /* 30 */ 0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,
  304. /* 38 */ 0x3e,0x3f,0x40,0x41,0x42,0x43,0x44,0x45,
  305. /* 40 */ 0x46,0x47,0x48,0x4a,0x4b,0x4c,0x4d,0x4e,
  306. /* 48 */ 0x4f,0x50,0x51,0x52,0x53,0x54,0x56,0x57,
  307. /* 50 */ 0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f,
  308. /* 58 */ 0x60,0x61,0x62,0x63,0x65,0x66,0x67,0x68,
  309. /* 60 */ 0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70,
  310. /* 68 */ 0x71,0x72,0x73,0x74,0x76,0x77,0x78,0x79,
  311. /* 70 */ 0x7a,0x7b,0x7c,0x7d,0x7e,0x7f,0x80,0x81,
  312. /* 78 */ 0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,
  313. /* 80 */ 0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,
  314. /* 88 */ 0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,
  315. /* 90 */ 0x9a,0x9b,0x9c,0x9c,0x9d,0x9e,0x9f,0xa0,
  316. /* 98 */ 0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,
  317. /* a0 */ 0xa9,0xaa,0xab,0xac,0xac,0xad,0xae,0xaf,
  318. /* a8 */ 0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,
  319. /* b0 */ 0xb8,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,
  320. /* b8 */ 0xbf,0xc0,0xc1,0xc2,0xc3,0xc3,0xc4,0xc5,
  321. /* c0 */ 0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,
  322. /* c8 */ 0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,
  323. /* d0 */ 0xd5,0xd6,0xd7,0xd7,0xd8,0xd9,0xda,0xdb,
  324. /* d8 */ 0xdc,0xdd,0xde,0xdf,0xe0,0xe0,0xe1,0xe2,
  325. /* e0 */ 0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xe9,
  326. /* e8 */ 0xea,0xeb,0xec,0xed,0xee,0xef,0xf0,0xf1,
  327. /* f0 */ 0xf2,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,
  328. /* f8 */ 0xf9,0xfa,0xfb,0xfb,0xfc,0xfd,0xfe,0xff
  329. };
  330. //const static BYTE GinTblP10[256] = {
  331. static BYTE GinTblP10[256] = {
  332. /* 00 */ 0x00,0x01,0x02,0x04,0x05,0x06,0x07,0x09,
  333. /* 08 */ 0x0a,0x0b,0x0c,0x0d,0x0f,0x10,0x11,0x12,
  334. /* 10 */ 0x13,0x15,0x16,0x17,0x18,0x1a,0x1b,0x1c,
  335. /* 18 */ 0x1d,0x1e,0x20,0x21,0x22,0x23,0x24,0x26,
  336. /* 20 */ 0x27,0x28,0x29,0x2b,0x2c,0x2d,0x2e,0x2f,
  337. /* 28 */ 0x31,0x32,0x33,0x34,0x35,0x37,0x38,0x39,
  338. /* 30 */ 0x3a,0x3b,0x3d,0x3e,0x3f,0x40,0x41,0x43,
  339. /* 38 */ 0x44,0x45,0x46,0x47,0x48,0x4a,0x4b,0x4c,
  340. /* 40 */ 0x4d,0x4e,0x50,0x51,0x52,0x53,0x54,0x55,
  341. /* 48 */ 0x57,0x58,0x59,0x5a,0x5b,0x5c,0x5e,0x5f,
  342. /* 50 */ 0x60,0x61,0x62,0x63,0x65,0x66,0x67,0x68,
  343. /* 58 */ 0x69,0x6a,0x6b,0x6d,0x6e,0x6f,0x70,0x71,
  344. /* 60 */ 0x72,0x73,0x74,0x76,0x77,0x78,0x79,0x7a,
  345. /* 68 */ 0x7b,0x7c,0x7d,0x7e,0x7f,0x81,0x82,0x83,
  346. /* 70 */ 0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,
  347. /* 78 */ 0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,
  348. /* 80 */ 0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,
  349. /* 88 */ 0x9b,0x9c,0x9d,0x9e,0x9f,0xa0,0xa1,0xa2,
  350. /* 90 */ 0xa3,0xa4,0xa5,0xa5,0xa6,0xa7,0xa8,0xa9,
  351. /* 98 */ 0xaa,0xab,0xac,0xac,0xad,0xae,0xaf,0xb0,
  352. /* a0 */ 0xb1,0xb2,0xb3,0xb3,0xb4,0xb5,0xb6,0xb7,
  353. /* a8 */ 0xb8,0xb9,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,
  354. /* b0 */ 0xbe,0xbf,0xc0,0xc1,0xc2,0xc3,0xc4,0xc4,
  355. /* b8 */ 0xc5,0xc6,0xc7,0xc8,0xc9,0xc9,0xca,0xcb,
  356. /* c0 */ 0xcc,0xcd,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,
  357. /* c8 */ 0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd7,0xd8,
  358. /* d0 */ 0xd9,0xda,0xdb,0xdb,0xdc,0xdd,0xde,0xdf,
  359. /* d8 */ 0xdf,0xe0,0xe1,0xe2,0xe3,0xe4,0xe4,0xe5,
  360. /* e0 */ 0xe6,0xe7,0xe8,0xe8,0xe9,0xea,0xeb,0xec,
  361. /* e8 */ 0xec,0xed,0xee,0xef,0xf0,0xf0,0xf1,0xf2,
  362. /* f0 */ 0xf3,0xf4,0xf5,0xf5,0xf6,0xf7,0xf8,0xf9,
  363. /* f8 */ 0xf9,0xfa,0xfb,0xfc,0xfd,0xfd,0xfe,0xff
  364. };
  365. //const static BYTE GinTblP15[256] = {
  366. static BYTE GinTblP15[256] = {
  367. /* 00 */ 0x00,0x01,0x03,0x04,0x05,0x07,0x08,0x09,
  368. /* 08 */ 0x0b,0x0c,0x0d,0x0f,0x10,0x11,0x13,0x14,
  369. /* 10 */ 0x15,0x17,0x18,0x1a,0x1b,0x1c,0x1e,0x1f,
  370. /* 18 */ 0x20,0x22,0x23,0x24,0x26,0x27,0x28,0x2a,
  371. /* 20 */ 0x2b,0x2c,0x2e,0x2f,0x30,0x32,0x33,0x34,
  372. /* 28 */ 0x35,0x37,0x38,0x39,0x3b,0x3c,0x3d,0x3f,
  373. /* 30 */ 0x40,0x41,0x43,0x44,0x45,0x47,0x48,0x49,
  374. /* 38 */ 0x4a,0x4c,0x4d,0x4e,0x50,0x51,0x52,0x53,
  375. /* 40 */ 0x55,0x56,0x57,0x59,0x5a,0x5b,0x5c,0x5e,
  376. /* 48 */ 0x5f,0x60,0x61,0x63,0x64,0x65,0x66,0x68,
  377. /* 50 */ 0x69,0x6a,0x6b,0x6d,0x6e,0x6f,0x70,0x71,
  378. /* 58 */ 0x73,0x74,0x75,0x76,0x77,0x79,0x7a,0x7b,
  379. /* 60 */ 0x7c,0x7d,0x7e,0x80,0x81,0x82,0x83,0x84,
  380. /* 68 */ 0x85,0x86,0x88,0x89,0x8a,0x8b,0x8c,0x8d,
  381. /* 70 */ 0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,0x95,
  382. /* 78 */ 0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,
  383. /* 80 */ 0x9e,0x9e,0x9f,0xa0,0xa1,0xa2,0xa3,0xa4,
  384. /* 88 */ 0xa5,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,
  385. /* 90 */ 0xab,0xac,0xad,0xae,0xaf,0xb0,0xb0,0xb1,
  386. /* 98 */ 0xb2,0xb3,0xb4,0xb4,0xb5,0xb6,0xb7,0xb8,
  387. /* a0 */ 0xb8,0xb9,0xba,0xbb,0xbc,0xbc,0xbd,0xbe,
  388. /* a8 */ 0xbf,0xbf,0xc0,0xc1,0xc2,0xc3,0xc3,0xc4,
  389. /* b0 */ 0xc5,0xc6,0xc6,0xc7,0xc8,0xc9,0xc9,0xca,
  390. /* b8 */ 0xcb,0xcc,0xcd,0xcd,0xce,0xcf,0xd0,0xd0,
  391. /* c0 */ 0xd1,0xd2,0xd3,0xd3,0xd4,0xd5,0xd5,0xd6,
  392. /* c8 */ 0xd7,0xd8,0xd8,0xd9,0xda,0xdb,0xdb,0xdc,
  393. /* d0 */ 0xdd,0xde,0xde,0xdf,0xe0,0xe1,0xe1,0xe2,
  394. /* d8 */ 0xe3,0xe3,0xe4,0xe5,0xe6,0xe6,0xe7,0xe8,
  395. /* e0 */ 0xe9,0xe9,0xea,0xeb,0xeb,0xec,0xed,0xee,
  396. /* e8 */ 0xee,0xef,0xf0,0xf1,0xf1,0xf2,0xf3,0xf3,
  397. /* f0 */ 0xf4,0xf5,0xf6,0xf6,0xf7,0xf8,0xf9,0xf9,
  398. /* f8 */ 0xfa,0xfb,0xfb,0xfc,0xfd,0xfe,0xfe,0xff
  399. };
  400. static void DizMak302(LPN403DIZINF, DWORD);
  401. static void DizMak304(LPN403DIZINF, DWORD);
  402. static void DizMak316(LPN403DIZINF, DWORD);
  403. static void DizMak602(LPN403DIZINF, DWORD);
  404. static void DizMak604(LPN403DIZINF, DWORD);
  405. static void DizMakSmlPrn(LPN403DIZINF, DWORD);
  406. static void DizMakMon002(LPN403DIZINF, DWORD, LPBYTE, LPBYTE, LONG, LONG);
  407. static void DizMakMon004(LPN403DIZINF, DWORD, LPBYTE, LPBYTE, LONG, LONG);
  408. static void DizMakMon016(LPN403DIZINF, DWORD, LPBYTE, LPBYTE, LONG, LONG);
  409. /*****************************************************************************
  410. Function
  411. *****************************************************************************/
  412. //===================================================================================================
  413. // Make dither pattern
  414. //===================================================================================================
  415. VOID WINAPI N403DizPtnMak(
  416. LPN403DIZINF lpDiz,
  417. DWORD dizNum,
  418. DWORD diz
  419. )
  420. {
  421. if(lpDiz->ColMon == N403_COL){
  422. /*---- Color ----*/
  423. if(lpDiz->PrnMod == N403_MOD_300B1){ DizMak302(lpDiz, dizNum);
  424. }else if(lpDiz->PrnMod == N403_MOD_300B2){ DizMak304(lpDiz, dizNum);
  425. }else if(lpDiz->PrnMod == N403_MOD_300B4){ DizMak316(lpDiz, dizNum);
  426. }else if(lpDiz->PrnMod == N403_MOD_600B1){ DizMak602(lpDiz, dizNum);
  427. }else if(lpDiz->PrnMod == N403_MOD_600B2){
  428. if(diz == N403_DIZ_MID){ DizMak604(lpDiz, dizNum);
  429. }else if(diz == N403_DIZ_SML){ DizMakSmlPrn(lpDiz, dizNum);
  430. }
  431. }
  432. }else{
  433. /*---- Mono ----*/
  434. if(lpDiz->PrnMod == N403_MOD_300B1){
  435. if(diz == N403_DIZ_MID){ DizMakMon002(lpDiz, dizNum, Mon4x4Ami, GinTblP05, 0, 24);
  436. }else if(diz == N403_DIZ_SML){ DizMakMon002(lpDiz, dizNum, Mon4x4Bun, GinTblP10, 0, 48);
  437. }else if(diz == N403_DIZ_RUG){ DizMakMon002(lpDiz, dizNum, Mon8x8Ami, NULL, 0, 0);
  438. }
  439. }else if(lpDiz->PrnMod == N403_MOD_300B2){
  440. if(diz == N403_DIZ_MID){ DizMakMon004(lpDiz, dizNum, Mon4x4Ami, GinTblP05, 6, 24);
  441. }else if(diz == N403_DIZ_SML){ DizMakMon004(lpDiz, dizNum, Mon4x4Bun, GinTblP10, 12, 48);
  442. }else if(diz == N403_DIZ_RUG){ DizMakMon004(lpDiz, dizNum, Mon8x8Ami, NULL, 0, 0);
  443. }
  444. }else if(lpDiz->PrnMod == N403_MOD_300B4){
  445. if(diz == N403_DIZ_MID){ DizMakMon016(lpDiz, dizNum, Mon4x4Ami, GinTblP05, 6, 24);
  446. }else if(diz == N403_DIZ_SML){ DizMakMon016(lpDiz, dizNum, Mon4x4Bun, GinTblP10, 24, 48);
  447. }else if(diz == N403_DIZ_RUG){ DizMakMon016(lpDiz, dizNum, Mon8x8Ami, NULL, 0, 0);
  448. }
  449. }else if(lpDiz->PrnMod == N403_MOD_600B1){
  450. if(diz == N403_DIZ_MID){ DizMakMon002(lpDiz, dizNum, Mon8x8Ami, GinTblP05, 8, 32);
  451. }else if(diz == N403_DIZ_SML){ DizMakMon002(lpDiz, dizNum, Mon4x4Syu, GinTblP10, 16, 64);
  452. }else if(diz == N403_DIZ_RUG){ DizMakMon002(lpDiz, dizNum, Mon8x8Syu, NULL, 0, 0);
  453. }
  454. }else if(lpDiz->PrnMod == N403_MOD_600B2){
  455. if(diz == N403_DIZ_MID){ DizMakMon004(lpDiz, dizNum, Mon8x8Ami, GinTblP05, 8, 32);
  456. }else if(diz == N403_DIZ_SML){ DizMakMon004(lpDiz, dizNum, Mon4x4Syu, GinTblP10, 16, 64);
  457. }else if(diz == N403_DIZ_RUG){ DizMakMon004(lpDiz, dizNum, Mon8x8Syu, NULL, 0, 0);
  458. }
  459. }
  460. }
  461. }
  462. /*----------------------------------------------------------------------------
  463. @300dpi 2value
  464. ----------------------------------------------------------------------------*/
  465. static void DizMak302(
  466. LPN403DIZINF lpDiz,
  467. DWORD dizNum
  468. )
  469. {
  470. DWORD cntTil;
  471. DWORD cntXax;
  472. DWORD cntYax;
  473. LONG num;
  474. LONG num255;
  475. LONG strXax;
  476. LONG strYax;
  477. LPBYTE DizTblC02;
  478. LPBYTE DizTblM02;
  479. LPBYTE DizTblY02;
  480. LPBYTE DizTblB02;
  481. DizTblC02 = lpDiz->Diz.Tbl[dizNum][0];
  482. DizTblM02 = lpDiz->Diz.Tbl[dizNum][1];
  483. DizTblY02 = lpDiz->Diz.Tbl[dizNum][2];
  484. DizTblB02 = lpDiz->Diz.Tbl[dizNum][3];
  485. lpDiz->DizSiz[0] = lpDiz->DizSiz[1] = 17;
  486. lpDiz->DizSiz[2] = lpDiz->DizSiz[3] = 24;
  487. /*---- Make CMYK conversion table ----*/
  488. for(num = 0 ; num < 256 ; num++){
  489. if(num < 0){
  490. num255 = 0;
  491. }else if(num < 128){
  492. num255 = (num - 0)*128/(128 - 0);
  493. }else if(num < (255 - 28)){
  494. num255 = 128 + (num - 128)*128/(128 - 28);
  495. }else{
  496. num255 = 255 - 1;
  497. }
  498. InnTblCmy[num] = (BYTE)num255;
  499. }
  500. /*---- Make magenta cyan pattern ----*/
  501. strXax = 6;
  502. strYax = -1;
  503. for(cntTil = 0; cntTil < 17; cntTil++){
  504. strXax += 4; strYax += 1;
  505. num = (DWORD)StrMgt002 * 17 + MgtTilNum[cntTil];
  506. num255 = num * 255 / (17 * 17 - 1);
  507. if(num255){
  508. num = num * GinTblP05[num255] / num255;
  509. num255 = num * 255 / (17 * 17 - 1);
  510. if(num255){
  511. num = num * InnTblCmy[num255]/num255;
  512. num255 = num * 255 / (17 * 17 - 1);
  513. }
  514. }
  515. if(num255 > 254){ num255 = 254; }
  516. DizTblM02[(strYax % 17) * 32 + (strXax % 17)] = (BYTE)num255;
  517. DizTblC02[(strYax % 17) * 32 + (16 - strXax % 17)] = (BYTE)num255;
  518. for(cntYax = 0; cntYax < 4; cntYax++){
  519. for(cntXax = 0; cntXax < 4; cntXax++){
  520. num = (DWORD)MgtTil302[cntYax][cntXax] * 17;
  521. num += MgtTilNum[cntTil];
  522. num255 = num * 255 / (17 * 17 - 1);
  523. if(num255){
  524. num = num * GinTblP05[num255] / num255;
  525. num255 = num * 255 / (17 * 17 - 1);
  526. if(num255){
  527. num = num * InnTblCmy[num255]/num255;
  528. num255 = num * 255 / (17 * 17 - 1);
  529. }
  530. }
  531. if(num255 > 254){ num255 = 254; }
  532. DizTblM02[((strYax + cntYax + 1) % 17) * 32 + ((strXax + cntXax) % 17)] = (BYTE)num255;
  533. DizTblC02[(strYax + cntYax + 1) % 17 * 32 + (16 - ((strXax + cntXax) % 17))] = (BYTE)num255;
  534. }
  535. }
  536. }
  537. /*---- Make yellow pattern ----*/
  538. for(cntTil = 0; cntTil < 36; cntTil++){
  539. for(cntYax = 0; cntYax < 4; cntYax++){
  540. for(cntXax = 0; cntXax < 4; cntXax++){
  541. num = (DWORD)YelTil302[cntYax][cntXax] * 36;
  542. num += Bun6x6All[cntTil];
  543. num255 = num * 255 / (24 * 24 - 1);
  544. if(num255){
  545. num = num * GinTblP10[num255] / num255;
  546. num255 = num * 255 / (24 * 24 - 1);
  547. if(num255){
  548. num = num * InnTblCmy[num255]/num255;
  549. num255 = num * 255 / (24 * 24 - 1);
  550. }
  551. }
  552. if(num255 > 254){ num255 = 254; }
  553. DizTblY02[((cntTil/6)*4 + cntYax) * 32 + ((cntTil%6)*4 + cntXax)] = (BYTE)num255;
  554. }
  555. }
  556. }
  557. /*---- Make black pattern ----*/
  558. for(cntTil = 0; cntTil < 36; cntTil++){
  559. for(cntYax = 0; cntYax < 4; cntYax++){
  560. for(cntXax = 0; cntXax < 4; cntXax++){
  561. num = (DWORD)BlaTil302[cntYax][cntXax] * 36;
  562. num += Bun6x6All[cntTil];
  563. num255 = num * 255 / (24 * 24 - 1);
  564. if(num255){
  565. num = num * GinTblP10[num255] / num255;
  566. num255 = num * 255 / (24 * 24 - 1);
  567. if(num255){
  568. num = num * InnTblCmy[num255]/num255;
  569. num255 = num * 255 / (24 * 24 - 1);
  570. }
  571. }
  572. if(num255 > 254){ num255 = 254; }
  573. DizTblB02[((cntTil/6)*4 + cntYax) * 32 + ((cntTil%6)*4 + cntXax)] = (BYTE)num255;
  574. }
  575. }
  576. }
  577. }
  578. /*----------------------------------------------------------------------------
  579. A300dpi 4value
  580. ----------------------------------------------------------------------------*/
  581. static void DizMak304(
  582. LPN403DIZINF lpDiz,
  583. DWORD dizNum
  584. )
  585. {
  586. DWORD cntTil;
  587. DWORD cntXax;
  588. DWORD cntYax;
  589. DWORD cnt;
  590. LONG num;
  591. LONG num255;
  592. LPBYTE DizTblC04;
  593. LPBYTE DizTblM04;
  594. LPBYTE DizTblY04;
  595. LPBYTE DizTblB04;
  596. DizTblC04 = lpDiz->Diz.Tbl[dizNum][0];
  597. DizTblM04 = lpDiz->Diz.Tbl[dizNum][1];
  598. DizTblY04 = lpDiz->Diz.Tbl[dizNum][2];
  599. DizTblB04 = lpDiz->Diz.Tbl[dizNum][3];
  600. lpDiz->DizSiz[0] = lpDiz->DizSiz[1] = 10;
  601. lpDiz->DizSiz[2] = lpDiz->DizSiz[3] = 12;
  602. /*---- Make CMYK conversion table ----*/
  603. for(num = 0 ; num < 256 ; num++){
  604. if(num < 20){
  605. num255 = 0;
  606. }else if(num < 128){
  607. num255 = (num - 20)*128/(128 - 20);
  608. }else if(num < (255 - 40)){
  609. num255 = 128 + (num - 128)*128/(128 - 40);
  610. }else{
  611. num255 = 255 - 1;
  612. }
  613. InnTblCmy[num] = (BYTE)num255;
  614. }
  615. /*---- Make magenta cyan pattern ----*/
  616. for(cntTil = 0; cntTil < 4; cntTil++){
  617. for(cntYax = 0; cntYax < 5; cntYax++){
  618. for(cntXax = 0; cntXax < 5; cntXax++){
  619. for(cnt = 0; cnt < 3; cnt++){
  620. num = (DWORD)MgtTil304[cntYax][cntXax][cnt] * 4;
  621. num += Bun2x2All[cntTil];
  622. num255 = num * 255 / (10 * 10 * 3 - 1);
  623. if(num255){
  624. num = num * GinTblP10[num255] / num255;
  625. num255 = num * 255 / (10 * 10 * 3 - 1);
  626. if(num255){
  627. num = num * InnTblCmy[num255]/num255;
  628. num255 = num * 255 / (10 * 10 * 3 - 1);
  629. }
  630. }
  631. if(num255 > 254){ num255 = 254; }
  632. DizTblM04[((cntTil / 2) * 5 + cntYax) * 16 * 3 +
  633. ((cntTil % 2) * 5 + cntXax) * 3 + cnt] = (BYTE)num255;
  634. DizTblC04[((cntTil / 2) * 5 + cntYax) * 16 * 3 +
  635. (9 - ((cntTil % 2) * 5 + cntXax)) * 3 + cnt] = (BYTE)num255;
  636. }
  637. }
  638. }
  639. }
  640. /*---- Make yellow pattern ----*/
  641. for(cntTil = 0; cntTil < 9; cntTil++){
  642. for(cntYax = 0; cntYax < 4; cntYax++){
  643. for(cntXax = 0; cntXax < 4; cntXax++){
  644. for(cnt = 0; cnt < 3; cnt++){
  645. num = (DWORD)YelTil304[cntYax][cntXax][cnt] * 9;
  646. num += Bun3x3All[cntTil];
  647. num255 = num * 255 / (12 * 12 * 3 - 1);
  648. if(num255){
  649. num = num * GinTblP15[num255] / num255;
  650. num255 = num * 255 / (12 * 12 * 3 - 1);
  651. if(num255){
  652. num = num * InnTblCmy[num255]/num255;
  653. num255 = num * 255 / (12 * 12 * 3 - 1);
  654. }
  655. }
  656. if(num255 > 254){ num255 = 254; }
  657. DizTblY04[((cntTil / 3) * 4 + cntYax) * 16 * 3 +
  658. ((cntTil % 3) * 4 + cntXax) * 3 + cnt] = (BYTE)num255;
  659. }
  660. }
  661. }
  662. }
  663. /*---- Make black pattern ----*/
  664. for(cntTil = 0; cntTil < 9; cntTil++){
  665. for(cntYax = 0; cntYax < 4; cntYax++){
  666. for(cntXax = 0; cntXax < 4; cntXax++){
  667. for(cnt = 0; cnt < 3; cnt++){
  668. num = (DWORD)BlaTil304[cntYax][cntXax][cnt] * 9;
  669. num = ((num/4)*4*3 + num%4 + cnt*4)*9;
  670. num += Bun3x3All[cntTil];
  671. num255 = num * 255 / (12 * 12 * 3 - 1);
  672. if(num255){
  673. num = num * GinTblP15[num255] / num255;
  674. num255 = num * 255 / (12 * 12 * 3 - 1);
  675. if(num255){
  676. num = num * InnTblCmy[num255]/num255;
  677. num255 = num * 255 / (12 * 12 * 3 - 1);
  678. }
  679. }
  680. if(num255 > 254){ num255 = 254; }
  681. DizTblB04[((cntTil / 3) * 4 + cntYax) * 16 * 3 +
  682. ((cntTil % 3) * 4 + cntXax) * 3 + cnt] = (BYTE)num255;
  683. }
  684. }
  685. }
  686. }
  687. }
  688. /*----------------------------------------------------------------------------
  689. B300dpi 16value
  690. ----------------------------------------------------------------------------*/
  691. static void DizMak316(
  692. LPN403DIZINF lpDiz,
  693. DWORD dizNum
  694. )
  695. {
  696. DWORD cntXax;
  697. DWORD cntYax;
  698. DWORD cnt;
  699. LONG num;
  700. LONG num255;
  701. LPBYTE DizTblC16;
  702. LPBYTE DizTblM16;
  703. LPBYTE DizTblY16;
  704. LPBYTE DizTblB16;
  705. DizTblC16 = lpDiz->Diz.Tbl[dizNum][0];
  706. DizTblM16 = lpDiz->Diz.Tbl[dizNum][1];
  707. DizTblY16 = lpDiz->Diz.Tbl[dizNum][2];
  708. DizTblB16 = lpDiz->Diz.Tbl[dizNum][3];
  709. lpDiz->DizSiz[0] = lpDiz->DizSiz[1] = 5;
  710. lpDiz->DizSiz[2] = lpDiz->DizSiz[3] = 4;
  711. /*---- Make CMYK conversion table ----*/
  712. for(num = 0 ; num < 256 ; num++){
  713. if(num < 20){
  714. num255 = 0;
  715. }else if(num < 128){
  716. num255 = (num - 20)*128/(128 - 20);
  717. }else if(num < (255 - 40)){
  718. num255 = 128 + (num - 128)*128/(128 - 40);
  719. }else{
  720. num255 = 255 - 1;
  721. }
  722. InnTblCmy[num] = (BYTE)num255;
  723. }
  724. /*---- Make magenta cyan pattern ----*/
  725. for(cntYax = 0; cntYax < 5; cntYax++){
  726. for(cntXax = 0; cntXax < 5; cntXax++){
  727. for(cnt = 0; cnt < 15; cnt++){
  728. num = ((LONG)MgtTil316[cntYax][cntXax] / 5) * 5 * 15;
  729. num += cnt * 5 + MgtTil316[cntYax][cntXax] % 5;
  730. num255 = num * 255 / (5 * 5 * 15 - 1);
  731. if(num255){
  732. num = num * GinTblP10[num255] / num255;
  733. num255 = num * 255 / (5 * 5 * 15 - 1);
  734. if(num255){
  735. num = num * InnTblCmy[num255]/num255;
  736. num255 = num * 255 / (5 * 5 * 15 - 1);
  737. }
  738. }
  739. if(num255 > 254){ num255 = 254; }
  740. DizTblM16[cntYax * 8 * 15 + cntXax * 15 + cnt] = (BYTE)num255;
  741. DizTblC16[cntYax * 8 * 15 + (4-cntXax) * 15 + cnt] = (BYTE)num255;
  742. }
  743. }
  744. }
  745. /*---- Make yellow pattern ----*/
  746. for(cntYax = 0; cntYax < 4; cntYax++){
  747. for(cntXax = 0; cntXax < 4; cntXax++){
  748. for(cnt = 0; cnt < 15; cnt++){
  749. num = ((LONG)YelTil316[cntYax][cntXax] / 4 * 4) * 15;
  750. num += cnt * 4 + YelTil316[cntYax][cntXax] % 4;
  751. num255 = num * 255 / (4 * 4 * 15 - 1);
  752. if(num255){
  753. num = num * GinTblP10[num255] / num255;
  754. num255 = num * 255 / (4 * 4 * 15 - 1);
  755. if(num255 > 128){
  756. num = num * InnTblCmy[num255]/num255;
  757. num255 = num * 255 / (4 * 4 * 15 - 1);
  758. }
  759. }
  760. if(num255 > 254){ num255 = 254; }
  761. DizTblY16[cntYax * 8 * 15 + cntXax * 15 + cnt] = (BYTE)num255;
  762. }
  763. }
  764. }
  765. /*---- Make black pattern ----*/
  766. for(cntYax = 0; cntYax < 4; cntYax++){
  767. for(cntXax = 0; cntXax < 4; cntXax++){
  768. for(cnt = 0; cnt < 15; cnt++){
  769. num = ((LONG)BlaTil316[cntYax][cntXax] / 4 * 4) * 15;
  770. num += cnt * 4 + BlaTil316[cntYax][cntXax] % 4;
  771. num255 = num * 255 / (4 * 4 * 15 - 1);
  772. if(num255){
  773. num = num * GinTblP15[num255] / num255;
  774. num255 = num * 255 / (4 * 4 * 15 - 1);
  775. if(num255){
  776. num = num * InnTblCmy[num255]/num255;
  777. num255 = num * 255 / (4 * 4 * 15 - 1);
  778. }
  779. }
  780. if(num255 > 254){ num255 = 254; }
  781. DizTblB16[cntYax * 8 * 15 + cntXax * 15 + cnt] = (BYTE)num255;
  782. }
  783. }
  784. }
  785. }
  786. /*----------------------------------------------------------------------------
  787. C600dpi 2value
  788. ----------------------------------------------------------------------------*/
  789. static void DizMak602(
  790. LPN403DIZINF lpDiz,
  791. DWORD dizNum
  792. )
  793. {
  794. DWORD cntXax;
  795. DWORD cntYax;
  796. LONG num;
  797. LONG num255;
  798. LPBYTE DizTblC02;
  799. LPBYTE DizTblM02;
  800. LPBYTE DizTblY02;
  801. LPBYTE DizTblB02;
  802. DizTblC02 = lpDiz->Diz.Tbl[dizNum][0];
  803. DizTblM02 = lpDiz->Diz.Tbl[dizNum][1];
  804. DizTblY02 = lpDiz->Diz.Tbl[dizNum][2];
  805. DizTblB02 = lpDiz->Diz.Tbl[dizNum][3];
  806. lpDiz->DizSiz[0] = lpDiz->DizSiz[1] = 20;
  807. lpDiz->DizSiz[2] = lpDiz->DizSiz[3] = 24;
  808. /*---- Make CMYK conversion table ----*/
  809. for(num = 0 ; num < 256 ; num++){
  810. if(num < 24){
  811. num255 = 0;
  812. }else if(num < 128){
  813. num255 = (num - 24)*128/(128 - 24);
  814. }else if(num < (255 - 40)){
  815. num255 = 128 + (num - 128)*128/(128 - 40);
  816. }else{
  817. num255 = 255 - 1;
  818. }
  819. InnTblCmy[num] = (BYTE)num255;
  820. }
  821. /*---- Make cyan pattern ----*/
  822. for(cntYax = 0; cntYax < 20; cntYax++){
  823. for(cntXax = 0; cntXax < 20; cntXax++){
  824. num = (LONG)CynTil600[cntYax%10][cntXax%10];
  825. num = num*4 + Bun2x2All[(cntYax/10)*2 + cntXax/10];
  826. num255 = num * 255 / (20*20-1);
  827. if(num255){
  828. num = num * GinTblP10[num255] / num255;
  829. num255 = num * 255 / (20*20-1);
  830. if(num255){
  831. num = num * InnTblCmy[num255] / num255;
  832. num255 = num * 255 / (20*20-1);
  833. }
  834. }
  835. if(num255 > 254){ num255 = 254; }
  836. DizTblC02[cntYax * 32 + cntXax] = (BYTE)num255;
  837. }
  838. }
  839. /*---- Make magenta pattern ----*/
  840. for(cntYax = 0; cntYax < 20; cntYax++){
  841. for(cntXax = 0; cntXax < 20; cntXax++){
  842. num = (LONG)MgtTil600[cntYax%10][cntXax%10];
  843. num = num*4 + Bun2x2All[(cntYax/10)*2 + cntXax/10];
  844. num255 = num * 255 / (20*20-1);
  845. if(num255){
  846. num = num * GinTblP10[num255] / num255;
  847. num255 = num * 255 / (20*20-1);
  848. if(num255){
  849. num = num * InnTblCmy[num255] / num255;
  850. num255 = num * 255 / (20*20-1);
  851. }
  852. }
  853. if(num255 > 254){ num255 = 254; }
  854. DizTblM02[cntYax * 32 + cntXax] = (BYTE)num255;
  855. }
  856. }
  857. /*---- Make yellow pattern ----*/
  858. for(cntYax = 0; cntYax < 24; cntYax++){
  859. for(cntXax = 0; cntXax < 24; cntXax++){
  860. num = (LONG)YelTil600[cntYax%6][cntXax%6];
  861. num = num*16 + Bun4x4All[(cntYax/6)*4 + cntXax/6];
  862. num255 = num * 255 / (24*24-1);
  863. if(num255){
  864. num = num * GinTblP10[num255] / num255;
  865. num255 = num * 255 / (24*24-1);
  866. if(num255){
  867. num = num * InnTblCmy[num255] / num255;
  868. num255 = num * 255 / (24*24-1);
  869. }
  870. }
  871. if(num255 > 254){ num255 = 254; }
  872. DizTblY02[cntYax * 32 + cntXax] = (BYTE)num255;
  873. }
  874. }
  875. /*---- Make black pattern ----*/
  876. for(cntYax = 0; cntYax < 24; cntYax++){
  877. for(cntXax = 0; cntXax < 24; cntXax++){
  878. num = (LONG)BlaTil600[cntYax%4][cntXax%4];
  879. num = num*36 + Bun6x6All[(cntYax/4)*6 + cntXax/4];
  880. num255 = num * 255 / (24*24-1);
  881. if(num255){
  882. num = num * GinTblP10[num255] / num255;
  883. num255 = num * 255 / (24*24-1);
  884. if(num255){
  885. num = num * InnTblCmy[num255] / num255;
  886. num255 = num * 255 / (24*24-1);
  887. }
  888. }
  889. if(num255 > 254){ num255 = 254; }
  890. DizTblB02[cntYax * 32 + cntXax] = (BYTE)num255;
  891. }
  892. }
  893. }
  894. /*----------------------------------------------------------------------------
  895. D600dpi 4value
  896. ----------------------------------------------------------------------------*/
  897. static void DizMak604(
  898. LPN403DIZINF lpDiz,
  899. DWORD dizNum
  900. )
  901. {
  902. DWORD cntXax;
  903. DWORD cntYax;
  904. DWORD cnt;
  905. LONG num;
  906. LONG num255;
  907. LONG tmpNum;
  908. LPBYTE DizTblC04;
  909. LPBYTE DizTblM04;
  910. LPBYTE DizTblY04;
  911. LPBYTE DizTblB04;
  912. DizTblC04 = lpDiz->Diz.Tbl[dizNum][0];
  913. DizTblM04 = lpDiz->Diz.Tbl[dizNum][1];
  914. DizTblY04 = lpDiz->Diz.Tbl[dizNum][2];
  915. DizTblB04 = lpDiz->Diz.Tbl[dizNum][3];
  916. lpDiz->DizSiz[0] = lpDiz->DizSiz[1] = 10;
  917. lpDiz->DizSiz[2] = lpDiz->DizSiz[3] = 12;
  918. /*---- Make CMYK conversion table ----*/
  919. for(num = 0 ; num < 256 ; num++){
  920. if(num < 24){
  921. num255 = 0;
  922. }else if(num < 128){
  923. num255 = (num - 24)*128/(128 - 24);
  924. }else if(num < (255 - 40)){
  925. num255 = 128 + (num - 128)*128/(128 - 40);
  926. }else{
  927. num255 = 255 - 1;
  928. }
  929. InnTblCmy[num] = (BYTE)num255;
  930. }
  931. /*---- Make cyan pattern ----*/
  932. for(cntYax = 0; cntYax < 10; cntYax++){
  933. for(cntXax = 0; cntXax < 10; cntXax++){
  934. num = (LONG)CynTil600[cntYax][cntXax];
  935. num = (num/5)*5*3 + num%5;
  936. for(cnt = 0; cnt < 3; cnt++){
  937. tmpNum = num + cnt*5;
  938. num255 = tmpNum * 255 / (10*10*3-1);
  939. if(num255){
  940. tmpNum = tmpNum * GinTblP10[num255] / num255;
  941. num255 = tmpNum * 255 / (10*10*3-1);
  942. if(num255){
  943. tmpNum = tmpNum * InnTblCmy[num255]/num255;
  944. num255 = tmpNum * 255 / (10*10*3-1);
  945. }
  946. }
  947. if(num255 >= 255){ num255 = 254; }
  948. DizTblC04[cntYax * 16 * 3 + cntXax * 3 + cnt] = (BYTE)num255;
  949. }
  950. }
  951. }
  952. /*---- Make magenta pattern ----*/
  953. for(cntYax = 0; cntYax < 10; cntYax++){
  954. for(cntXax = 0; cntXax < 10; cntXax++){
  955. num = (LONG)MgtTil600[cntYax][cntXax];
  956. num = (num/5)*5*3 + num%5;
  957. for(cnt = 0; cnt < 3; cnt++){
  958. tmpNum = num + cnt*5;
  959. num255 = tmpNum * 255 / (10*10*3-1);
  960. if(num255){
  961. tmpNum = tmpNum * GinTblP10[num255] / num255;
  962. num255 = tmpNum * 255 / (10*10*3-1);
  963. if(num255){
  964. tmpNum = tmpNum * InnTblCmy[num255]/num255;
  965. num255 = tmpNum * 255 / (10*10*3-1);
  966. }
  967. }
  968. if(num255 >= 255){ num255 = 254; }
  969. DizTblM04[cntYax * 16 * 3 + cntXax * 3 + cnt] = (BYTE)num255;
  970. }
  971. }
  972. }
  973. /*---- Make yellow pattern ----*/
  974. for(cntYax = 0; cntYax < 12; cntYax++){
  975. for(cntXax = 0; cntXax < 12; cntXax++){
  976. num = (LONG)YelTil600[cntYax%6][cntXax%6] * 3;
  977. for(cnt = 0; cnt < 3; cnt++){
  978. tmpNum = (num + cnt)*4 + Bun2x2All[(cntYax/6)*2 + cntXax/6];
  979. num255 = tmpNum * 255 / (12*12*3-1);
  980. if(num255){
  981. tmpNum = tmpNum * GinTblP10[num255] / num255;
  982. num255 = tmpNum * 255 / (12*12*3-1);
  983. if(num255){
  984. tmpNum = tmpNum * InnTblCmy[num255]/num255;
  985. num255 = tmpNum * 255 / (12*12*3-1);
  986. }
  987. }
  988. if(num255 >= 255){ num255 = 254; }
  989. DizTblY04[cntYax * 16 * 3 + cntXax * 3 + cnt] = (BYTE)num255;
  990. }
  991. }
  992. }
  993. /*---- Make black pattern ----*/
  994. for(cntYax = 0; cntYax < 12; cntYax++){
  995. for(cntXax = 0; cntXax < 12; cntXax++){
  996. num = (LONG)BlaTil600[cntYax%4][cntXax%4] * 3;
  997. for(cnt = 0; cnt < 3; cnt++){
  998. tmpNum = (num + cnt)*9 + Bun3x3All[(cntYax/4)*3 + cntXax/4];
  999. num255 = tmpNum * 255 / (12*12*3-1);
  1000. if(num255){
  1001. tmpNum = tmpNum * GinTblP10[num255] / num255;
  1002. num255 = tmpNum * 255 / (12*12*3-1);
  1003. if(num255){
  1004. tmpNum = tmpNum * InnTblCmy[num255]/num255;
  1005. num255 = tmpNum * 255 / (12*12*3-1);
  1006. }
  1007. }
  1008. if(num255 >= 255){ num255 = 254; }
  1009. DizTblB04[cntYax * 16 * 3 + cntXax * 3 + cnt] = (BYTE)num255;
  1010. }
  1011. }
  1012. }
  1013. }
  1014. /*----------------------------------------------------------------------------
  1015. E600dpi 4value DETAIL
  1016. ----------------------------------------------------------------------------*/
  1017. static void DizMakSmlPrn(
  1018. LPN403DIZINF lpDiz,
  1019. DWORD dizNum
  1020. )
  1021. {
  1022. DWORD cntXax;
  1023. DWORD cntYax;
  1024. DWORD cnt;
  1025. LONG num;
  1026. LONG num255;
  1027. LPBYTE DizTblSml;
  1028. LPBYTE DizTblPc4;
  1029. LPBYTE DizTblPm4;
  1030. LPBYTE DizTblPy4;
  1031. LPBYTE DizTblPb4;
  1032. DizTblSml = lpDiz->Diz.Tbl[dizNum][0];
  1033. DizTblPc4 = lpDiz->EntDiz.Tbl[0];
  1034. DizTblPm4 = lpDiz->EntDiz.Tbl[1];
  1035. DizTblPy4 = lpDiz->EntDiz.Tbl[2];
  1036. DizTblPb4 = lpDiz->EntDiz.Tbl[3];
  1037. /*---- Make CMYK conversion table ----*/
  1038. for(num = 0 ; num < 256 ; num++){
  1039. if(num < 64){
  1040. num255 = 0;
  1041. }else if(num < 128){
  1042. num255 = (num - 64)*128/(128 - 64);
  1043. }else if(num < (255 - 48)){
  1044. num255 = 128 + (num - 128)*128/(128 - 48);
  1045. }else{
  1046. num255 = 255 - 1;
  1047. }
  1048. InnTblCmy[num] = (BYTE)num255;
  1049. }
  1050. /*---- Make magenta pattern ----*/
  1051. /*---- Make cyan pattern ----*/
  1052. /*---- Make yellow pattern ----*/
  1053. /*---- Make black pattern ----*/
  1054. for(cntYax = 0; cntYax < 16; cntYax++){
  1055. for(cntXax = 0; cntXax < 16; cntXax++){
  1056. for(cnt = 0; cnt < 3; cnt++){
  1057. num = BlaTil302[cntYax%4][cntXax%4] * 3 + cnt;
  1058. num = num * 16 + Bun4x4All[cntYax/4*4 + cntXax/4];
  1059. num255 = num * 255 / (16*16*3 - 1);
  1060. if(num255){
  1061. num = num * GinTblP15[num255] / num255;
  1062. num255 = num * 255 / (16*16*3 - 1);
  1063. if(num255){
  1064. num = num * InnTblCmy[num255]/num255;
  1065. num255 = num * 255 / (16*16*3 - 1);
  1066. }
  1067. }
  1068. if(num255 > 254){ num255 = 254; }
  1069. DizTblSml[cntYax * 16 * 3 + cntXax * 3 + cnt] = (BYTE)num255;
  1070. }
  1071. }
  1072. }
  1073. /*---- Make CMYK conversion table ----*/
  1074. for(num = 0 ; num < 256 ; num++){
  1075. if(num < 32){
  1076. num255 = 0;
  1077. }else if(num < 128){
  1078. num255 = (num - 32)*128/(128 - 32);
  1079. }else if(num < (255 - 44)){
  1080. num255 = 128 + (num - 128)*128/(128 - 44);
  1081. }else{
  1082. num255 = 255 - 1;
  1083. }
  1084. InnTblCmy[num] = (BYTE)num255;
  1085. }
  1086. /*---- Make cyan pattern ----*/
  1087. for(cntYax = 0 ; cntYax < 16 ; cntYax ++){
  1088. for(cntXax = 0 ; cntXax < 16 ; cntXax ++){
  1089. for(cnt = 0; cnt < 3; cnt++){
  1090. num = DizPatPrn[0][(cntYax%8)*8 + cntXax%8];
  1091. num = num*4 + Bun2x2All[(cntYax/8)*2 + cntXax/8];
  1092. num = num/16*16*3 + cnt*16 + num%16;
  1093. num255 = num * 255 / (16*16*3 - 1);
  1094. if(num255){
  1095. num = num * GinTblP10[num255] / num255;
  1096. num255 = num * 255 / (16*16*3 - 1);
  1097. if(num255){
  1098. num = num * InnTblCmy[num255] / num255;
  1099. num255 = num * 255 / (16*16*3 - 1);
  1100. }
  1101. }
  1102. if(num255 > 254){ num255 = 254; }
  1103. DizTblPc4[cntYax * 16 * 3 + cntXax * 3 + cnt] = (BYTE)num255;
  1104. }
  1105. }
  1106. }
  1107. /*---- Make magenta pattern ----*/
  1108. for(cntYax = 0 ; cntYax < 16 ; cntYax ++){
  1109. for(cntXax = 0 ; cntXax < 16 ; cntXax ++){
  1110. for(cnt = 0; cnt < 3; cnt++){
  1111. num = DizPatPrn[1][(cntYax%8)*8 + cntXax%8];
  1112. num = num*4 + Bun2x2All[(cntYax/8)*2 + cntXax/8];
  1113. num = num/16*16*3 + cnt*16 + num%16;
  1114. num255 = num * 255 / (16*16*3 - 1);
  1115. if(num255){
  1116. num = num * GinTblP10[num255] / num255;
  1117. num255 = num * 255 / (16*16*3 - 1);
  1118. if(num255){
  1119. num = num * InnTblCmy[num255] / num255;
  1120. num255 = num * 255 / (16*16*3 - 1);
  1121. }
  1122. }
  1123. if(num255 > 254){ num255 = 254; }
  1124. DizTblPm4[cntYax * 16 * 3 + cntXax * 3 + cnt] = (BYTE)num255;
  1125. }
  1126. }
  1127. }
  1128. /*---- Make yellow pattern ----*/
  1129. for(cntYax = 0 ; cntYax < 16 ; cntYax ++){
  1130. for(cntXax = 0 ; cntXax < 16 ; cntXax ++){
  1131. for(cnt = 0; cnt < 3; cnt++){
  1132. num = DizPatPrn[2][(cntYax%8)*8 + cntXax%8];
  1133. num = num*4 + Bun2x2All[(cntYax/8)*2 + cntXax/8];
  1134. num = num/16*16*3 + cnt*16 + num%16;
  1135. num255 = num * 255 / (16*16*3 - 1);
  1136. if(num255){
  1137. num = num * GinTblP10[num255] / num255;
  1138. num255 = num * 255 / (16*16*3 - 1);
  1139. if(num255){
  1140. num = num * InnTblCmy[num255] / num255;
  1141. num255 = num * 255 / (16*16*3 - 1);
  1142. }
  1143. }
  1144. if(num255 > 254){ num255 = 254; }
  1145. DizTblPy4[cntYax * 16 * 3 + cntXax * 3 + cnt] = (BYTE)num255;
  1146. }
  1147. }
  1148. }
  1149. /*---- Make black pattern ----*/
  1150. for(cntYax = 0 ; cntYax < 16 ; cntYax ++){
  1151. for(cntXax = 0 ; cntXax < 16 ; cntXax ++){
  1152. for(cnt = 0; cnt < 3; cnt++){
  1153. num = DizPatPrn[3][(cntYax%8)*8 + cntXax%8];
  1154. num = num*4 + Bun2x2All[(cntYax/8)*2 + cntXax/8];
  1155. num = num/16*16*3 + cnt*16 + num%16;
  1156. num255 = num * 255 / (16*16*3 - 1);
  1157. if(num255){
  1158. num = num * GinTblP10[num255] / num255;
  1159. num255 = num * 255 / (16*16*3 - 1);
  1160. if(num255){
  1161. num = num * InnTblCmy[num255] / num255;
  1162. num255 = num * 255 / (16*16*3 - 1);
  1163. }
  1164. }
  1165. if(num255 > 254){ num255 = 254; }
  1166. DizTblPb4[cntYax * 16 * 3 + cntXax * 3 + cnt] = (BYTE)num255;
  1167. }
  1168. }
  1169. }
  1170. }
  1171. /*----------------------------------------------------------------------------
  1172. 7 Monochrome 2value
  1173. ----------------------------------------------------------------------------*/
  1174. static void DizMakMon002(
  1175. LPN403DIZINF lpDiz,
  1176. DWORD dizNum,
  1177. LPBYTE tilTbl,
  1178. LPBYTE ginTbl,
  1179. LONG minCut,
  1180. LONG maxCut
  1181. )
  1182. {
  1183. DWORD cntXax;
  1184. DWORD cntYax;
  1185. LONG num;
  1186. LONG num255;
  1187. LPBYTE DizTblB02;
  1188. // Check of zero divide 2002.3.23 >>>
  1189. if ((minCut < 0) || (128 <= minCut)) {
  1190. ERR(("DizMakMon002() 0Div-Check [minCut=%d] \n",minCut));
  1191. return;
  1192. }
  1193. if ((maxCut < 0) || (128 <= maxCut)) {
  1194. ERR(("DizMakMon002() 0Div-Check [maxCut=%d] \n",maxCut));
  1195. return;
  1196. }
  1197. // Check of zero divide 2002.3.23 <<<
  1198. DizTblB02 = lpDiz->Diz.Tbl[dizNum][3];
  1199. lpDiz->DizSiz[0] = lpDiz->DizSiz[1] = 32;
  1200. lpDiz->DizSiz[2] = lpDiz->DizSiz[3] = 32;
  1201. /*---- Make conversion table ----*/
  1202. for(num = 0 ; num < 256 ; num++){
  1203. if(num < minCut){
  1204. num255 = 0;
  1205. }else if(num < 128){
  1206. num255 = (num - minCut)*128/(128 - minCut);
  1207. }else if(num < (255 - maxCut)){
  1208. num255 = 128 + (num - 128)*128/(128 - maxCut);
  1209. }else{
  1210. num255 = 255 - 1;
  1211. }
  1212. InnTblCmy[num] = (BYTE)num255;
  1213. }
  1214. /*---- Make black pattern ----*/
  1215. for(cntYax = 0; cntYax < 32; cntYax++){
  1216. for(cntXax = 0; cntXax < 32; cntXax++){
  1217. num = (LONG)tilTbl[cntYax%8*8 + cntXax%8];
  1218. num = num * 16 + Bun4x4All[cntYax/8*4 + cntXax/8];
  1219. num255 = num * 255 / (32*32 - 1);
  1220. if(num255){
  1221. if(ginTbl != NULL){
  1222. num = num * ginTbl[num255] / num255;
  1223. num255 = num * 255 / (32*32 - 1);
  1224. }
  1225. if(num255){
  1226. num = num * InnTblCmy[num255]/num255;
  1227. num255 = num * 255 / (32*32 - 1);
  1228. }
  1229. }
  1230. if(num255 > 254){ num255 = 254; }
  1231. DizTblB02[cntYax * 32 + cntXax] = (BYTE)num255;
  1232. }
  1233. }
  1234. }
  1235. /*----------------------------------------------------------------------------
  1236. GMonochrome 4value
  1237. ----------------------------------------------------------------------------*/
  1238. static void DizMakMon004(
  1239. LPN403DIZINF lpDiz,
  1240. DWORD dizNum,
  1241. LPBYTE tilTbl,
  1242. LPBYTE ginTbl,
  1243. LONG minCut,
  1244. LONG maxCut
  1245. )
  1246. {
  1247. DWORD cntXax;
  1248. DWORD cntYax;
  1249. DWORD cnt;
  1250. LONG num;
  1251. LONG num255;
  1252. LPBYTE DizTblB04;
  1253. // Check of zero divide 2002.3.23 >>>
  1254. if ((minCut < 0) || (128 <= minCut)) {
  1255. ERR(("DizMakMon004() 0Div-Check [minCut=%d] \n",minCut));
  1256. return;
  1257. }
  1258. if ((maxCut < 0) || (128 <= maxCut)) {
  1259. ERR(("DizMakMon004() 0Div-Check [maxCut=%d] \n",maxCut));
  1260. return;
  1261. }
  1262. // Check of zero divide 2002.3.23 <<<
  1263. DizTblB04 = lpDiz->Diz.Tbl[dizNum][3];
  1264. lpDiz->DizSiz[0] = lpDiz->DizSiz[1] = 16;
  1265. lpDiz->DizSiz[2] = lpDiz->DizSiz[3] = 16;
  1266. /*---- Make conversion table ----*/
  1267. for(num = 0 ; num < 256 ; num++){
  1268. if(num < minCut){
  1269. num255 = 0;
  1270. }else if(num < 128){
  1271. num255 = (num - minCut)*128/(128 - minCut);
  1272. }else if(num < (255 - maxCut)){
  1273. num255 = 128 + (num - 128)*128/(128 - maxCut);
  1274. }else{
  1275. num255 = 255 - 1;
  1276. }
  1277. InnTblCmy[num] = (BYTE)num255;
  1278. }
  1279. /*---- Make black pattern ----*/
  1280. for(cntYax = 0; cntYax < 16; cntYax++){
  1281. for(cntXax = 0; cntXax < 16; cntXax++){
  1282. for(cnt = 0; cnt < 3; cnt++){
  1283. num = (LONG)tilTbl[cntYax%8*8 + cntXax%8] * 3 + cnt;
  1284. num = num * 4 + Bun2x2All[cntYax/8*2 + cntXax/8];
  1285. num255 = num * 255 / (16*16*3 - 1);
  1286. if(num255){
  1287. if(ginTbl != NULL){
  1288. num = num * ginTbl[num255] / num255;
  1289. num255 = num * 255 / (16*16*3 - 1);
  1290. }
  1291. if(num255){
  1292. num = num * InnTblCmy[num255]/num255;
  1293. num255 = num * 255 / (16*16*3 - 1);
  1294. }
  1295. }
  1296. if(num255 > 254){ num255 = 254; }
  1297. DizTblB04[cntYax * 16 * 3 + cntXax * 3 + cnt] = (BYTE)num255;
  1298. }
  1299. }
  1300. }
  1301. }
  1302. /*----------------------------------------------------------------------------
  1303. Hmonochrome 16value
  1304. ----------------------------------------------------------------------------*/
  1305. static void DizMakMon016(
  1306. LPN403DIZINF lpDiz,
  1307. DWORD dizNum,
  1308. LPBYTE tilTbl,
  1309. LPBYTE ginTbl,
  1310. LONG minCut,
  1311. LONG maxCut
  1312. )
  1313. {
  1314. DWORD cntXax;
  1315. DWORD cntYax;
  1316. DWORD cnt;
  1317. LONG num;
  1318. LONG num255;
  1319. LPBYTE DizTblB16;
  1320. // Check of zero divide 2002.3.23 >>>
  1321. if ((minCut < 0) || (128 <= minCut)) {
  1322. ERR(("DizMakMon016() 0Div-Check [minCut=%d] \n",minCut));
  1323. return;
  1324. }
  1325. if ((maxCut < 0) || (128 <= maxCut)) {
  1326. ERR(("DizMakMon016() 0Div-Check [maxCut=%d] \n",maxCut));
  1327. return;
  1328. }
  1329. // Check of zero divide 2002.3.23 <<<
  1330. DizTblB16 = lpDiz->Diz.Tbl[dizNum][3];
  1331. lpDiz->DizSiz[0] = lpDiz->DizSiz[1] = 8;
  1332. lpDiz->DizSiz[2] = lpDiz->DizSiz[3] = 8;
  1333. /*---- Make conversion table ----*/
  1334. for(num = 0 ; num < 256 ; num++){
  1335. if(num < minCut){
  1336. num255 = 0;
  1337. }else if(num < 128){
  1338. num255 = (num - minCut)*128/(128 - minCut);
  1339. }else if(num < (255 - maxCut)){
  1340. num255 = 128 + (num - 128)*128/(128 - maxCut);
  1341. }else{
  1342. num255 = 255 - 1;
  1343. }
  1344. InnTblCmy[num] = (BYTE)num255;
  1345. }
  1346. /*---- Make black pattern ----*/
  1347. for(cntYax = 0; cntYax < 8; cntYax++){
  1348. for(cntXax = 0; cntXax < 8; cntXax++){
  1349. for(cnt = 0; cnt < 15; cnt++){
  1350. num = tilTbl[cntYax*8 + cntXax];
  1351. num = num / 8 * 8 * 15 + cnt * 8 + num % 8;
  1352. num255 = num * 255 / (8*8*15 - 1);
  1353. if(num255){
  1354. if(ginTbl != NULL){
  1355. num = num * ginTbl[num255] / num255;
  1356. num255 = num * 255 / (8*8*15 - 1);
  1357. }
  1358. if(num255){
  1359. num = num * InnTblCmy[num255]/num255;
  1360. num255 = num * 255 / (8*8*15 - 1);
  1361. }
  1362. }
  1363. if(num255 > 254){ num255 = 254; }
  1364. DizTblB16[cntYax * 8 * 15 + cntXax * 15 + cnt] = (BYTE)num255;
  1365. }
  1366. }
  1367. }
  1368. }
  1369. //===================================================================================================
  1370. // Make toner density control table
  1371. //===================================================================================================
  1372. VOID WINAPI N403TnrTblMak(
  1373. LPN403DIZINF lpDiz,
  1374. LONG tnrDns
  1375. )
  1376. {
  1377. LONG innNum;
  1378. LONG outNum;
  1379. LPBYTE innTblCmy;
  1380. tnrDns *= 2;
  1381. innTblCmy = lpDiz->Tnr.Tbl;
  1382. /*---- Make CMYK conversion table ----*/
  1383. if(tnrDns < 0){
  1384. for(innNum = 0 ; innNum < 256 ; innNum++){
  1385. if(innNum == 255){ outNum = 255;
  1386. }else{ outNum = innNum * (255 + tnrDns) / 255;
  1387. }
  1388. innTblCmy[innNum] = (BYTE)outNum;
  1389. }
  1390. }else{
  1391. for(innNum = 0 ; innNum < 256 ; innNum++){
  1392. if(innNum == 0){ outNum = 0;
  1393. }else{ outNum = (innNum + tnrDns) * 255 / (255 + tnrDns);
  1394. }
  1395. innTblCmy[innNum] = (BYTE)outNum;
  1396. }
  1397. }
  1398. }
  1399. //===================================================================================================
  1400. // Dithering(2 value)
  1401. //===================================================================================================
  1402. DWORD WINAPI N403Diz002(
  1403. LPN403DIZINF lpDiz,
  1404. DWORD xaxSiz,
  1405. DWORD strXax,
  1406. DWORD strYax,
  1407. DWORD xaxOfs,
  1408. DWORD yaxOfs,
  1409. DWORD xaxNrt,
  1410. DWORD xaxDnt,
  1411. DWORD yaxNrt,
  1412. DWORD yaxDnt,
  1413. LPCMYK cmyBuf,
  1414. LPBYTE linBufCyn,
  1415. LPBYTE linBufMgt,
  1416. LPBYTE linBufYel,
  1417. LPBYTE linBufBla
  1418. )
  1419. {
  1420. DWORD cntHrz;
  1421. DWORD cntXax;
  1422. DWORD cntYax;
  1423. DWORD xaxSet;
  1424. DWORD yaxSet;
  1425. DWORD linByt;
  1426. DWORD tmpXax;
  1427. DWORD tmpBuf;
  1428. DWORD DizSizCyn;
  1429. DWORD DizSizMgt;
  1430. DWORD DizSizYel;
  1431. DWORD DizSizBla;
  1432. LPBYTE DizTblC02;
  1433. LPBYTE DizTblM02;
  1434. LPBYTE DizTblY02;
  1435. LPBYTE DizTblB02;
  1436. LPBYTE dizTblC02;
  1437. LPBYTE dizTblM02;
  1438. LPBYTE dizTblY02;
  1439. LPBYTE dizTblB02;
  1440. CMYK tmpCmy;
  1441. BYTE tmpByt;
  1442. DizTblC02 = lpDiz->Diz.Tbl[lpDiz->Diz.Num][0];
  1443. DizTblM02 = lpDiz->Diz.Tbl[lpDiz->Diz.Num][1];
  1444. DizTblY02 = lpDiz->Diz.Tbl[lpDiz->Diz.Num][2];
  1445. DizTblB02 = lpDiz->Diz.Tbl[lpDiz->Diz.Num][3];
  1446. DizSizCyn = lpDiz->DizSiz[0];
  1447. DizSizMgt = lpDiz->DizSiz[1];
  1448. DizSizYel = lpDiz->DizSiz[2];
  1449. DizSizBla = lpDiz->DizSiz[3];
  1450. // Check of zero divide 2002.3.23 >>>
  1451. if ((DizSizCyn == 0) || (DizSizMgt == 0)||
  1452. (DizSizYel == 0) || (DizSizBla == 0)) {
  1453. ERR(("N403Diz002() 0Div-Check [DizSizCyn,Mgt,Yel,Bla=0] \n"));
  1454. return 0;
  1455. }
  1456. if ((xaxDnt == 0) || (yaxDnt == 0)) {
  1457. ERR(("N403Diz002() 0Div-Check [xaxDnt,yaxDnt=0] \n"));
  1458. return 0;
  1459. }
  1460. // Check of zero divide 2002.3.23 <<<
  1461. if((xaxNrt == xaxDnt)&&(yaxNrt == yaxDnt)){
  1462. /*---- Not stretch ----*/
  1463. dizTblC02 = DizTblC02 + strYax % DizSizCyn * 32;
  1464. dizTblM02 = DizTblM02 + strYax % DizSizMgt * 32;
  1465. dizTblY02 = DizTblY02 + strYax % DizSizYel * 32;
  1466. dizTblB02 = DizTblB02 + strYax % DizSizBla * 32;
  1467. for(cntHrz = 0 ; cntHrz < xaxSiz ; cntHrz++){
  1468. tmpCmy = *cmyBuf; cmyBuf++;
  1469. tmpByt = (BYTE)0x80 >> (cntHrz % 8);
  1470. tmpBuf = cntHrz / 8;
  1471. if(tmpCmy.Cyn){
  1472. if (tmpCmy.Cyn > dizTblC02[strXax % DizSizCyn]) {
  1473. linBufCyn[tmpBuf] |= tmpByt;
  1474. }
  1475. }
  1476. if(tmpCmy.Mgt){
  1477. if (tmpCmy.Mgt > dizTblM02[strXax % DizSizMgt]) {
  1478. linBufMgt[tmpBuf] |= tmpByt;
  1479. }
  1480. }
  1481. if(tmpCmy.Yel){
  1482. if (tmpCmy.Yel > dizTblY02[strXax % DizSizYel]) {
  1483. linBufYel[tmpBuf] |= tmpByt;
  1484. }
  1485. }
  1486. if(tmpCmy.Bla){
  1487. if (tmpCmy.Bla > dizTblB02[strXax % DizSizBla]) {
  1488. linBufBla[tmpBuf] |= tmpByt;
  1489. }
  1490. }
  1491. strXax++;
  1492. }
  1493. return 1;
  1494. }
  1495. /*---- Stretch ----*/
  1496. linByt = (xaxOfs + xaxSiz) * xaxNrt / xaxDnt;
  1497. linByt -= xaxOfs * xaxNrt / xaxDnt;
  1498. linByt = (linByt + 7) / 8;
  1499. yaxSet = (yaxOfs + 1) * yaxNrt / yaxDnt;
  1500. yaxSet -= yaxOfs * yaxNrt / yaxDnt;
  1501. for(cntYax = 0 ; cntYax < yaxSet ; cntYax++){
  1502. dizTblC02 = DizTblC02 + strYax % DizSizCyn * 32;
  1503. dizTblM02 = DizTblM02 + strYax % DizSizMgt * 32;
  1504. dizTblY02 = DizTblY02 + strYax % DizSizYel * 32;
  1505. dizTblB02 = DizTblB02 + strYax % DizSizBla * 32;
  1506. tmpXax = 0;
  1507. for(cntHrz = 0 ; cntHrz < xaxSiz ; cntHrz++){
  1508. tmpCmy = cmyBuf[cntHrz];
  1509. xaxSet = (xaxOfs + cntHrz + 1) * xaxNrt / xaxDnt;
  1510. xaxSet -= (xaxOfs + cntHrz) * xaxNrt / xaxDnt;
  1511. for(cntXax = 0 ; cntXax < xaxSet ; cntXax ++){
  1512. tmpByt = (BYTE)0x80 >> (tmpXax % 8);
  1513. tmpBuf = tmpXax / 8;
  1514. if(tmpCmy.Cyn){
  1515. if (tmpCmy.Cyn > dizTblC02[(strXax + tmpXax) % DizSizCyn]) {
  1516. linBufCyn[tmpBuf] |= tmpByt;
  1517. }
  1518. }
  1519. if(tmpCmy.Mgt){
  1520. if (tmpCmy.Mgt > dizTblM02[(strXax + tmpXax) % DizSizMgt]) {
  1521. linBufMgt[tmpBuf] |= tmpByt;
  1522. }
  1523. }
  1524. if(tmpCmy.Yel){
  1525. if (tmpCmy.Yel > dizTblY02[(strXax + tmpXax) % DizSizYel]) {
  1526. linBufYel[tmpBuf] |= tmpByt;
  1527. }
  1528. }
  1529. if(tmpCmy.Bla){
  1530. if (tmpCmy.Bla > dizTblB02[(strXax + tmpXax) % DizSizBla]) {
  1531. linBufBla[tmpBuf] |= tmpByt;
  1532. }
  1533. }
  1534. tmpXax++;
  1535. }
  1536. }
  1537. linBufCyn += linByt;
  1538. linBufMgt += linByt;
  1539. linBufYel += linByt;
  1540. linBufBla += linByt;
  1541. strYax++;
  1542. }
  1543. return yaxSet;
  1544. }
  1545. //===================================================================================================
  1546. // Dithering(4value)
  1547. //===================================================================================================
  1548. DWORD WINAPI N403Diz004(
  1549. LPN403DIZINF lpDiz,
  1550. DWORD xaxSiz,
  1551. DWORD strXax,
  1552. DWORD strYax,
  1553. DWORD xaxOfs,
  1554. DWORD yaxOfs,
  1555. DWORD xaxNrt,
  1556. DWORD xaxDnt,
  1557. DWORD yaxNrt,
  1558. DWORD yaxDnt,
  1559. LPCMYK cmyBuf,
  1560. LPBYTE linBufCyn,
  1561. LPBYTE linBufMgt,
  1562. LPBYTE linBufYel,
  1563. LPBYTE linBufBla
  1564. )
  1565. {
  1566. DWORD cntHrz;
  1567. DWORD cntXax;
  1568. DWORD cntYax;
  1569. DWORD xaxSet;
  1570. DWORD yaxSet;
  1571. DWORD linByt;
  1572. DWORD tmpXax;
  1573. DWORD tmpBuf;
  1574. DWORD DizSizCyn;
  1575. DWORD DizSizMgt;
  1576. DWORD DizSizYel;
  1577. DWORD DizSizBla;
  1578. LPBYTE DizTblC04;
  1579. LPBYTE DizTblM04;
  1580. LPBYTE DizTblY04;
  1581. LPBYTE DizTblB04;
  1582. LPBYTE dizTblC04;
  1583. LPBYTE dizTblM04;
  1584. LPBYTE dizTblY04;
  1585. LPBYTE dizTblB04;
  1586. LPBYTE dizTbl;
  1587. CMYK tmpCmy;
  1588. BYTE tmp001;
  1589. BYTE tmp002;
  1590. BYTE tmp003;
  1591. DizTblC04 = lpDiz->Diz.Tbl[lpDiz->Diz.Num][0];
  1592. DizTblM04 = lpDiz->Diz.Tbl[lpDiz->Diz.Num][1];
  1593. DizTblY04 = lpDiz->Diz.Tbl[lpDiz->Diz.Num][2];
  1594. DizTblB04 = lpDiz->Diz.Tbl[lpDiz->Diz.Num][3];
  1595. DizSizCyn = lpDiz->DizSiz[0];
  1596. DizSizMgt = lpDiz->DizSiz[1];
  1597. DizSizYel = lpDiz->DizSiz[2];
  1598. DizSizBla = lpDiz->DizSiz[3];
  1599. // Check of zero divide 2002.3.23 >>>
  1600. if ((DizSizCyn == 0) || (DizSizMgt == 0)||
  1601. (DizSizYel == 0) || (DizSizBla == 0)) {
  1602. ERR(("N403Diz004() 0Div-Check [DizSizCyn,Mgt,Yel,Bla=0] \n"));
  1603. return 0;
  1604. }
  1605. if ((xaxDnt == 0) || (yaxDnt == 0)) {
  1606. ERR(("N403Diz004() 0Div-Check [xaxDnt,yaxDnt=0] \n"));
  1607. return 0;
  1608. }
  1609. // Check of zero divide 2002.3.23 <<<
  1610. if((xaxNrt == xaxDnt)&&(yaxNrt == yaxDnt)){
  1611. /*---- Not stretch ----*/
  1612. dizTblC04 = DizTblC04 + strYax % DizSizCyn * 16 * 3;
  1613. dizTblM04 = DizTblM04 + strYax % DizSizMgt * 16 * 3;
  1614. dizTblY04 = DizTblY04 + strYax % DizSizYel * 16 * 3;
  1615. dizTblB04 = DizTblB04 + strYax % DizSizBla * 16 * 3;
  1616. for(cntHrz = 0 ; cntHrz < xaxSiz ; cntHrz++){
  1617. tmp003 = (BYTE)0xc0 >> (cntHrz % 4) * 2;
  1618. tmp002 = (BYTE)0x80 >> (cntHrz % 4) * 2;
  1619. tmp001 = (BYTE)0x40 >> (cntHrz % 4) * 2;
  1620. tmpCmy = *cmyBuf; cmyBuf++;
  1621. tmpBuf = cntHrz / 4;
  1622. /*--- cyan ----*/
  1623. if(tmpCmy.Cyn){
  1624. dizTbl = dizTblC04 + strXax % DizSizCyn * 3;
  1625. if (tmpCmy.Cyn > dizTbl[0]) {
  1626. if (tmpCmy.Cyn > dizTbl[2]) {
  1627. linBufCyn[tmpBuf] |= tmp003;
  1628. } else if (tmpCmy.Cyn > dizTbl[1]) {
  1629. linBufCyn[tmpBuf] |= tmp002;
  1630. }else{
  1631. linBufCyn[tmpBuf] |= tmp001;
  1632. }
  1633. }
  1634. }
  1635. /*--- magenta ----*/
  1636. if(tmpCmy.Mgt){
  1637. dizTbl = dizTblM04 + strXax % DizSizMgt * 3;
  1638. if (tmpCmy.Mgt > dizTbl[0]) {
  1639. if (tmpCmy.Mgt > dizTbl[2]) {
  1640. linBufMgt[tmpBuf] |= tmp003;
  1641. } else if (tmpCmy.Mgt > dizTbl[1]) {
  1642. linBufMgt[tmpBuf] |= tmp002;
  1643. }else{
  1644. linBufMgt[tmpBuf] |= tmp001;
  1645. }
  1646. }
  1647. }
  1648. /*--- yellow ----*/
  1649. if(tmpCmy.Yel){
  1650. dizTbl = dizTblY04 + strXax % DizSizYel * 3;
  1651. if (tmpCmy.Yel > dizTbl[0]) {
  1652. if (tmpCmy.Yel > dizTbl[2]) {
  1653. linBufYel[tmpBuf] |= tmp003;
  1654. } else if (tmpCmy.Yel > dizTbl[1]) {
  1655. linBufYel[tmpBuf] |= tmp002;
  1656. }else{
  1657. linBufYel[tmpBuf] |= tmp001;
  1658. }
  1659. }
  1660. }
  1661. /*--- black ----*/
  1662. if(tmpCmy.Bla){
  1663. dizTbl = dizTblB04 + strXax % DizSizBla * 3;
  1664. if (tmpCmy.Bla > dizTbl[0]) {
  1665. if (tmpCmy.Bla > dizTbl[2]) {
  1666. linBufBla[tmpBuf] |= tmp003;
  1667. } else if (tmpCmy.Bla > dizTbl[1]) {
  1668. linBufBla[tmpBuf] |= tmp002;
  1669. }else{
  1670. linBufBla[tmpBuf] |= tmp001;
  1671. }
  1672. }
  1673. }
  1674. strXax++;
  1675. }
  1676. return 1;
  1677. }
  1678. /*---- Stretch ----*/
  1679. linByt = (xaxOfs + xaxSiz) * xaxNrt / xaxDnt;
  1680. linByt -= xaxOfs * xaxNrt / xaxDnt;
  1681. linByt = (linByt * 2 + 7) / 8;
  1682. yaxSet = (yaxOfs + 1) * yaxNrt / yaxDnt;
  1683. yaxSet -= yaxOfs * yaxNrt / yaxDnt;
  1684. for(cntYax = 0 ; cntYax < yaxSet ; cntYax++){
  1685. dizTblC04 = DizTblC04 + strYax % DizSizCyn * 16 * 3;
  1686. dizTblM04 = DizTblM04 + strYax % DizSizMgt * 16 * 3;
  1687. dizTblY04 = DizTblY04 + strYax % DizSizYel * 16 * 3;
  1688. dizTblB04 = DizTblB04 + strYax % DizSizBla * 16 * 3;
  1689. tmpXax = 0;
  1690. for(cntHrz = 0 ; cntHrz < xaxSiz ; cntHrz++){
  1691. tmpCmy = cmyBuf[cntHrz];
  1692. xaxSet = (xaxOfs + cntHrz + 1) * xaxNrt / xaxDnt;
  1693. xaxSet -= (xaxOfs + cntHrz) * xaxNrt / xaxDnt;
  1694. for(cntXax = 0 ; cntXax < xaxSet ; cntXax ++){
  1695. tmp003 = (BYTE)0xc0 >> (tmpXax % 4) * 2;
  1696. tmp002 = (BYTE)0x80 >> (tmpXax % 4) * 2;
  1697. tmp001 = (BYTE)0x40 >> (tmpXax % 4) * 2;
  1698. tmpBuf = tmpXax / 4;
  1699. /*--- cyan ----*/
  1700. if(tmpCmy.Cyn){
  1701. dizTbl = dizTblC04 + (strXax + tmpXax) % DizSizCyn * 3;
  1702. if (tmpCmy.Cyn > dizTbl[0]) {
  1703. if (tmpCmy.Cyn > dizTbl[2]) {
  1704. linBufCyn[tmpBuf] |= tmp003;
  1705. } else if (tmpCmy.Cyn > dizTbl[1]) {
  1706. linBufCyn[tmpBuf] |= tmp002;
  1707. }else{
  1708. linBufCyn[tmpBuf] |= tmp001;
  1709. }
  1710. }
  1711. }
  1712. /*--- magenta ----*/
  1713. if(tmpCmy.Mgt){
  1714. dizTbl = dizTblM04 + (strXax + tmpXax) % DizSizMgt * 3;
  1715. if (tmpCmy.Mgt > dizTbl[0]) {
  1716. if (tmpCmy.Mgt > dizTbl[2]) {
  1717. linBufMgt[tmpBuf] |= tmp003;
  1718. } else if (tmpCmy.Mgt > dizTbl[1]) {
  1719. linBufMgt[tmpBuf] |= tmp002;
  1720. }else{
  1721. linBufMgt[tmpBuf] |= tmp001;
  1722. }
  1723. }
  1724. }
  1725. /*--- yellow ----*/
  1726. if(tmpCmy.Yel){
  1727. dizTbl = dizTblY04 + (strXax + tmpXax) % DizSizYel * 3;
  1728. if (tmpCmy.Yel > dizTbl[0]) {
  1729. if (tmpCmy.Yel > dizTbl[2]) {
  1730. linBufYel[tmpBuf] |= tmp003;
  1731. } else if (tmpCmy.Yel > dizTbl[1]) {
  1732. linBufYel[tmpBuf] |= tmp002;
  1733. }else{
  1734. linBufYel[tmpBuf] |= tmp001;
  1735. }
  1736. }
  1737. }
  1738. /*--- balck ----*/
  1739. if(tmpCmy.Bla){
  1740. dizTbl = dizTblB04 + (strXax + tmpXax) % DizSizBla * 3;
  1741. if (tmpCmy.Bla > dizTbl[0]) {
  1742. if (tmpCmy.Bla > dizTbl[2]) {
  1743. linBufBla[tmpBuf] |= tmp003;
  1744. } else if (tmpCmy.Bla > dizTbl[1]) {
  1745. linBufBla[tmpBuf] |= tmp002;
  1746. }else{
  1747. linBufBla[tmpBuf] |= tmp001;
  1748. }
  1749. }
  1750. }
  1751. tmpXax++;
  1752. }
  1753. }
  1754. linBufCyn += linByt;
  1755. linBufMgt += linByt;
  1756. linBufYel += linByt;
  1757. linBufBla += linByt;
  1758. strYax++;
  1759. }
  1760. return yaxSet;
  1761. }
  1762. //===================================================================================================
  1763. // Dithering(16value)
  1764. //===================================================================================================
  1765. DWORD WINAPI N403Diz016(
  1766. LPN403DIZINF lpDiz,
  1767. DWORD xaxSiz,
  1768. DWORD strXax,
  1769. DWORD strYax,
  1770. DWORD xaxOfs,
  1771. DWORD yaxOfs,
  1772. DWORD xaxNrt,
  1773. DWORD xaxDnt,
  1774. DWORD yaxNrt,
  1775. DWORD yaxDnt,
  1776. LPCMYK cmyBuf,
  1777. LPBYTE linBufCyn,
  1778. LPBYTE linBufMgt,
  1779. LPBYTE linBufYel,
  1780. LPBYTE linBufBla
  1781. )
  1782. {
  1783. DWORD cntHrz;
  1784. DWORD cntXax;
  1785. DWORD cntYax;
  1786. DWORD xaxSet;
  1787. DWORD yaxSet;
  1788. DWORD linByt;
  1789. DWORD tmpXax;
  1790. DWORD tmpBuf;
  1791. DWORD min;
  1792. DWORD max;
  1793. DWORD mid;
  1794. DWORD DizSizCyn;
  1795. DWORD DizSizMgt;
  1796. DWORD DizSizYel;
  1797. DWORD DizSizBla;
  1798. LPBYTE DizTblC16;
  1799. LPBYTE DizTblM16;
  1800. LPBYTE DizTblY16;
  1801. LPBYTE DizTblB16;
  1802. LPBYTE dizTblC16;
  1803. LPBYTE dizTblM16;
  1804. LPBYTE dizTblY16;
  1805. LPBYTE dizTblB16;
  1806. LPBYTE dizTbl;
  1807. CMYK tmpCmy;
  1808. DizTblC16 = lpDiz->Diz.Tbl[lpDiz->Diz.Num][0];
  1809. DizTblM16 = lpDiz->Diz.Tbl[lpDiz->Diz.Num][1];
  1810. DizTblY16 = lpDiz->Diz.Tbl[lpDiz->Diz.Num][2];
  1811. DizTblB16 = lpDiz->Diz.Tbl[lpDiz->Diz.Num][3];
  1812. DizSizCyn = lpDiz->DizSiz[0];
  1813. DizSizMgt = lpDiz->DizSiz[1];
  1814. DizSizYel = lpDiz->DizSiz[2];
  1815. DizSizBla = lpDiz->DizSiz[3];
  1816. // Check of zero divide 2002.3.23 >>>
  1817. if ((DizSizCyn == 0) || (DizSizMgt == 0)||
  1818. (DizSizYel == 0) || (DizSizBla == 0)) {
  1819. ERR(("N403Diz016() 0Div-Check [DizSizCyn,Mgt,Yel,Bla=0] \n"));
  1820. return 0;
  1821. }
  1822. if ((xaxDnt == 0) || (yaxDnt == 0)) {
  1823. ERR(("N403Diz016() 0Div-Check [xaxDnt,yaxDnt=0] \n"));
  1824. return 0;
  1825. }
  1826. // Check of zero divide 2002.3.23 <<<
  1827. if((xaxNrt == xaxDnt)&&(yaxNrt == yaxDnt)){
  1828. /*---- Not stretch ----*/
  1829. dizTblC16 = DizTblC16 + strYax % DizSizCyn * 8 * 15;
  1830. dizTblM16 = DizTblM16 + strYax % DizSizMgt * 8 * 15;
  1831. dizTblY16 = DizTblY16 + strYax % DizSizYel * 8 * 15;
  1832. dizTblB16 = DizTblB16 + strYax % DizSizBla * 8 * 15;
  1833. for(cntHrz = 0 ; cntHrz < xaxSiz ; cntHrz++){
  1834. tmpCmy = *cmyBuf; cmyBuf++;
  1835. tmpBuf = cntHrz / 2;
  1836. /*--- cyan ----*/
  1837. if(tmpCmy.Cyn){
  1838. dizTbl = dizTblC16 + strXax % DizSizCyn * 15;
  1839. if (tmpCmy.Cyn > dizTbl[0]) {
  1840. min = 0; max = 14; mid = 7;
  1841. while(min < max){
  1842. if (tmpCmy.Cyn > dizTbl[mid]) {
  1843. min = mid;
  1844. }else{
  1845. max = mid - 1;
  1846. }
  1847. mid = (min + max + 1) / 2;
  1848. }
  1849. linBufCyn[tmpBuf] |= (mid+1) << ((cntHrz+1)%2)*4;
  1850. }
  1851. }
  1852. /*--- magenta ----*/
  1853. if(tmpCmy.Mgt){
  1854. dizTbl = dizTblM16 + strXax % DizSizMgt * 15;
  1855. if (tmpCmy.Mgt > dizTbl[0]) {
  1856. min = 0; max = 14; mid = 7;
  1857. while(min < max){
  1858. if (tmpCmy.Mgt > dizTbl[mid]) {
  1859. min = mid;
  1860. }else{
  1861. max = mid - 1;
  1862. }
  1863. mid = (min + max + 1) / 2;
  1864. }
  1865. linBufMgt[tmpBuf] |= (mid+1) << ((cntHrz+1)%2)*4;
  1866. }
  1867. }
  1868. /*--- yellow ----*/
  1869. if(tmpCmy.Yel){
  1870. dizTbl = dizTblY16 + strXax % DizSizYel * 15;
  1871. if (tmpCmy.Yel > dizTbl[0]) {
  1872. min = 0; max = 14; mid = 7;
  1873. while(min < max){
  1874. if (tmpCmy.Yel > dizTbl[mid]) {
  1875. min = mid;
  1876. }else{
  1877. max = mid - 1;
  1878. }
  1879. mid = (min + max + 1) / 2;
  1880. }
  1881. linBufYel[tmpBuf] |= (mid+1) << ((cntHrz+1)%2)*4;
  1882. }
  1883. }
  1884. /*--- balck ----*/
  1885. if(tmpCmy.Bla){
  1886. dizTbl = dizTblB16 + strXax % DizSizBla * 15;
  1887. if (tmpCmy.Bla > dizTbl[0]) {
  1888. min = 0; max = 14; mid = 7;
  1889. while(min < max){
  1890. if (tmpCmy.Bla > dizTbl[mid]) {
  1891. min = mid;
  1892. }else{
  1893. max = mid - 1;
  1894. }
  1895. mid = (min + max + 1) / 2;
  1896. }
  1897. linBufBla[tmpBuf] |= (mid+1) << ((cntHrz+1)%2)*4;
  1898. }
  1899. }
  1900. strXax++;
  1901. }
  1902. return 1;
  1903. }
  1904. /*---- Stretch ----*/
  1905. linByt = (xaxOfs + xaxSiz) * xaxNrt / xaxDnt;
  1906. linByt -= xaxOfs * xaxNrt / xaxDnt;
  1907. linByt = (linByt * 4 + 7) / 8;
  1908. yaxSet = (yaxOfs + 1) * yaxNrt / yaxDnt;
  1909. yaxSet -= yaxOfs * yaxNrt / yaxDnt;
  1910. for(cntYax = 0 ; cntYax < yaxSet ; cntYax++){
  1911. dizTblC16 = DizTblC16 + strYax % DizSizCyn * 8 * 15;
  1912. dizTblM16 = DizTblM16 + strYax % DizSizMgt * 8 * 15;
  1913. dizTblY16 = DizTblY16 + strYax % DizSizYel * 8 * 15;
  1914. dizTblB16 = DizTblB16 + strYax % DizSizBla * 8 * 15;
  1915. tmpXax = 0;
  1916. for(cntHrz = 0 ; cntHrz < xaxSiz ; cntHrz++){
  1917. tmpCmy = cmyBuf[cntHrz];
  1918. xaxSet = (xaxOfs + cntHrz + 1) * xaxNrt / xaxDnt;
  1919. xaxSet -= (xaxOfs + cntHrz) * xaxNrt / xaxDnt;
  1920. for(cntXax = 0 ; cntXax < xaxSet ; cntXax ++){
  1921. tmpBuf = tmpXax / 2;
  1922. /*--- cyan ----*/
  1923. if(tmpCmy.Cyn){
  1924. dizTbl = dizTblC16 + (strXax + tmpXax) % DizSizCyn * 15;
  1925. if (tmpCmy.Cyn > dizTbl[0]) {
  1926. min = 0; max = 14; mid = 7;
  1927. while(min < max){
  1928. if (tmpCmy.Cyn > dizTbl[mid]) {
  1929. min = mid;
  1930. }else{
  1931. max = mid - 1;
  1932. }
  1933. mid = (min + max + 1) / 2;
  1934. }
  1935. linBufCyn[tmpBuf] |= (mid+1) << ((tmpXax+1)%2)*4;
  1936. }
  1937. }
  1938. /*--- magenta ----*/
  1939. if(tmpCmy.Mgt){
  1940. dizTbl = dizTblM16 + (strXax + tmpXax) % DizSizMgt * 15;
  1941. if (tmpCmy.Mgt > dizTbl[0]) {
  1942. min = 0; max = 14; mid = 7;
  1943. while(min < max){
  1944. if (tmpCmy.Mgt > dizTbl[mid]) {
  1945. min = mid;
  1946. }else{
  1947. max = mid - 1;
  1948. }
  1949. mid = (min + max + 1) / 2;
  1950. }
  1951. linBufMgt[tmpBuf] |= (mid+1) << ((tmpXax+1)%2)*4;
  1952. }
  1953. }
  1954. /*--- yellow ----*/
  1955. if(tmpCmy.Yel){
  1956. dizTbl = dizTblY16 + (strXax + tmpXax) % DizSizYel * 15;
  1957. if (tmpCmy.Yel > dizTbl[0]) {
  1958. min = 0; max = 14; mid = 7;
  1959. while(min < max){
  1960. if (tmpCmy.Yel > dizTbl[mid]) {
  1961. min = mid;
  1962. }else{
  1963. max = mid - 1;
  1964. }
  1965. mid = (min + max + 1) / 2;
  1966. }
  1967. linBufYel[tmpBuf] |= (mid+1) << ((tmpXax+1)%2)*4;
  1968. }
  1969. }
  1970. /*--- black ----*/
  1971. if(tmpCmy.Bla){
  1972. dizTbl = dizTblB16 + (strXax + tmpXax) % DizSizBla * 15;
  1973. if (tmpCmy.Bla > dizTbl[0]) {
  1974. min = 0; max = 14; mid = 7;
  1975. while(min < max){
  1976. if (tmpCmy.Bla > dizTbl[mid]) {
  1977. min = mid;
  1978. }else{
  1979. max = mid - 1;
  1980. }
  1981. mid = (min + max + 1) / 2;
  1982. }
  1983. linBufBla[tmpBuf] |= (mid+1) << ((tmpXax+1)%2)*4;
  1984. }
  1985. }
  1986. tmpXax++;
  1987. }
  1988. }
  1989. linBufCyn += linByt;
  1990. linBufMgt += linByt;
  1991. linBufYel += linByt;
  1992. linBufBla += linByt;
  1993. strYax++;
  1994. }
  1995. return yaxSet;
  1996. }
  1997. //===================================================================================================
  1998. // Dithering(600DPI 4value DETAIL)
  1999. //===================================================================================================
  2000. DWORD WINAPI N403DizSml(
  2001. LPN403DIZINF lpDiz,
  2002. DWORD xaxSiz,
  2003. DWORD strXax,
  2004. DWORD strYax,
  2005. DWORD xaxOfs,
  2006. DWORD yaxOfs,
  2007. DWORD xaxNrt,
  2008. DWORD xaxDnt,
  2009. DWORD yaxNrt,
  2010. DWORD yaxDnt,
  2011. LPCMYK cmyBuf,
  2012. LPBYTE linBufCyn,
  2013. LPBYTE linBufMgt,
  2014. LPBYTE linBufYel,
  2015. LPBYTE linBufBla
  2016. )
  2017. {
  2018. DWORD cntHrz;
  2019. DWORD cntXax;
  2020. DWORD cntYax;
  2021. DWORD xaxSet;
  2022. DWORD yaxSet;
  2023. DWORD linByt;
  2024. DWORD tmpXax;
  2025. DWORD tmpBuf;
  2026. DWORD tblNum;
  2027. LPBYTE DizTblSml;
  2028. LPBYTE dizTblSml;
  2029. CMYK tmpCmy;
  2030. BYTE lvl001;
  2031. BYTE lvl002;
  2032. BYTE lvl003;
  2033. BYTE tmp001;
  2034. BYTE tmp002;
  2035. BYTE tmp003;
  2036. DizTblSml = lpDiz->Diz.Tbl[lpDiz->Diz.Num][0];
  2037. // Check of zero divide 2002.3.23 >>>
  2038. if ((xaxDnt == 0) || (yaxDnt == 0)) {
  2039. ERR(("N403DizSml() 0Div-Check [xaxDnt,yaxDnt=0] \n"));
  2040. return 0;
  2041. }
  2042. // Check of zero divide 2002.3.23 <<<
  2043. if((xaxNrt == xaxDnt)&&(yaxNrt == yaxDnt)){
  2044. /*---- Not stretch ----*/
  2045. dizTblSml = DizTblSml + strYax % 16 * 16 * 3;
  2046. for(cntHrz = 0 ; cntHrz < xaxSiz ; cntHrz++){
  2047. tblNum = strXax % 16 * 3;
  2048. lvl001 = dizTblSml[tblNum + 0];
  2049. lvl002 = dizTblSml[tblNum + 1];
  2050. lvl003 = dizTblSml[tblNum + 2];
  2051. tmp003 = (BYTE)0xc0 >> (cntHrz % 4) * 2;
  2052. tmp002 = (BYTE)0x80 >> (cntHrz % 4) * 2;
  2053. tmp001 = (BYTE)0x40 >> (cntHrz % 4) * 2;
  2054. tmpCmy = *cmyBuf; cmyBuf++;
  2055. tmpBuf = cntHrz / 4;
  2056. /*--- cyan ----*/
  2057. if(tmpCmy.Cyn > lvl001){
  2058. if(tmpCmy.Cyn > lvl003){
  2059. linBufCyn[tmpBuf] |= tmp003;
  2060. }else if(tmpCmy.Cyn > lvl002){
  2061. linBufCyn[tmpBuf] |= tmp002;
  2062. }else{
  2063. linBufCyn[tmpBuf] |= tmp001;
  2064. }
  2065. }
  2066. /*--- magenta ----*/
  2067. if(tmpCmy.Mgt > lvl001){
  2068. if(tmpCmy.Mgt > lvl003){
  2069. linBufMgt[tmpBuf] |= tmp003;
  2070. }else if(tmpCmy.Mgt > lvl002){
  2071. linBufMgt[tmpBuf] |= tmp002;
  2072. }else{
  2073. linBufMgt[tmpBuf] |= tmp001;
  2074. }
  2075. }
  2076. /*--- yellow ----*/
  2077. if(tmpCmy.Yel > lvl001){
  2078. if(tmpCmy.Yel > lvl003){
  2079. linBufYel[tmpBuf] |= tmp003;
  2080. }else if(tmpCmy.Yel > lvl002){
  2081. linBufYel[tmpBuf] |= tmp002;
  2082. }else{
  2083. linBufYel[tmpBuf] |= tmp001;
  2084. }
  2085. }
  2086. /*--- black ----*/
  2087. if(tmpCmy.Bla > lvl001){
  2088. if(tmpCmy.Bla > lvl003){
  2089. linBufBla[tmpBuf] |= tmp003;
  2090. }else if(tmpCmy.Bla > lvl002){
  2091. linBufBla[tmpBuf] |= tmp002;
  2092. }else{
  2093. linBufBla[tmpBuf] |= tmp001;
  2094. }
  2095. }
  2096. strXax++;
  2097. }
  2098. return 1;
  2099. }
  2100. /*---- Stretch ----*/
  2101. linByt = (xaxOfs + xaxSiz) * xaxNrt / xaxDnt;
  2102. linByt -= xaxOfs * xaxNrt / xaxDnt;
  2103. linByt = (linByt * 2 + 7) / 8;
  2104. yaxSet = (yaxOfs + 1) * yaxNrt / yaxDnt;
  2105. yaxSet -= yaxOfs * yaxNrt / yaxDnt;
  2106. for(cntYax = 0 ; cntYax < yaxSet ; cntYax++){
  2107. dizTblSml = DizTblSml + strYax % 16 * 16 * 3;
  2108. tmpXax = 0;
  2109. for(cntHrz = 0 ; cntHrz < xaxSiz ; cntHrz++){
  2110. tmpCmy = cmyBuf[cntHrz];
  2111. xaxSet = (xaxOfs + cntHrz + 1) * xaxNrt / xaxDnt;
  2112. xaxSet -= (xaxOfs + cntHrz) * xaxNrt / xaxDnt;
  2113. for(cntXax = 0 ; cntXax < xaxSet ; cntXax ++){
  2114. tblNum = tmpXax % 16 * 3;
  2115. lvl001 = dizTblSml[tblNum + 0];
  2116. lvl002 = dizTblSml[tblNum + 1];
  2117. lvl003 = dizTblSml[tblNum + 2];
  2118. tmp003 = (BYTE)0xc0 >> (tmpXax % 4) * 2;
  2119. tmp002 = (BYTE)0x80 >> (tmpXax % 4) * 2;
  2120. tmp001 = (BYTE)0x40 >> (tmpXax % 4) * 2;
  2121. tmpBuf = tmpXax / 4;
  2122. /*--- cyan ----*/
  2123. if(tmpCmy.Cyn > lvl001){
  2124. if(tmpCmy.Cyn > lvl003){
  2125. linBufCyn[tmpBuf] |= tmp003;
  2126. }else if(tmpCmy.Cyn > lvl002){
  2127. linBufCyn[tmpBuf] |= tmp002;
  2128. }else{
  2129. linBufCyn[tmpBuf] |= tmp001;
  2130. }
  2131. }
  2132. /*--- magenta ----*/
  2133. if(tmpCmy.Mgt > lvl001){
  2134. if(tmpCmy.Mgt > lvl003){
  2135. linBufMgt[tmpBuf] |= tmp003;
  2136. }else if(tmpCmy.Mgt > lvl002){
  2137. linBufMgt[tmpBuf] |= tmp002;
  2138. }else{
  2139. linBufMgt[tmpBuf] |= tmp001;
  2140. }
  2141. }
  2142. /*--- yellow ----*/
  2143. if(tmpCmy.Yel > lvl001){
  2144. if(tmpCmy.Yel > lvl003){
  2145. linBufYel[tmpBuf] |= tmp003;
  2146. }else if(tmpCmy.Yel > lvl002){
  2147. linBufYel[tmpBuf] |= tmp002;
  2148. }else{
  2149. linBufYel[tmpBuf] |= tmp001;
  2150. }
  2151. }
  2152. /*--- black ----*/
  2153. if(tmpCmy.Bla > lvl001){
  2154. if(tmpCmy.Bla > lvl003){
  2155. linBufBla[tmpBuf] |= tmp003;
  2156. }else if(tmpCmy.Bla > lvl002){
  2157. linBufBla[tmpBuf] |= tmp002;
  2158. }else{
  2159. linBufBla[tmpBuf] |= tmp001;
  2160. }
  2161. }
  2162. tmpXax++;
  2163. }
  2164. }
  2165. linBufCyn += linByt;
  2166. linBufMgt += linByt;
  2167. linBufYel += linByt;
  2168. linBufBla += linByt;
  2169. strYax++;
  2170. }
  2171. return yaxSet;
  2172. }
  2173. //===================================================================================================
  2174. // Dithering(600DPI 4value NORMAL)
  2175. //===================================================================================================
  2176. DWORD WINAPI N403DizPrn(
  2177. LPN403DIZINF lpDiz,
  2178. DWORD xaxSiz,
  2179. DWORD strXax,
  2180. DWORD strYax,
  2181. DWORD xaxOfs,
  2182. DWORD yaxOfs,
  2183. DWORD xaxNrt,
  2184. DWORD xaxDnt,
  2185. DWORD yaxNrt,
  2186. DWORD yaxDnt,
  2187. LPCMYK cmyBuf,
  2188. LPBYTE linBufCyn,
  2189. LPBYTE linBufMgt,
  2190. LPBYTE linBufYel,
  2191. LPBYTE linBufBla
  2192. )
  2193. {
  2194. DWORD cntHrz;
  2195. DWORD cntXax;
  2196. DWORD cntYax;
  2197. DWORD xaxSet;
  2198. DWORD yaxSet;
  2199. DWORD linByt;
  2200. DWORD tmpXax;
  2201. DWORD tmpBuf;
  2202. LPBYTE DizTblPc4;
  2203. LPBYTE DizTblPm4;
  2204. LPBYTE DizTblPy4;
  2205. LPBYTE DizTblPb4;
  2206. LPBYTE dizTblPc4;
  2207. LPBYTE dizTblPm4;
  2208. LPBYTE dizTblPy4;
  2209. LPBYTE dizTblPb4;
  2210. LPBYTE dizTbl;
  2211. CMYK tmpCmy;
  2212. BYTE tmp001;
  2213. BYTE tmp002;
  2214. BYTE tmp003;
  2215. DizTblPc4 = lpDiz->EntDiz.Tbl[0];
  2216. DizTblPm4 = lpDiz->EntDiz.Tbl[1];
  2217. DizTblPy4 = lpDiz->EntDiz.Tbl[2];
  2218. DizTblPb4 = lpDiz->EntDiz.Tbl[3];
  2219. // Check of zero divide 2002.3.23 >>>
  2220. if ((xaxDnt == 0) || (yaxDnt == 0)) {
  2221. ERR(("N403DizPrn() 0Div-Check [xaxDnt,yaxDnt=0] \n"));
  2222. return 0;
  2223. }
  2224. // Check of zero divide 2002.3.23 <<<
  2225. if((xaxNrt == xaxDnt)&&(yaxNrt == yaxDnt)){
  2226. dizTblPc4 = DizTblPc4 + strYax % 16 * 16 * 3;
  2227. dizTblPm4 = DizTblPm4 + strYax % 16 * 16 * 3;
  2228. dizTblPy4 = DizTblPy4 + strYax % 16 * 16 * 3;
  2229. dizTblPb4 = DizTblPb4 + strYax % 16 * 16 * 3;
  2230. /*---- Stretch ----*/
  2231. for(cntHrz = 0 ; cntHrz < xaxSiz ; cntHrz++){
  2232. tmp003 = (BYTE)0xc0 >> (cntHrz % 4) * 2;
  2233. tmp002 = (BYTE)0x80 >> (cntHrz % 4) * 2;
  2234. tmp001 = (BYTE)0x40 >> (cntHrz % 4) * 2;
  2235. tmpCmy = *cmyBuf; cmyBuf++;
  2236. tmpBuf = cntHrz / 4;
  2237. /*--- cyan ----*/
  2238. dizTbl = dizTblPc4 + strXax % 16 * 3;
  2239. if(tmpCmy.Cyn > dizTbl[0]){
  2240. if(tmpCmy.Cyn > dizTbl[2]){
  2241. linBufCyn[tmpBuf] |= tmp003;
  2242. }else if(tmpCmy.Cyn > dizTbl[1]){
  2243. linBufCyn[tmpBuf] |= tmp002;
  2244. }else{
  2245. linBufCyn[tmpBuf] |= tmp001;
  2246. }
  2247. }
  2248. /*--- magenta ----*/
  2249. dizTbl = dizTblPm4 + strXax % 16 * 3;
  2250. if(tmpCmy.Mgt > dizTbl[0]){
  2251. if(tmpCmy.Mgt > dizTbl[2]){
  2252. linBufMgt[tmpBuf] |= tmp003;
  2253. }else if(tmpCmy.Mgt > dizTbl[1]){
  2254. linBufMgt[tmpBuf] |= tmp002;
  2255. }else{
  2256. linBufMgt[tmpBuf] |= tmp001;
  2257. }
  2258. }
  2259. /*--- yellow ----*/
  2260. dizTbl = dizTblPy4 + strXax % 16 * 3;
  2261. if(tmpCmy.Yel > dizTbl[0]){
  2262. if(tmpCmy.Yel > dizTbl[2]){
  2263. linBufYel[tmpBuf] |= tmp003;
  2264. }else if(tmpCmy.Yel > dizTbl[1]){
  2265. linBufYel[tmpBuf] |= tmp002;
  2266. }else{
  2267. linBufYel[tmpBuf] |= tmp001;
  2268. }
  2269. }
  2270. /*--- black ----*/
  2271. dizTbl = dizTblPb4 + strXax % 16 * 3;
  2272. if(tmpCmy.Bla > dizTbl[0]){
  2273. if(tmpCmy.Bla > dizTbl[2]){
  2274. linBufBla[tmpBuf] |= tmp003;
  2275. }else if(tmpCmy.Bla > dizTbl[1]){
  2276. linBufBla[tmpBuf] |= tmp002;
  2277. }else{
  2278. linBufBla[tmpBuf] |= tmp001;
  2279. }
  2280. }
  2281. strXax++;
  2282. }
  2283. return 1;
  2284. }
  2285. /*---- Stretch ----*/
  2286. linByt = (xaxOfs + xaxSiz) * xaxNrt / xaxDnt;
  2287. linByt -= xaxOfs * xaxNrt / xaxDnt;
  2288. linByt = (linByt * 2 + 7) / 8;
  2289. yaxSet = (yaxOfs + 1) * yaxNrt / yaxDnt;
  2290. yaxSet -= yaxOfs * yaxNrt / yaxDnt;
  2291. for(cntYax = 0 ; cntYax < yaxSet ; cntYax++){
  2292. dizTblPc4 = DizTblPc4 + strYax % 16 * 16 * 3;
  2293. dizTblPm4 = DizTblPm4 + strYax % 16 * 16 * 3;
  2294. dizTblPy4 = DizTblPy4 + strYax % 16 * 16 * 3;
  2295. dizTblPb4 = DizTblPb4 + strYax % 16 * 16 * 3;
  2296. tmpXax = 0;
  2297. for(cntHrz = 0 ; cntHrz < xaxSiz ; cntHrz++){
  2298. tmpCmy = cmyBuf[cntHrz];
  2299. xaxSet = (xaxOfs + cntHrz + 1) * xaxNrt / xaxDnt;
  2300. xaxSet -= (xaxOfs + cntHrz) * xaxNrt / xaxDnt;
  2301. for(cntXax = 0 ; cntXax < xaxSet ; cntXax ++){
  2302. tmp003 = (BYTE)0xc0 >> (tmpXax % 4) * 2;
  2303. tmp002 = (BYTE)0x80 >> (tmpXax % 4) * 2;
  2304. tmp001 = (BYTE)0x40 >> (tmpXax % 4) * 2;
  2305. tmpBuf = tmpXax / 4;
  2306. /*--- cyan ----*/
  2307. dizTbl = dizTblPc4 + (strXax + tmpXax) % 16 * 3;
  2308. if(tmpCmy.Cyn > dizTbl[0]){
  2309. if(tmpCmy.Cyn > dizTbl[2]){
  2310. linBufCyn[tmpBuf] |= tmp003;
  2311. }else if(tmpCmy.Cyn > dizTbl[1]){
  2312. linBufCyn[tmpBuf] |= tmp002;
  2313. }else{
  2314. linBufCyn[tmpBuf] |= tmp001;
  2315. }
  2316. }
  2317. /*--- magenta ----*/
  2318. dizTbl = dizTblPm4 + (strXax + tmpXax) % 16 * 3;
  2319. if(tmpCmy.Mgt > dizTbl[0]){
  2320. if(tmpCmy.Mgt > dizTbl[2]){
  2321. linBufMgt[tmpBuf] |= tmp003;
  2322. }else if(tmpCmy.Mgt > dizTbl[1]){
  2323. linBufMgt[tmpBuf] |= tmp002;
  2324. }else{
  2325. linBufMgt[tmpBuf] |= tmp001;
  2326. }
  2327. }
  2328. /*--- yellow ----*/
  2329. dizTbl = dizTblPy4 + (strXax + tmpXax) % 16 * 3;
  2330. if(tmpCmy.Yel > dizTbl[0]){
  2331. if(tmpCmy.Yel > dizTbl[2]){
  2332. linBufYel[tmpBuf] |= tmp003;
  2333. }else if(tmpCmy.Yel > dizTbl[1]){
  2334. linBufYel[tmpBuf] |= tmp002;
  2335. }else{
  2336. linBufYel[tmpBuf] |= tmp001;
  2337. }
  2338. }
  2339. /*--- black ----*/
  2340. dizTbl = dizTblPb4 + (strXax + tmpXax) % 16 * 3;
  2341. if(tmpCmy.Bla > dizTbl[0]){
  2342. if(tmpCmy.Bla > dizTbl[2]){
  2343. linBufBla[tmpBuf] |= tmp003;
  2344. }else if(tmpCmy.Bla > dizTbl[1]){
  2345. linBufBla[tmpBuf] |= tmp002;
  2346. }else{
  2347. linBufBla[tmpBuf] |= tmp001;
  2348. }
  2349. }
  2350. tmpXax++;
  2351. }
  2352. }
  2353. linBufCyn += linByt;
  2354. linBufMgt += linByt;
  2355. linBufYel += linByt;
  2356. linBufBla += linByt;
  2357. strYax++;
  2358. }
  2359. return yaxSet;
  2360. }
  2361. //===================================================================================================
  2362. // Color matching(high speed)
  2363. //===================================================================================================
  2364. VOID WINAPI N403ColMch000(
  2365. LPN403DIZINF lpDiz,
  2366. LPRGB rgbAdr,
  2367. LPCMYK cmyAdr,
  2368. DWORD xaxSiz,
  2369. DWORD blaCnv
  2370. )
  2371. {
  2372. LPRGB endAdr;
  2373. LPCMYK LokUppRgbCmy;
  2374. LPBYTE innTblCmy;
  2375. LONG tmpRed;
  2376. LONG tmpGrn;
  2377. LONG tmpBlu;
  2378. LONG tmpCal;
  2379. CMYK tmpCmy;
  2380. LokUppRgbCmy = lpDiz->Lut.Tbl;
  2381. innTblCmy = lpDiz->Tnr.Tbl;
  2382. for(endAdr = rgbAdr+xaxSiz ; rgbAdr < endAdr ; rgbAdr++){
  2383. tmpRed = rgbAdr->Red;
  2384. tmpGrn = rgbAdr->Green;
  2385. tmpBlu = rgbAdr->Blue;
  2386. if((blaCnv == 0)&&((tmpRed | tmpGrn | tmpBlu) == 0)){
  2387. tmpCmy.Cyn = 0;
  2388. tmpCmy.Mgt = 0;
  2389. tmpCmy.Yel = 0;
  2390. tmpCmy.Bla = 255;
  2391. *cmyAdr = tmpCmy;
  2392. cmyAdr++;
  2393. continue;
  2394. }
  2395. tmpCal = tmpRed / N403_GLDSPC * N403_GLDNUM * N403_GLDNUM;
  2396. tmpCal += tmpGrn / N403_GLDSPC * N403_GLDNUM;
  2397. tmpCal += tmpBlu / N403_GLDSPC;
  2398. tmpCmy = LokUppRgbCmy[tmpCal];
  2399. tmpCmy.Cyn = innTblCmy[tmpCmy.Cyn];
  2400. tmpCmy.Mgt = innTblCmy[tmpCmy.Mgt];
  2401. tmpCmy.Yel = innTblCmy[tmpCmy.Yel];
  2402. tmpCmy.Bla = innTblCmy[tmpCmy.Bla];
  2403. *cmyAdr = tmpCmy;
  2404. cmyAdr++;
  2405. }
  2406. }
  2407. //===================================================================================================
  2408. // Color matching(normal speed)
  2409. //===================================================================================================
  2410. VOID WINAPI N403ColMch001(
  2411. LPN403DIZINF lpDiz,
  2412. LPRGB rgbAdr,
  2413. LPCMYK cmyAdr,
  2414. DWORD xaxSiz,
  2415. DWORD blaCnv
  2416. )
  2417. {
  2418. LONG tmpRed;
  2419. LONG tmpGrn;
  2420. LONG tmpBlu;
  2421. LONG tmpR01;
  2422. LONG tmpR02;
  2423. LONG tmpG01;
  2424. LONG tmpG02;
  2425. LONG tmpB01;
  2426. LONG tmpB02;
  2427. LONG ln1;
  2428. LONG ln2;
  2429. LONG ln3;
  2430. LONG tmpC00;
  2431. LONG tmpM00;
  2432. LONG tmpY00;
  2433. LONG tmpK00;
  2434. LONG tmpC01;
  2435. LONG tmpM01;
  2436. LONG tmpY01;
  2437. LONG tmpK01;
  2438. LONG tmpC02;
  2439. LONG tmpM02;
  2440. LONG tmpY02;
  2441. LONG tmpK02;
  2442. LONG tmpC03;
  2443. LONG tmpM03;
  2444. LONG tmpY03;
  2445. LONG tmpK03;
  2446. LPCMYK LokUppRgbCmy;
  2447. LPBYTE innTblCmy;
  2448. LPRGB CchRgb;
  2449. LPCMYK CchCmy;
  2450. LPRGB endAdr;
  2451. DWORD cch;
  2452. RGBS tmpRgb;
  2453. CMYK tmpCmy;
  2454. LokUppRgbCmy = lpDiz->Lut.Tbl;
  2455. innTblCmy = lpDiz->Tnr.Tbl;
  2456. CchRgb = lpDiz->Lut.CchRgb;
  2457. CchCmy = lpDiz->Lut.CchCmy;
  2458. for(endAdr = rgbAdr+xaxSiz ; rgbAdr < endAdr ; rgbAdr++){
  2459. tmpRgb = *rgbAdr;
  2460. tmpRed = tmpRgb.Red;
  2461. tmpGrn = tmpRgb.Green;
  2462. tmpBlu = tmpRgb.Blue;
  2463. if((blaCnv == 0)&&((tmpRed | tmpGrn | tmpBlu) == 0)){
  2464. tmpCmy.Cyn = 0;
  2465. tmpCmy.Mgt = 0;
  2466. tmpCmy.Yel = 0;
  2467. tmpCmy.Bla = 255;
  2468. *cmyAdr = tmpCmy;
  2469. cmyAdr++;
  2470. continue;
  2471. }
  2472. /*---- Cache color matching ----*/
  2473. cch = ( tmpRed * 49 + tmpGrn * 9 + tmpBlu ) % N403_CCHNUM;
  2474. if( (CchRgb[cch].Red == tmpRgb.Red) &&
  2475. (CchRgb[cch].Green == tmpRgb.Green) &&
  2476. (CchRgb[cch].Blue == tmpRgb.Blue)
  2477. ){
  2478. *cmyAdr = CchCmy[cch];
  2479. cmyAdr++;
  2480. continue;
  2481. }
  2482. /*---- RGB -> CMYK ----*/
  2483. tmpR01 = tmpRed * 31 / 255;
  2484. tmpR02 = (tmpRed * 31 + 254) / 255;
  2485. tmpG01 = tmpGrn * 31 / 255;
  2486. tmpG02 = (tmpGrn * 31 + 254) / 255;
  2487. tmpB01 = tmpBlu * 31 / 255;
  2488. tmpB02 = (tmpBlu * 31 + 254) / 255;
  2489. ln2 = tmpRed - tmpR01*255/31;
  2490. if(ln2 == 0){
  2491. tmpCmy = LokUppRgbCmy[tmpR01 * N403_GLDNUM * N403_GLDNUM + tmpG01 * N403_GLDNUM + tmpB01];
  2492. tmpC00 = tmpCmy.Cyn;
  2493. tmpM00 = tmpCmy.Mgt;
  2494. tmpY00 = tmpCmy.Yel;
  2495. tmpK00 = tmpCmy.Bla;
  2496. tmpCmy = LokUppRgbCmy[tmpR01 * N403_GLDNUM * N403_GLDNUM + tmpG01 * N403_GLDNUM + tmpB02];
  2497. tmpC01 = tmpCmy.Cyn;
  2498. tmpM01 = tmpCmy.Mgt;
  2499. tmpY01 = tmpCmy.Yel;
  2500. tmpK01 = tmpCmy.Bla;
  2501. tmpCmy = LokUppRgbCmy[tmpR01 * N403_GLDNUM * N403_GLDNUM + tmpG02 * N403_GLDNUM + tmpB01];
  2502. tmpC02 = tmpCmy.Cyn;
  2503. tmpM02 = tmpCmy.Mgt;
  2504. tmpY02 = tmpCmy.Yel;
  2505. tmpK02 = tmpCmy.Bla;
  2506. tmpCmy = LokUppRgbCmy[tmpR01 * N403_GLDNUM * N403_GLDNUM + tmpG02 * N403_GLDNUM + tmpB02];
  2507. tmpC03 = tmpCmy.Cyn;
  2508. tmpM03 = tmpCmy.Mgt;
  2509. tmpY03 = tmpCmy.Yel;
  2510. tmpK03 = tmpCmy.Bla;
  2511. }else{
  2512. ln1 = tmpR02*255/31 - tmpRed;
  2513. if(ln1 == 0){
  2514. tmpCmy = LokUppRgbCmy[tmpR02 * N403_GLDNUM * N403_GLDNUM + tmpG01 * N403_GLDNUM + tmpB01];
  2515. tmpC00 = tmpCmy.Cyn;
  2516. tmpM00 = tmpCmy.Mgt;
  2517. tmpY00 = tmpCmy.Yel;
  2518. tmpK00 = tmpCmy.Bla;
  2519. tmpCmy = LokUppRgbCmy[tmpR02 * N403_GLDNUM * N403_GLDNUM + tmpG01 * N403_GLDNUM + tmpB02];
  2520. tmpC01 = tmpCmy.Cyn;
  2521. tmpM01 = tmpCmy.Mgt;
  2522. tmpY01 = tmpCmy.Yel;
  2523. tmpK01 = tmpCmy.Bla;
  2524. tmpCmy = LokUppRgbCmy[tmpR02 * N403_GLDNUM * N403_GLDNUM + tmpG02 * N403_GLDNUM + tmpB01];
  2525. tmpC02 = tmpCmy.Cyn;
  2526. tmpM02 = tmpCmy.Mgt;
  2527. tmpY02 = tmpCmy.Yel;
  2528. tmpK02 = tmpCmy.Bla;
  2529. tmpCmy = LokUppRgbCmy[tmpR02 * N403_GLDNUM * N403_GLDNUM + tmpG02 * N403_GLDNUM + tmpB02];
  2530. tmpC03 = tmpCmy.Cyn;
  2531. tmpM03 = tmpCmy.Mgt;
  2532. tmpY03 = tmpCmy.Yel;
  2533. tmpK03 = tmpCmy.Bla;
  2534. }else{
  2535. ln3 = ln1 + ln2;
  2536. tmpCmy = LokUppRgbCmy[tmpR01 * N403_GLDNUM * N403_GLDNUM + tmpG01 * N403_GLDNUM + tmpB01];
  2537. tmpC00 = ln1 * tmpCmy.Cyn;
  2538. tmpM00 = ln1 * tmpCmy.Mgt;
  2539. tmpY00 = ln1 * tmpCmy.Yel;
  2540. tmpK00 = ln1 * tmpCmy.Bla;
  2541. tmpCmy = LokUppRgbCmy[tmpR02 * N403_GLDNUM * N403_GLDNUM + tmpG01 * N403_GLDNUM + tmpB01];
  2542. tmpC00 += ln2 * tmpCmy.Cyn;
  2543. tmpM00 += ln2 * tmpCmy.Mgt;
  2544. tmpY00 += ln2 * tmpCmy.Yel;
  2545. tmpK00 += ln2 * tmpCmy.Bla;
  2546. tmpC00 /= ln3;
  2547. tmpM00 /= ln3;
  2548. tmpY00 /= ln3;
  2549. tmpK00 /= ln3;
  2550. tmpCmy = LokUppRgbCmy[tmpR01 * N403_GLDNUM * N403_GLDNUM + tmpG01 * N403_GLDNUM + tmpB02];
  2551. tmpC01 = ln1 * tmpCmy.Cyn;
  2552. tmpM01 = ln1 * tmpCmy.Mgt;
  2553. tmpY01 = ln1 * tmpCmy.Yel;
  2554. tmpK01 = ln1 * tmpCmy.Bla;
  2555. tmpCmy = LokUppRgbCmy[tmpR02 * N403_GLDNUM * N403_GLDNUM + tmpG01 * N403_GLDNUM + tmpB02];
  2556. tmpC01 += ln2 * tmpCmy.Cyn;
  2557. tmpM01 += ln2 * tmpCmy.Mgt;
  2558. tmpY01 += ln2 * tmpCmy.Yel;
  2559. tmpK01 += ln2 * tmpCmy.Bla;
  2560. tmpC01 /= ln3;
  2561. tmpM01 /= ln3;
  2562. tmpY01 /= ln3;
  2563. tmpK01 /= ln3;
  2564. tmpCmy = LokUppRgbCmy[tmpR01 * N403_GLDNUM * N403_GLDNUM + tmpG02 * N403_GLDNUM + tmpB01];
  2565. tmpC02 = ln1 * tmpCmy.Cyn;
  2566. tmpM02 = ln1 * tmpCmy.Mgt;
  2567. tmpY02 = ln1 * tmpCmy.Yel;
  2568. tmpK02 = ln1 * tmpCmy.Bla;
  2569. tmpCmy = LokUppRgbCmy[tmpR02 * N403_GLDNUM * N403_GLDNUM + tmpG02 * N403_GLDNUM + tmpB01];
  2570. tmpC02 += ln2 * tmpCmy.Cyn;
  2571. tmpM02 += ln2 * tmpCmy.Mgt;
  2572. tmpY02 += ln2 * tmpCmy.Yel;
  2573. tmpK02 += ln2 * tmpCmy.Bla;
  2574. tmpC02 /= ln3;
  2575. tmpM02 /= ln3;
  2576. tmpY02 /= ln3;
  2577. tmpK02 /= ln3;
  2578. tmpCmy = LokUppRgbCmy[tmpR01 * N403_GLDNUM * N403_GLDNUM + tmpG02 * N403_GLDNUM + tmpB02];
  2579. tmpC03 = ln1 * tmpCmy.Cyn;
  2580. tmpM03 = ln1 * tmpCmy.Mgt;
  2581. tmpY03 = ln1 * tmpCmy.Yel;
  2582. tmpK03 = ln1 * tmpCmy.Bla;
  2583. tmpCmy = LokUppRgbCmy[tmpR02 * N403_GLDNUM * N403_GLDNUM + tmpG02 * N403_GLDNUM + tmpB02];
  2584. tmpC03 += ln2 * tmpCmy.Cyn;
  2585. tmpM03 += ln2 * tmpCmy.Mgt;
  2586. tmpY03 += ln2 * tmpCmy.Yel;
  2587. tmpK03 += ln2 * tmpCmy.Bla;
  2588. tmpC03 /= ln3;
  2589. tmpM03 /= ln3;
  2590. tmpY03 /= ln3;
  2591. tmpK03 /= ln3;
  2592. }
  2593. }
  2594. ln2 = tmpGrn - tmpG01*255/31;
  2595. if(ln2 != 0){
  2596. ln1 = tmpG02*255/31 - tmpGrn;
  2597. if(ln1 == 0){
  2598. tmpC00 = tmpC02;
  2599. tmpM00 = tmpM02;
  2600. tmpY00 = tmpY02;
  2601. tmpK00 = tmpK02;
  2602. tmpC01 = tmpC03;
  2603. tmpM01 = tmpM03;
  2604. tmpY01 = tmpY03;
  2605. tmpK01 = tmpK03;
  2606. }else{
  2607. ln3 = ln1 + ln2;
  2608. tmpC00 = (ln1*tmpC00 + ln2*tmpC02) / ln3;
  2609. tmpM00 = (ln1*tmpM00 + ln2*tmpM02) / ln3;
  2610. tmpY00 = (ln1*tmpY00 + ln2*tmpY02) / ln3;
  2611. tmpK00 = (ln1*tmpK00 + ln2*tmpK02) / ln3;
  2612. tmpC01 = (ln1*tmpC01 + ln2*tmpC03) / ln3;
  2613. tmpM01 = (ln1*tmpM01 + ln2*tmpM03) / ln3;
  2614. tmpY01 = (ln1*tmpY01 + ln2*tmpY03) / ln3;
  2615. tmpK01 = (ln1*tmpK01 + ln2*tmpK03) / ln3;
  2616. }
  2617. }
  2618. ln2 = tmpBlu - tmpB01*255/31;
  2619. if(ln2 != 0){
  2620. ln1 = tmpB02*255/31 - tmpBlu;
  2621. if(ln1 == 0){
  2622. tmpC00 = tmpC01;
  2623. tmpM00 = tmpM01;
  2624. tmpY00 = tmpY01;
  2625. tmpK00 = tmpK01;
  2626. }else{
  2627. ln3 = ln1 + ln2;
  2628. tmpC00 = (ln1*tmpC00 + ln2*tmpC01) / ln3;
  2629. tmpM00 = (ln1*tmpM00 + ln2*tmpM01) / ln3;
  2630. tmpY00 = (ln1*tmpY00 + ln2*tmpY01) / ln3;
  2631. tmpK00 = (ln1*tmpK00 + ln2*tmpK01) / ln3;
  2632. }
  2633. }
  2634. tmpCmy.Cyn = innTblCmy[tmpC00];
  2635. tmpCmy.Mgt = innTblCmy[tmpM00];
  2636. tmpCmy.Yel = innTblCmy[tmpY00];
  2637. tmpCmy.Bla = innTblCmy[tmpK00];
  2638. *cmyAdr = tmpCmy;
  2639. cmyAdr++;
  2640. CchRgb[cch] = tmpRgb;
  2641. CchCmy[cch] = tmpCmy;
  2642. }
  2643. }
  2644. //===================================================================================================
  2645. // CMYK data color vividly
  2646. //===================================================================================================
  2647. VOID WINAPI N403ColVivPrc(
  2648. LPN403DIZINF lpDiz,
  2649. LPCMYK cmyAdr,
  2650. DWORD xaxSiz,
  2651. DWORD vivNum
  2652. )
  2653. {
  2654. LPCMYK endAdr;
  2655. LONG tmpCyn;
  2656. LONG tmpMgt;
  2657. LONG tmpYel;
  2658. LONG tmpMid;
  2659. for(endAdr = cmyAdr+xaxSiz ; cmyAdr < endAdr ; cmyAdr++){
  2660. tmpCyn = cmyAdr->Cyn;
  2661. tmpMgt = cmyAdr->Mgt;
  2662. tmpYel = cmyAdr->Yel;
  2663. tmpMid = (tmpCyn + tmpMgt + tmpYel) / 3;
  2664. tmpCyn += (tmpCyn - tmpMid) * (SHORT)vivNum / 100;
  2665. tmpMgt += (tmpMgt - tmpMid) * (SHORT)vivNum / 100;
  2666. tmpYel += (tmpYel - tmpMid) * (SHORT)vivNum / 100;
  2667. if(tmpCyn < 0){tmpCyn = 0;}else if(tmpCyn > 255){tmpCyn = 255;}
  2668. if(tmpMgt < 0){tmpMgt = 0;}else if(tmpMgt > 255){tmpMgt = 255;}
  2669. if(tmpYel < 0){tmpYel = 0;}else if(tmpYel > 255){tmpYel = 255;}
  2670. cmyAdr->Cyn = (BYTE)tmpCyn;
  2671. cmyAdr->Mgt = (BYTE)tmpMgt;
  2672. cmyAdr->Yel = (BYTE)tmpYel;
  2673. }
  2674. }
  2675. //===================================================================================================
  2676. // RGB -> CMYK conversion(No matching)
  2677. //===================================================================================================
  2678. VOID WINAPI N403ColCnvSld(
  2679. LPN403DIZINF lpDiz,
  2680. LPRGB rgbAdr,
  2681. LPCMYK cmyAdr,
  2682. DWORD xaxSiz,
  2683. DWORD blaCnv
  2684. )
  2685. {
  2686. LPRGB endAdr;
  2687. DWORD tmpRed;
  2688. DWORD tmpGrn;
  2689. DWORD tmpBlu;
  2690. LPBYTE innTblCmy;
  2691. innTblCmy = lpDiz->Tnr.Tbl;
  2692. if(innTblCmy != NULL){
  2693. for(endAdr = rgbAdr+xaxSiz ; rgbAdr < endAdr ; rgbAdr++){
  2694. tmpRed = rgbAdr->Red;
  2695. tmpGrn = rgbAdr->Green;
  2696. tmpBlu = rgbAdr->Blue;
  2697. if((blaCnv == 0)&&((tmpRed | tmpGrn | tmpBlu) == 0)){
  2698. cmyAdr->Cyn = 0;
  2699. cmyAdr->Mgt = 0;
  2700. cmyAdr->Yel = 0;
  2701. cmyAdr->Bla = 255;
  2702. cmyAdr++;
  2703. continue;
  2704. }
  2705. cmyAdr->Cyn = innTblCmy[255 - GinTblP15[tmpRed]];
  2706. cmyAdr->Mgt = innTblCmy[255 - GinTblP15[tmpGrn]];
  2707. cmyAdr->Yel = innTblCmy[255 - GinTblP15[tmpBlu]];
  2708. cmyAdr->Bla = 0;
  2709. cmyAdr++;
  2710. }
  2711. return;
  2712. }
  2713. for(endAdr = rgbAdr+xaxSiz ; rgbAdr < endAdr ; rgbAdr++){
  2714. tmpRed = rgbAdr->Red;
  2715. tmpGrn = rgbAdr->Green;
  2716. tmpBlu = rgbAdr->Blue;
  2717. if((blaCnv == 0)&&((tmpRed | tmpGrn | tmpBlu) == 0)){
  2718. cmyAdr->Cyn = 0;
  2719. cmyAdr->Mgt = 0;
  2720. cmyAdr->Yel = 0;
  2721. cmyAdr->Bla = 255;
  2722. cmyAdr++;
  2723. continue;
  2724. }
  2725. cmyAdr->Cyn = (BYTE)255 - GinTblP15[tmpRed];
  2726. cmyAdr->Mgt = (BYTE)255 - GinTblP15[tmpGrn];
  2727. cmyAdr->Yel = (BYTE)255 - GinTblP15[tmpBlu];
  2728. cmyAdr->Bla = 0;
  2729. cmyAdr++;
  2730. }
  2731. }
  2732. //===================================================================================================
  2733. // RGB -> CMYK conversion (for 1dot line)
  2734. //===================================================================================================
  2735. VOID WINAPI N403ColCnvL02(
  2736. LPN403DIZINF lpDiz,
  2737. LPRGB rgbAdr,
  2738. LPCMYK cmyAdr,
  2739. DWORD xaxSiz
  2740. )
  2741. {
  2742. LPRGB endAdr;
  2743. DWORD tmpRed;
  2744. DWORD tmpGrn;
  2745. DWORD tmpBlu;
  2746. DWORD tmpMid;
  2747. BYTE tmpCyn;
  2748. BYTE tmpMgt;
  2749. BYTE tmpYel;
  2750. for(endAdr = rgbAdr+xaxSiz ; rgbAdr < endAdr ; rgbAdr++){
  2751. tmpRed = rgbAdr->Red;
  2752. tmpGrn = rgbAdr->Green;
  2753. tmpBlu = rgbAdr->Blue;
  2754. tmpMid = (tmpRed + tmpGrn + tmpBlu) / 3;
  2755. if(tmpMid > 240){
  2756. cmyAdr->Cyn = 0;
  2757. cmyAdr->Mgt = 0;
  2758. cmyAdr->Yel = 0;
  2759. cmyAdr->Bla = 0;
  2760. cmyAdr++;
  2761. continue;
  2762. }
  2763. tmpCyn = 255;
  2764. tmpMgt = 255;
  2765. tmpYel = 255;
  2766. tmpMid += (255 - tmpMid) / 8;
  2767. if(tmpRed > tmpMid){ tmpCyn = 0; }
  2768. if(tmpGrn > tmpMid){ tmpMgt = 0; }
  2769. if(tmpBlu > tmpMid){ tmpYel = 0; }
  2770. if((tmpCyn & tmpMgt & tmpYel) == 255){
  2771. cmyAdr->Cyn = 0;
  2772. cmyAdr->Mgt = 0;
  2773. cmyAdr->Yel = 0;
  2774. cmyAdr->Bla = 255;
  2775. cmyAdr++;
  2776. continue;
  2777. }
  2778. cmyAdr->Cyn = tmpCyn;
  2779. cmyAdr->Mgt = tmpMgt;
  2780. cmyAdr->Yel = tmpYel;
  2781. cmyAdr->Bla = 0;
  2782. cmyAdr++;
  2783. }
  2784. }
  2785. //===================================================================================================
  2786. // RGB -> CMYK conversion (for monochrome)
  2787. //===================================================================================================
  2788. VOID WINAPI N403ColCnvMon(
  2789. LPN403DIZINF lpDiz,
  2790. LPRGB rgbAdr,
  2791. LPCMYK cmyAdr,
  2792. DWORD xaxSiz
  2793. )
  2794. {
  2795. LPRGB endAdr;
  2796. DWORD red;
  2797. DWORD grn;
  2798. DWORD blu;
  2799. BYTE bla;
  2800. LPBYTE innTblCmy;
  2801. innTblCmy = lpDiz->Tnr.Tbl;
  2802. if(innTblCmy != NULL){
  2803. for(endAdr = rgbAdr+xaxSiz ; rgbAdr < endAdr ; rgbAdr++){
  2804. red = rgbAdr->Red;
  2805. grn = rgbAdr->Green;
  2806. blu = rgbAdr->Blue;
  2807. bla = innTblCmy[255 - GinTblP10[(red*3 + grn*5 + blu*2) / 10]];
  2808. cmyAdr->Cyn = 0;
  2809. cmyAdr->Mgt = 0;
  2810. cmyAdr->Yel = 0;
  2811. cmyAdr->Bla = bla;
  2812. cmyAdr++;
  2813. }
  2814. return;
  2815. }
  2816. for(endAdr = rgbAdr+xaxSiz ; rgbAdr < endAdr ; rgbAdr++){
  2817. red = rgbAdr->Red;
  2818. grn = rgbAdr->Green;
  2819. blu = rgbAdr->Blue;
  2820. bla = (BYTE)255 - GinTblP10[(red*3 + grn*5 + blu*2) / 10];
  2821. cmyAdr->Cyn = 0;
  2822. cmyAdr->Mgt = 0;
  2823. cmyAdr->Yel = 0;
  2824. cmyAdr->Bla = bla;
  2825. cmyAdr++;
  2826. }
  2827. }
  2828. // End of N403DIZ.C