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.

1750 lines
76 KiB

  1. //***************************************************************************************************
  2. // N5DIZPC.C
  3. //
  4. // Functions of dithering (For N5 printer)
  5. //---------------------------------------------------------------------------------------------------
  6. // copyright(C) 1997-2000 CASIO COMPUTER CO.,LTD. / CASIO ELECTRONICS MANUFACTURING CO.,LTD.
  7. //***************************************************************************************************
  8. #include <WINDOWS.H>
  9. #include <WINBASE.H>
  10. #include "PDEV.H" //+2002.2.23
  11. //#include "COLDEF.H" //-2002.2.23
  12. //#include "COMDIZ.H" //-2002.2.23
  13. //#include "N5DIZPC.H" //-2002.2.23
  14. #include "strsafe.h" // Security-Code 2002.3.6
  15. //===================================================================================================
  16. // Structure for dithering information (each color)
  17. //===================================================================================================
  18. typedef struct {
  19. struct {
  20. LPBYTE Cyn;
  21. LPBYTE Mgt;
  22. LPBYTE Yel;
  23. LPBYTE Bla;
  24. } Cur;
  25. struct {
  26. LPBYTE Cyn;
  27. LPBYTE Mgt;
  28. LPBYTE Yel;
  29. LPBYTE Bla;
  30. } Xsp;
  31. struct {
  32. LPBYTE Cyn;
  33. LPBYTE Mgt;
  34. LPBYTE Yel;
  35. LPBYTE Bla;
  36. } Xep;
  37. struct {
  38. LPBYTE Cyn;
  39. LPBYTE Mgt;
  40. LPBYTE Yel;
  41. LPBYTE Bla;
  42. } Ysp;
  43. struct {
  44. LPBYTE Cyn;
  45. LPBYTE Mgt;
  46. LPBYTE Yel;
  47. LPBYTE Bla;
  48. } Yep;
  49. struct {
  50. DWORD Cyn;
  51. DWORD Mgt;
  52. DWORD Yel;
  53. DWORD Bla;
  54. } DYY;
  55. } DIZCOLINF, FAR* LPDIZCOLINF;
  56. //===================================================================================================
  57. // Static functions
  58. //===================================================================================================
  59. //---------------------------------------------------------------------------------------------------
  60. // Dithering (color 2value)
  61. //---------------------------------------------------------------------------------------------------
  62. #if !defined(CP80W9X) // CP-E8000 is invalid
  63. static VOID DizPrcC02( // Return value no
  64. LPDIZINF, // Fixation dithering information
  65. LPDRWINF, // Drawing information
  66. DWORD // Source data line number
  67. );
  68. #endif
  69. //---------------------------------------------------------------------------------------------------
  70. // Dithering (color 4value)
  71. //---------------------------------------------------------------------------------------------------
  72. #if !defined(CP80W9X) // CP-E8000 is invalid
  73. static VOID DizPrcC04( // Return value no
  74. LPDIZINF, // Fixation dithering information
  75. LPDRWINF, // Drawing information
  76. DWORD // Source data line number
  77. );
  78. #endif
  79. //---------------------------------------------------------------------------------------------------
  80. // Dithering (color 16value)
  81. //---------------------------------------------------------------------------------------------------
  82. #if !defined(CP80W9X) // CP-E8000 is invalid
  83. static VOID DizPrcC16( // Return value no
  84. LPDIZINF, // Fixation dithering information
  85. LPDRWINF, // Drawing information
  86. DWORD // Source data line number
  87. );
  88. #endif
  89. //---------------------------------------------------------------------------------------------------
  90. // Dithering (mono 2value)
  91. //---------------------------------------------------------------------------------------------------
  92. static VOID DizPrcM02( // Return value no
  93. LPDIZINF, // Fixation dithering information
  94. LPDRWINF, // Drawing information
  95. DWORD // Source data line number
  96. );
  97. //---------------------------------------------------------------------------------------------------
  98. // Dithering (mono 4value)
  99. //---------------------------------------------------------------------------------------------------
  100. #if !defined(CP80W9X) // CP-E8000 is invalid
  101. static VOID DizPrcM04( // Return value no
  102. LPDIZINF, // Fixation dithering information
  103. LPDRWINF, // Drawing information
  104. DWORD // Source data line number
  105. );
  106. #endif
  107. //---------------------------------------------------------------------------------------------------
  108. // Dithering (mono 16value)
  109. //---------------------------------------------------------------------------------------------------
  110. #if !defined(CP80W9X) // CP-E8000 is invalid
  111. static VOID DizPrcM16( // Return value no
  112. LPDIZINF, // Fixation dithering information
  113. LPDRWINF, // Drawing information
  114. DWORD // Source data line number
  115. );
  116. #endif
  117. //---------------------------------------------------------------------------------------------------
  118. // Dithering procedure (For DRIVER)
  119. //---------------------------------------------------------------------------------------------------
  120. static VOID ColDizPrcNln( // Return value no
  121. LPDIZINF, // Fixation dithering information
  122. LPDRWINF, // Drawing information
  123. DWORD // Source data line number
  124. );
  125. //---------------------------------------------------------------------------------------------------
  126. // Dithering information set (color)
  127. //---------------------------------------------------------------------------------------------------
  128. #if !defined(CP80W9X) // CP-E8000 is invalid
  129. static VOID DizInfSetCol( // Return value no
  130. LPDIZINF, // Fixation dithering information
  131. LPDIZCOLINF, // Dithering information (each color)
  132. LPDRWINF, // Drawing information
  133. DWORD // Threshold (per 1pixel)
  134. );
  135. #endif
  136. //---------------------------------------------------------------------------------------------------
  137. // Dithering information set (monochrome)
  138. //---------------------------------------------------------------------------------------------------
  139. static VOID DizInfSetMon( // Return value no
  140. LPDIZINF, // Fixation dithering information
  141. LPDIZCOLINF, // Dithering information (each color)
  142. LPDRWINF, // Drawing information
  143. DWORD // Threshold (per 1pixel)
  144. );
  145. //---------------------------------------------------------------------------------------------------
  146. // Dithering information renewal (color)
  147. //---------------------------------------------------------------------------------------------------
  148. #if !defined(CP80W9X) // CP-E8000 is invalid
  149. static VOID DizInfChgCol( // Return value no
  150. LPDIZINF, // Fixation dithering information
  151. LPDIZCOLINF // Dithering information (each color)
  152. );
  153. #endif
  154. //---------------------------------------------------------------------------------------------------
  155. // Dithering information renewal (monochrome)
  156. //---------------------------------------------------------------------------------------------------
  157. static VOID DizInfChgMon( // Return value no
  158. LPDIZINF, // Fixation dithering information
  159. LPDIZCOLINF // Dithering information (each color)
  160. );
  161. //***************************************************************************************************
  162. // Functions
  163. //***************************************************************************************************
  164. //===================================================================================================
  165. // Drawing information make
  166. //===================================================================================================
  167. #if !defined(CP80W9X) // CP-E8000 is invalid
  168. DWORD WINAPI N501ColDrwInfSet( // In a bundle development possibility line number
  169. LPDIZINF dizInf, // Fixation dithering information
  170. LPDRWINF drwInf, // Dithering information
  171. DWORD linBufSiz // Line buffer size (1color)
  172. )
  173. {
  174. DWORD lvl;
  175. // Check of zero divide 2002.3.23 >>>
  176. if ((drwInf->XaxNrt == 0) || (drwInf->XaxDnt == 0) ||
  177. (drwInf->YaxNrt == 0) || (drwInf->YaxDnt == 0)) {
  178. ERR(("N501ColDrwInfSet() 0Div-Check [drwInf->XaxNrt,XaxDnt,YaxNrt,YaxDnt=0] \n"));
  179. return 0;
  180. }
  181. // Check of zero divide 2002.3.23 <<<
  182. /*----- variable power offset calculation ------------------------------*/
  183. drwInf->XaxOfs = (drwInf->StrXax * drwInf->XaxDnt + drwInf->XaxNrt / 2) / drwInf->XaxNrt;
  184. drwInf->YaxOfs = (drwInf->StrYax * drwInf->YaxDnt + drwInf->YaxNrt / 2) / drwInf->YaxNrt;
  185. /*----- One line dot number calculation --------------------------------*/
  186. drwInf->LinDot =
  187. (drwInf->XaxOfs + drwInf->XaxSiz) * drwInf->XaxNrt / drwInf->XaxDnt -
  188. drwInf->XaxOfs * drwInf->XaxNrt / drwInf->XaxDnt;
  189. /*----- One line byte calculation --------------------------------------*/
  190. switch (dizInf->PrnMod) {
  191. case PRM316: case PRM616: lvl = 4; break;
  192. case PRM604: lvl = 2; break;
  193. default: lvl = 1; break;
  194. }
  195. drwInf->LinByt = (drwInf->LinDot * lvl + 7) / 8;
  196. /*----- In a bundle development possibility line number ----------------*/
  197. return (linBufSiz / drwInf->LinByt) * drwInf->YaxDnt / drwInf->YaxNrt;
  198. }
  199. #endif
  200. //===================================================================================================
  201. // Dithering procedure (For DRIVER)
  202. //===================================================================================================
  203. VOID WINAPI N501ColDizPrc( // Return value no
  204. LPDIZINF dizInf, // Fixation dithering information
  205. LPDRWINF drwInf // Drawing information
  206. )
  207. {
  208. ColDizPrcNln(dizInf, drwInf, 1);
  209. return;
  210. }
  211. //===================================================================================================
  212. // Static functions
  213. //===================================================================================================
  214. //---------------------------------------------------------------------------------------------------
  215. // Dithering procedure (For DRIVER)
  216. //---------------------------------------------------------------------------------------------------
  217. static VOID ColDizPrcNln( // Return value no
  218. LPDIZINF dizInf, // Fixation dithering information
  219. LPDRWINF drwInf, // Drawing information
  220. DWORD linNum // Source data line number
  221. )
  222. {
  223. DWORD lvl;
  224. switch (dizInf->PrnMod) {
  225. #if !defined(CP80W9X) // CP-E8000 is invalid
  226. case PRM316: case PRM616: lvl = 4; break;
  227. case PRM604: lvl = 2; break;
  228. #endif
  229. default: lvl = 1; break;
  230. }
  231. #if !defined(CP80W9X) // CP-E8000 is invalid
  232. if (dizInf->ColMon == CMMCOL) {
  233. /*===== Color ======================================================*/
  234. switch (lvl) {
  235. case 1: DizPrcC02(dizInf, drwInf, linNum); return;
  236. case 2: DizPrcC04(dizInf, drwInf, linNum); return;
  237. case 4: DizPrcC16(dizInf, drwInf, linNum); return;
  238. }
  239. }
  240. #endif
  241. /*===== Monochrome =====================================================*/
  242. switch (lvl) {
  243. case 1: DizPrcM02(dizInf, drwInf, linNum); return;
  244. #if !defined(CP80W9X) // CP-E8000 is invalid
  245. case 2: DizPrcM04(dizInf, drwInf, linNum); return;
  246. case 4: DizPrcM16(dizInf, drwInf, linNum); return;
  247. #endif
  248. }
  249. }
  250. //---------------------------------------------------------------------------------------------------
  251. // Dithering (color 2value)
  252. //---------------------------------------------------------------------------------------------------
  253. #if !defined(CP80W9X) // CP-E8000 is invalid
  254. static VOID DizPrcC02( // Return value no
  255. LPDIZINF dizInf, // Fixation dithering information
  256. LPDRWINF drwInf, // Drawing information
  257. DWORD linNum // Source data line number
  258. )
  259. {
  260. LPCMYK src;
  261. BYTE wrtPix;
  262. BYTE bytCyn, bytMgt, bytYel, bytBla;
  263. CMYK cmy;
  264. LPBYTE dizCyn, dizMgt, dizYel, dizBla;
  265. LPBYTE linC00, linM00, linY00, linK00;
  266. DWORD xax, yax;
  267. LPCMYK srcPtr;
  268. LONG xaxNrt, xaxDnt, yaxNrt, yaxDnt;
  269. LONG amrXax, amrYax, amrXax000;
  270. DWORD elmSiz, linByt;
  271. DIZCOLINF dizColInf;
  272. elmSiz = 1;
  273. // DizInfSetCol(dizInf, drwInf, elmSiz);
  274. DizInfSetCol(dizInf, &dizColInf, drwInf, elmSiz);
  275. dizCyn = dizInf->TblCyn;
  276. dizMgt = dizInf->TblMgt;
  277. dizYel = dizInf->TblYel;
  278. dizBla = dizInf->TblBla;
  279. linC00 = drwInf->LinBufCyn + drwInf->LinByt * drwInf->AllLinNum;
  280. linM00 = drwInf->LinBufMgt + drwInf->LinByt * drwInf->AllLinNum;
  281. linY00 = drwInf->LinBufYel + drwInf->LinByt * drwInf->AllLinNum;
  282. linK00 = drwInf->LinBufBla + drwInf->LinByt * drwInf->AllLinNum;
  283. xaxNrt = drwInf->XaxNrt; xaxDnt = drwInf->XaxDnt;
  284. yaxNrt = drwInf->YaxNrt; yaxDnt = drwInf->YaxDnt;
  285. src = drwInf->CmyBuf;
  286. /****** Dithering main **************************************************/
  287. if ((xaxNrt == xaxDnt) && (yaxNrt == yaxDnt)) {
  288. /*===== Same size(Expansion/reduction no) ==========================*/
  289. for (yax = 0; yax < linNum; yax++) {
  290. /*..... Vertical axis movement .................................*/
  291. wrtPix = (BYTE)0x80;
  292. bytCyn = bytMgt = bytYel = bytBla = (BYTE)0x00;
  293. // dizCyn = DizCynCur;
  294. // dizMgt = DizMgtCur;
  295. // dizYel = DizYelCur;
  296. // dizBla = DizBlaCur;
  297. dizCyn = dizColInf.Cur.Cyn;
  298. dizMgt = dizColInf.Cur.Mgt;
  299. dizYel = dizColInf.Cur.Yel;
  300. dizBla = dizColInf.Cur.Bla;
  301. linByt = drwInf->LinByt;
  302. for (xax = 0; xax < drwInf->XaxSiz; xax++) {
  303. /*..... Horizontal axis movement ...........................*/
  304. /****** Dithering *******************************************/
  305. cmy = *src++;
  306. if (cmy.Cyn > *dizCyn++) bytCyn |= wrtPix; // Cyan
  307. if (cmy.Mgt > *dizMgt++) bytMgt |= wrtPix; // Magenta
  308. if (cmy.Yel > *dizYel++) bytYel |= wrtPix; // Yellow
  309. if (cmy.Bla > *dizBla++) bytBla |= wrtPix; // Black
  310. if (!(wrtPix >>= 1)) {
  311. if (linByt) {
  312. *linC00++ = bytCyn;
  313. *linM00++ = bytMgt;
  314. *linY00++ = bytYel;
  315. *linK00++ = bytBla;
  316. linByt--;
  317. }
  318. wrtPix = (BYTE)0x80;
  319. bytCyn = bytMgt = bytYel = bytBla = (BYTE)0x00;
  320. }
  321. // if (dizCyn == DizCynXep) dizCyn = DizCynXsp;
  322. // if (dizMgt == DizMgtXep) dizMgt = DizMgtXsp;
  323. // if (dizYel == DizYelXep) dizYel = DizYelXsp;
  324. // if (dizBla == DizBlaXep) dizBla = DizBlaXsp;
  325. if (dizCyn == dizColInf.Xep.Cyn) dizCyn = dizColInf.Xsp.Cyn;
  326. if (dizMgt == dizColInf.Xep.Mgt) dizMgt = dizColInf.Xsp.Mgt;
  327. if (dizYel == dizColInf.Xep.Yel) dizYel = dizColInf.Xsp.Yel;
  328. if (dizBla == dizColInf.Xep.Bla) dizBla = dizColInf.Xsp.Bla;
  329. }
  330. if (wrtPix != 0x80) {
  331. if (linByt) {
  332. *linC00++ = bytCyn;
  333. *linM00++ = bytMgt;
  334. *linY00++ = bytYel;
  335. *linK00++ = bytBla;
  336. linByt--;
  337. }
  338. }
  339. while (linByt) {
  340. *linC00++ = (BYTE)0x00;
  341. *linM00++ = (BYTE)0x00;
  342. *linY00++ = (BYTE)0x00;
  343. *linK00++ = (BYTE)0x00;
  344. linByt--;
  345. }
  346. // DizInfChgCol(dizInf); // Dithering information renewal(Y)
  347. DizInfChgCol(dizInf, &dizColInf); // Dithering information renewal(Y)
  348. drwInf->YaxOfs += 1;
  349. drwInf->StrYax += 1;
  350. drwInf->AllLinNum += 1;
  351. }
  352. return;
  353. }
  354. /*===== Expansion/reduction ============================================*/
  355. amrXax000 = amrXax = (LONG)(drwInf->XaxOfs) * xaxNrt % xaxDnt;
  356. amrYax = (LONG)(drwInf->YaxOfs) * yaxNrt % yaxDnt;
  357. for (yax = 0; yax < linNum; yax++) {
  358. /*..... Vertical axis movement .....................................*/
  359. srcPtr = src;
  360. for (amrYax += yaxNrt; ((amrYax >= yaxDnt) || (amrYax < 0));
  361. amrYax -= yaxDnt) { // Magnification set for vertical
  362. amrXax = amrXax000;
  363. wrtPix = (BYTE)0x80;
  364. bytCyn = bytMgt = bytYel = bytBla = (BYTE)0x00;
  365. // dizCyn = DizCynCur;
  366. // dizMgt = DizMgtCur;
  367. // dizYel = DizYelCur;
  368. // dizBla = DizBlaCur;
  369. dizCyn = dizColInf.Cur.Cyn;
  370. dizMgt = dizColInf.Cur.Mgt;
  371. dizYel = dizColInf.Cur.Yel;
  372. dizBla = dizColInf.Cur.Bla;
  373. src = srcPtr;
  374. linByt = drwInf->LinByt;
  375. for (xax = 0; xax < drwInf->XaxSiz; xax++) {
  376. /*..... Horizontal axis movement ...........................*/
  377. cmy = *src++;
  378. for (amrXax += xaxNrt; ((amrXax >= xaxDnt) || (amrXax < 0));
  379. amrXax -= xaxDnt) { // Magnification set for Horizontal
  380. /****** Dithering ***************************************/
  381. if (cmy.Cyn > *dizCyn++) bytCyn |= wrtPix; // Cyan
  382. if (cmy.Mgt > *dizMgt++) bytMgt |= wrtPix; // Magenta
  383. if (cmy.Yel > *dizYel++) bytYel |= wrtPix; // Yellow
  384. if (cmy.Bla > *dizBla++) bytBla |= wrtPix; // Black
  385. if (!(wrtPix >>= 1)) {
  386. if (linByt) {
  387. *linC00++ = bytCyn;
  388. *linM00++ = bytMgt;
  389. *linY00++ = bytYel;
  390. *linK00++ = bytBla;
  391. linByt--;
  392. }
  393. wrtPix = (BYTE)0x80;
  394. bytCyn = bytMgt = bytYel = bytBla = (BYTE)0x00;
  395. }
  396. // if (dizCyn == DizCynXep) dizCyn = DizCynXsp;
  397. // if (dizMgt == DizMgtXep) dizMgt = DizMgtXsp;
  398. // if (dizYel == DizYelXep) dizYel = DizYelXsp;
  399. // if (dizBla == DizBlaXep) dizBla = DizBlaXsp;
  400. if (dizCyn == dizColInf.Xep.Cyn) dizCyn = dizColInf.Xsp.Cyn;
  401. if (dizMgt == dizColInf.Xep.Mgt) dizMgt = dizColInf.Xsp.Mgt;
  402. if (dizYel == dizColInf.Xep.Yel) dizYel = dizColInf.Xsp.Yel;
  403. if (dizBla == dizColInf.Xep.Bla) dizBla = dizColInf.Xsp.Bla;
  404. }
  405. }
  406. if (wrtPix != 0x80) {
  407. if (linByt) {
  408. *linC00++ = bytCyn;
  409. *linM00++ = bytMgt;
  410. *linY00++ = bytYel;
  411. *linK00++ = bytBla;
  412. linByt--;
  413. }
  414. }
  415. while (linByt) {
  416. *linC00++ = (BYTE)0x00;
  417. *linM00++ = (BYTE)0x00;
  418. *linY00++ = (BYTE)0x00;
  419. *linK00++ = (BYTE)0x00;
  420. linByt--;
  421. }
  422. // DizInfChgCol(dizInf); // Dithering information renewal(Y)
  423. DizInfChgCol(dizInf, &dizColInf); // Dithering information renewal(Y)
  424. drwInf->StrYax += 1;
  425. drwInf->AllLinNum += 1;
  426. }
  427. drwInf->YaxOfs += 1;
  428. }
  429. return;
  430. }
  431. #endif
  432. //---------------------------------------------------------------------------------------------------
  433. // Dithering (color 4value)
  434. //---------------------------------------------------------------------------------------------------
  435. #if !defined(CP80W9X) // CP-E8000 is invalid
  436. static VOID DizPrcC04( // Return value no
  437. LPDIZINF dizInf, // Fixation dithering information
  438. LPDRWINF drwInf, // Drawing information
  439. DWORD linNum // Source data line number
  440. )
  441. {
  442. LPCMYK src;
  443. BYTE wrtPix004, wrtPix008, wrtPix00c;
  444. BYTE bytCyn, bytMgt, bytYel, bytBla;
  445. CMYK cmy;
  446. LPBYTE dizCyn, dizMgt, dizYel, dizBla;
  447. LPBYTE linC00, linM00, linY00, linK00;
  448. DWORD xax, yax;
  449. LPCMYK srcPtr;
  450. LONG xaxNrt, xaxDnt, yaxNrt, yaxDnt;
  451. LONG amrXax, amrYax, amrXax000;
  452. DWORD elmSiz, linByt;
  453. DIZCOLINF dizColInf;
  454. elmSiz = 3;
  455. // DizInfSetCol(dizInf, drwInf, elmSiz);
  456. DizInfSetCol(dizInf, &dizColInf, drwInf, elmSiz);
  457. dizCyn = dizInf->TblCyn;
  458. dizMgt = dizInf->TblMgt;
  459. dizYel = dizInf->TblYel;
  460. dizBla = dizInf->TblBla;
  461. linC00 = drwInf->LinBufCyn + drwInf->LinByt * drwInf->AllLinNum;
  462. linM00 = drwInf->LinBufMgt + drwInf->LinByt * drwInf->AllLinNum;
  463. linY00 = drwInf->LinBufYel + drwInf->LinByt * drwInf->AllLinNum;
  464. linK00 = drwInf->LinBufBla + drwInf->LinByt * drwInf->AllLinNum;
  465. xaxNrt = drwInf->XaxNrt; xaxDnt = drwInf->XaxDnt;
  466. yaxNrt = drwInf->YaxNrt; yaxDnt = drwInf->YaxDnt;
  467. src = drwInf->CmyBuf;
  468. /****** Dithering main **************************************************/
  469. if ((xaxNrt == xaxDnt) && (yaxNrt == yaxDnt)) {
  470. /*===== Same size(Expansion/reduction no) ==========================*/
  471. for (yax = 0; yax < linNum; yax++) {
  472. /*..... Vertical axis movement .................................*/
  473. wrtPix004 = (BYTE)0x40;
  474. wrtPix008 = (BYTE)0x80;
  475. wrtPix00c = (BYTE)0xc0;
  476. bytCyn = bytMgt = bytYel = bytBla = (BYTE)0x00;
  477. // dizCyn = DizCynCur;
  478. // dizMgt = DizMgtCur;
  479. // dizYel = DizYelCur;
  480. // dizBla = DizBlaCur;
  481. dizCyn = dizColInf.Cur.Cyn;
  482. dizMgt = dizColInf.Cur.Mgt;
  483. dizYel = dizColInf.Cur.Yel;
  484. dizBla = dizColInf.Cur.Bla;
  485. linByt = drwInf->LinByt;
  486. for (xax = 0; xax < drwInf->XaxSiz; xax++) {
  487. /*..... Horizontal axis movement ...........................*/
  488. /****** Dithering *******************************************/
  489. cmy = *src++;
  490. if (cmy.Cyn > *dizCyn) { // Cyan
  491. if (cmy.Cyn > *(dizCyn + 2)) bytCyn |= wrtPix00c;
  492. else if (cmy.Cyn > *(dizCyn + 1)) bytCyn |= wrtPix008;
  493. else bytCyn |= wrtPix004;
  494. }
  495. if (cmy.Mgt > *dizMgt) { // Magenta
  496. if (cmy.Mgt > *(dizMgt + 2)) bytMgt |= wrtPix00c;
  497. else if (cmy.Mgt > *(dizMgt + 1)) bytMgt |= wrtPix008;
  498. else bytMgt |= wrtPix004;
  499. }
  500. if (cmy.Yel > *dizYel) { // Yellow
  501. if (cmy.Yel > *(dizYel + 2)) bytYel |= wrtPix00c;
  502. else if (cmy.Yel > *(dizYel + 1)) bytYel |= wrtPix008;
  503. else bytYel |= wrtPix004;
  504. }
  505. if (cmy.Bla > *dizBla) { // Black
  506. if (cmy.Bla > *(dizBla + 2)) bytBla |= wrtPix00c;
  507. else if (cmy.Bla > *(dizBla + 1)) bytBla |= wrtPix008;
  508. else bytBla |= wrtPix004;
  509. }
  510. wrtPix00c >>= 2; wrtPix008 >>= 2; wrtPix004 >>= 2;
  511. if (!wrtPix004) {
  512. if (linByt) {
  513. *linC00++ = bytCyn;
  514. *linM00++ = bytMgt;
  515. *linY00++ = bytYel;
  516. *linK00++ = bytBla;
  517. linByt--;
  518. }
  519. wrtPix004 = (BYTE)0x40;
  520. wrtPix008 = (BYTE)0x80;
  521. wrtPix00c = (BYTE)0xc0;
  522. bytCyn = bytMgt = bytYel = bytBla = (BYTE)0x00;
  523. }
  524. dizCyn += elmSiz;
  525. dizMgt += elmSiz;
  526. dizYel += elmSiz;
  527. dizBla += elmSiz;
  528. // if (dizCyn == DizCynXep) dizCyn = DizCynXsp;
  529. // if (dizMgt == DizMgtXep) dizMgt = DizMgtXsp;
  530. // if (dizYel == DizYelXep) dizYel = DizYelXsp;
  531. // if (dizBla == DizBlaXep) dizBla = DizBlaXsp;
  532. if (dizCyn == dizColInf.Xep.Cyn) dizCyn = dizColInf.Xsp.Cyn;
  533. if (dizMgt == dizColInf.Xep.Mgt) dizMgt = dizColInf.Xsp.Mgt;
  534. if (dizYel == dizColInf.Xep.Yel) dizYel = dizColInf.Xsp.Yel;
  535. if (dizBla == dizColInf.Xep.Bla) dizBla = dizColInf.Xsp.Bla;
  536. }
  537. if (wrtPix004 != 0x40) {
  538. if (linByt) {
  539. *linC00++ = bytCyn;
  540. *linM00++ = bytMgt;
  541. *linY00++ = bytYel;
  542. *linK00++ = bytBla;
  543. linByt--;
  544. }
  545. }
  546. while (linByt) {
  547. *linC00++ = (BYTE)0x00;
  548. *linM00++ = (BYTE)0x00;
  549. *linY00++ = (BYTE)0x00;
  550. *linK00++ = (BYTE)0x00;
  551. linByt--;
  552. }
  553. // DizInfChgCol(dizInf); // Dithering information renewal(Y)
  554. DizInfChgCol(dizInf, &dizColInf); // Dithering information renewal(Y)
  555. drwInf->YaxOfs += 1;
  556. drwInf->StrYax += 1;
  557. drwInf->AllLinNum += 1;
  558. }
  559. return;
  560. }
  561. /*===== Expansion/reduction ============================================*/
  562. amrXax000 = amrXax = (LONG)(drwInf->XaxOfs) * xaxNrt % xaxDnt;
  563. amrYax = (LONG)(drwInf->YaxOfs) * yaxNrt % yaxDnt;
  564. for (yax = 0; yax < linNum; yax++) {
  565. /*..... Vertical axis movement .....................................*/
  566. srcPtr = src;
  567. for (amrYax += yaxNrt; ((amrYax >= yaxDnt) || (amrYax < 0));
  568. amrYax -= yaxDnt) { /* Magnification set for vertical */
  569. amrXax = amrXax000;
  570. wrtPix004 = (BYTE)0x40;
  571. wrtPix008 = (BYTE)0x80;
  572. wrtPix00c = (BYTE)0xc0;
  573. bytCyn = bytMgt = bytYel = bytBla = (BYTE)0x00;
  574. // dizCyn = DizCynCur;
  575. // dizMgt = DizMgtCur;
  576. // dizYel = DizYelCur;
  577. // dizBla = DizBlaCur;
  578. dizCyn = dizColInf.Cur.Cyn;
  579. dizMgt = dizColInf.Cur.Mgt;
  580. dizYel = dizColInf.Cur.Yel;
  581. dizBla = dizColInf.Cur.Bla;
  582. src = srcPtr;
  583. linByt = drwInf->LinByt;
  584. for (xax = 0; xax < drwInf->XaxSiz; xax++) {
  585. /*..... Horizontal axis movement ...........................*/
  586. cmy = *src++;
  587. for (amrXax += xaxNrt; ((amrXax >= xaxDnt) || (amrXax < 0));
  588. amrXax -= xaxDnt) { // Magnification set for Horizontal
  589. /****** Dithering ***************************************/
  590. if (cmy.Cyn > *dizCyn) { // Cyan
  591. if (cmy.Cyn > *(dizCyn + 2)) bytCyn |= wrtPix00c;
  592. else if (cmy.Cyn > *(dizCyn + 1)) bytCyn |= wrtPix008;
  593. else bytCyn |= wrtPix004;
  594. }
  595. if (cmy.Mgt > *dizMgt) { // Magenta
  596. if (cmy.Mgt > *(dizMgt + 2)) bytMgt |= wrtPix00c;
  597. else if (cmy.Mgt > *(dizMgt + 1)) bytMgt |= wrtPix008;
  598. else bytMgt |= wrtPix004;
  599. }
  600. if (cmy.Yel > *dizYel) { // Yellow
  601. if (cmy.Yel > *(dizYel + 2)) bytYel |= wrtPix00c;
  602. else if (cmy.Yel > *(dizYel + 1)) bytYel |= wrtPix008;
  603. else bytYel |= wrtPix004;
  604. }
  605. if (cmy.Bla > *dizBla) { // Black
  606. if (cmy.Bla > *(dizBla + 2)) bytBla |= wrtPix00c;
  607. else if (cmy.Bla > *(dizBla + 1)) bytBla |= wrtPix008;
  608. else bytBla |= wrtPix004;
  609. }
  610. wrtPix00c >>= 2; wrtPix008 >>= 2; wrtPix004 >>= 2;
  611. if (!wrtPix004) {
  612. if (linByt) {
  613. *linC00++ = bytCyn;
  614. *linM00++ = bytMgt;
  615. *linY00++ = bytYel;
  616. *linK00++ = bytBla;
  617. linByt--;
  618. }
  619. wrtPix004 = (BYTE)0x40;
  620. wrtPix008 = (BYTE)0x80;
  621. wrtPix00c = (BYTE)0xc0;
  622. bytCyn = bytMgt = bytYel = bytBla = (BYTE)0x00;
  623. }
  624. dizCyn += elmSiz;
  625. dizMgt += elmSiz;
  626. dizYel += elmSiz;
  627. dizBla += elmSiz;
  628. // if (dizCyn == DizCynXep) dizCyn = DizCynXsp;
  629. // if (dizMgt == DizMgtXep) dizMgt = DizMgtXsp;
  630. // if (dizYel == DizYelXep) dizYel = DizYelXsp;
  631. // if (dizBla == DizBlaXep) dizBla = DizBlaXsp;
  632. if (dizCyn == dizColInf.Xep.Cyn) dizCyn = dizColInf.Xsp.Cyn;
  633. if (dizMgt == dizColInf.Xep.Mgt) dizMgt = dizColInf.Xsp.Mgt;
  634. if (dizYel == dizColInf.Xep.Yel) dizYel = dizColInf.Xsp.Yel;
  635. if (dizBla == dizColInf.Xep.Bla) dizBla = dizColInf.Xsp.Bla;
  636. }
  637. }
  638. if (wrtPix004 != 0x40) {
  639. if (linByt) {
  640. *linC00++ = bytCyn;
  641. *linM00++ = bytMgt;
  642. *linY00++ = bytYel;
  643. *linK00++ = bytBla;
  644. linByt--;
  645. }
  646. }
  647. while (linByt) {
  648. *linC00++ = (BYTE)0x00;
  649. *linM00++ = (BYTE)0x00;
  650. *linY00++ = (BYTE)0x00;
  651. *linK00++ = (BYTE)0x00;
  652. linByt--;
  653. }
  654. // DizInfChgCol(dizInf); // Dithering information renewal(Y)
  655. DizInfChgCol(dizInf, &dizColInf); // Dithering information renewal(Y)
  656. drwInf->StrYax += 1;
  657. drwInf->AllLinNum += 1;
  658. }
  659. drwInf->YaxOfs += 1;
  660. }
  661. return;
  662. }
  663. #endif
  664. //---------------------------------------------------------------------------------------------------
  665. // Dithering (color 16value)
  666. //---------------------------------------------------------------------------------------------------
  667. #if !defined(CP80W9X) // CP-E8000 is invalid
  668. static VOID DizPrcC16( // Return value no
  669. LPDIZINF dizInf, // Fixation dithering information
  670. LPDRWINF drwInf, // Drawing information
  671. DWORD linNum // Source data line number
  672. )
  673. {
  674. LPCMYK src;
  675. DWORD sft;
  676. BYTE min, max, mid;
  677. BYTE bytCyn, bytMgt, bytYel, bytBla;
  678. CMYK cmy;
  679. LPBYTE dizCyn, dizMgt, dizYel, dizBla;
  680. LPBYTE linC00, linM00, linY00, linK00;
  681. DWORD xax, yax;
  682. LPCMYK srcPtr;
  683. LONG xaxNrt, xaxDnt, yaxNrt, yaxDnt;
  684. LONG amrXax, amrYax, amrXax000;
  685. DWORD elmSiz, linByt;
  686. DIZCOLINF dizColInf;
  687. elmSiz = 15;
  688. // DizInfSetCol(dizInf, drwInf, elmSiz);
  689. DizInfSetCol(dizInf, &dizColInf, drwInf, elmSiz);
  690. dizCyn = dizInf->TblCyn;
  691. dizMgt = dizInf->TblMgt;
  692. dizYel = dizInf->TblYel;
  693. dizBla = dizInf->TblBla;
  694. linC00 = drwInf->LinBufCyn + drwInf->LinByt * drwInf->AllLinNum;
  695. linM00 = drwInf->LinBufMgt + drwInf->LinByt * drwInf->AllLinNum;
  696. linY00 = drwInf->LinBufYel + drwInf->LinByt * drwInf->AllLinNum;
  697. linK00 = drwInf->LinBufBla + drwInf->LinByt * drwInf->AllLinNum;
  698. xaxNrt = drwInf->XaxNrt; xaxDnt = drwInf->XaxDnt;
  699. yaxNrt = drwInf->YaxNrt; yaxDnt = drwInf->YaxDnt;
  700. src = drwInf->CmyBuf;
  701. // Check of zero divide 2002.3.23 >>>
  702. if ((xaxDnt == 0) || (yaxDnt == 0)) {
  703. ERR(("DizPrcC16() 0Div-Check [xaxDnt,yaxDnt=0] \n"));
  704. return;
  705. }
  706. // Check of zero divide 2002.3.23 <<<
  707. /****** Dithering main **************************************************/
  708. if ((xaxNrt == xaxDnt) && (yaxNrt == yaxDnt)) {
  709. /*===== Same size(Expansion/reduction no) ==========================*/
  710. for (yax = 0; yax < linNum; yax++) {
  711. /*..... Vertical axis movement .................................*/
  712. sft = 4;
  713. bytCyn = bytMgt = bytYel = bytBla = (BYTE)0x00;
  714. // dizCyn = DizCynCur;
  715. // dizMgt = DizMgtCur;
  716. // dizYel = DizYelCur;
  717. // dizBla = DizBlaCur;
  718. dizCyn = dizColInf.Cur.Cyn;
  719. dizMgt = dizColInf.Cur.Mgt;
  720. dizYel = dizColInf.Cur.Yel;
  721. dizBla = dizColInf.Cur.Bla;
  722. linByt = drwInf->LinByt;
  723. for (xax = 0; xax < drwInf->XaxSiz; xax++) {
  724. /*..... Horizontal axis movement ...........................*/
  725. /****** Dithering *******************************************/
  726. cmy = *src++;
  727. if (cmy.Cyn > *dizCyn) { // Cyan
  728. if (cmy.Cyn > *(dizCyn + 14)) bytCyn |= 0x0f << sft;
  729. else {
  730. min = 0; max = 13; mid = 7;
  731. while (min < max) {
  732. if (cmy.Cyn > *(dizCyn + mid)) min = mid;
  733. else max = mid - 1;
  734. mid = (min + max + 1) / 2;
  735. }
  736. bytCyn |= (mid + 1) << sft;
  737. }
  738. }
  739. if (cmy.Mgt > *dizMgt) { // Magenta
  740. if (cmy.Mgt > *(dizMgt + 14)) bytMgt |= 0x0f << sft;
  741. else {
  742. min = 0; max = 13; mid = 7;
  743. while (min < max) {
  744. if (cmy.Mgt > *(dizMgt + mid)) min = mid;
  745. else max = mid - 1;
  746. mid = (min + max + 1) / 2;
  747. }
  748. bytMgt |= (mid + 1) << sft;
  749. }
  750. }
  751. if (cmy.Yel > *dizYel) { // Yellow
  752. if (cmy.Yel > *(dizYel + 14)) bytYel |= 0x0f << sft;
  753. else {
  754. min = 0; max = 13; mid = 7;
  755. while (min < max) {
  756. if (cmy.Yel > *(dizYel + mid)) min = mid;
  757. else max = mid - 1;
  758. mid = (min + max + 1) / 2;
  759. }
  760. bytYel |= (mid + 1) << sft;
  761. }
  762. }
  763. if (cmy.Bla > *dizBla) { // Black
  764. if (cmy.Bla > *(dizBla + 14)) bytBla |= 0x0f << sft;
  765. else {
  766. min = 0; max = 13; mid = 7;
  767. while (min < max) {
  768. if (cmy.Bla > *(dizBla + mid)) min = mid;
  769. else max = mid - 1;
  770. mid = (min + max + 1) / 2;
  771. }
  772. bytBla |= (mid + 1) << sft;
  773. }
  774. }
  775. if (sft == 0) {
  776. if (linByt) {
  777. *linC00++ = bytCyn;
  778. *linM00++ = bytMgt;
  779. *linY00++ = bytYel;
  780. *linK00++ = bytBla;
  781. linByt--;
  782. }
  783. sft = 8;
  784. bytCyn = bytMgt = bytYel = bytBla = (BYTE)0x00;
  785. }
  786. sft-=4;
  787. dizCyn += elmSiz;
  788. dizMgt += elmSiz;
  789. dizYel += elmSiz;
  790. dizBla += elmSiz;
  791. // if (dizCyn == DizCynXep) dizCyn = DizCynXsp;
  792. // if (dizMgt == DizMgtXep) dizMgt = DizMgtXsp;
  793. // if (dizYel == DizYelXep) dizYel = DizYelXsp;
  794. // if (dizBla == DizBlaXep) dizBla = DizBlaXsp;
  795. if (dizCyn == dizColInf.Xep.Cyn) dizCyn = dizColInf.Xsp.Cyn;
  796. if (dizMgt == dizColInf.Xep.Mgt) dizMgt = dizColInf.Xsp.Mgt;
  797. if (dizYel == dizColInf.Xep.Yel) dizYel = dizColInf.Xsp.Yel;
  798. if (dizBla == dizColInf.Xep.Bla) dizBla = dizColInf.Xsp.Bla;
  799. }
  800. if (sft != 4) {
  801. if (linByt) {
  802. *linC00++ = bytCyn;
  803. *linM00++ = bytMgt;
  804. *linY00++ = bytYel;
  805. *linK00++ = bytBla;
  806. linByt--;
  807. }
  808. }
  809. while (linByt) {
  810. *linC00++ = (BYTE)0x00;
  811. *linM00++ = (BYTE)0x00;
  812. *linY00++ = (BYTE)0x00;
  813. *linK00++ = (BYTE)0x00;
  814. linByt--;
  815. }
  816. // DizInfChgCol(dizInf); // Dithering information renewal(Y)
  817. DizInfChgCol(dizInf, &dizColInf); // Dithering information renewal(Y)
  818. drwInf->YaxOfs += 1;
  819. drwInf->StrYax += 1;
  820. drwInf->AllLinNum += 1;
  821. }
  822. return;
  823. }
  824. /*===== Expansion/reduction ============================================*/
  825. amrXax000 = amrXax = (LONG)(drwInf->XaxOfs) * xaxNrt % xaxDnt;
  826. amrYax = (LONG)(drwInf->YaxOfs) * yaxNrt % yaxDnt;
  827. for (yax = 0; yax < linNum; yax++) {
  828. /*..... Vertical axis movement .....................................*/
  829. srcPtr = src;
  830. for (amrYax += yaxNrt; ((amrYax >= yaxDnt) || (amrYax < 0));
  831. amrYax -= yaxDnt) { //Magnification set for vertical
  832. amrXax = amrXax000;
  833. sft = 4;
  834. bytCyn = bytMgt = bytYel = bytBla = (BYTE)0x00;
  835. // dizCyn = DizCynCur;
  836. // dizMgt = DizMgtCur;
  837. // dizYel = DizYelCur;
  838. // dizBla = DizBlaCur;
  839. dizCyn = dizColInf.Cur.Cyn;
  840. dizMgt = dizColInf.Cur.Mgt;
  841. dizYel = dizColInf.Cur.Yel;
  842. dizBla = dizColInf.Cur.Bla;
  843. src = srcPtr;
  844. linByt = drwInf->LinByt;
  845. for (xax = 0; xax < drwInf->XaxSiz; xax++) {
  846. /*..... Horizontal axis movement ...........................*/
  847. cmy = *src++;
  848. for (amrXax += xaxNrt; ((amrXax >= xaxDnt) || (amrXax < 0));
  849. amrXax -= xaxDnt) { // Magnification set for Horizontal
  850. /****** Dithering ***************************************/
  851. if (cmy.Cyn > *dizCyn) { // Cyan
  852. if (cmy.Cyn > *(dizCyn + 14)) bytCyn |= 0x0f << sft;
  853. else {
  854. min = 0; max = 13; mid = 7;
  855. while (min < max) {
  856. if (cmy.Cyn > *(dizCyn + mid)) min = mid;
  857. else max = mid - 1;
  858. mid = (min + max + 1) / 2;
  859. }
  860. bytCyn |= (mid + 1) << sft;
  861. }
  862. }
  863. if (cmy.Mgt > *dizMgt) { // Magenta
  864. if (cmy.Mgt > *(dizMgt + 14)) bytMgt |= 0x0f << sft;
  865. else {
  866. min = 0; max = 13; mid = 7;
  867. while (min < max) {
  868. if (cmy.Mgt > *(dizMgt + mid)) min = mid;
  869. else max = mid - 1;
  870. mid = (min + max + 1) / 2;
  871. }
  872. bytMgt |= (mid + 1) << sft;
  873. }
  874. }
  875. if (cmy.Yel > *dizYel) { // Yellow
  876. if (cmy.Yel > *(dizYel + 14)) bytYel |= 0x0f << sft;
  877. else {
  878. min = 0; max = 13; mid = 7;
  879. while (min < max) {
  880. if (cmy.Yel > *(dizYel + mid)) min = mid;
  881. else max = mid - 1;
  882. mid = (min + max + 1) / 2;
  883. }
  884. bytYel |= (mid + 1) << sft;
  885. }
  886. }
  887. if (cmy.Bla > *dizBla) { // Black
  888. if (cmy.Bla > *(dizBla + 14)) bytBla |= 0x0f << sft;
  889. else {
  890. min = 0; max = 13; mid = 7;
  891. while (min < max) {
  892. if (cmy.Bla > *(dizBla + mid)) min = mid;
  893. else max = mid - 1;
  894. mid = (min + max + 1) / 2;
  895. }
  896. bytBla |= (mid + 1) << sft;
  897. }
  898. }
  899. if (sft == 0) {
  900. if (linByt) {
  901. *linC00++ = bytCyn;
  902. *linM00++ = bytMgt;
  903. *linY00++ = bytYel;
  904. *linK00++ = bytBla;
  905. linByt--;
  906. }
  907. sft = 8;
  908. bytCyn = bytMgt = bytYel = bytBla = (BYTE)0x00;
  909. }
  910. sft-=4;
  911. dizCyn += elmSiz;
  912. dizMgt += elmSiz;
  913. dizYel += elmSiz;
  914. dizBla += elmSiz;
  915. // if (dizCyn == DizCynXep) dizCyn = DizCynXsp;
  916. // if (dizMgt == DizMgtXep) dizMgt = DizMgtXsp;
  917. // if (dizYel == DizYelXep) dizYel = DizYelXsp;
  918. // if (dizBla == DizBlaXep) dizBla = DizBlaXsp;
  919. if (dizCyn == dizColInf.Xep.Cyn) dizCyn = dizColInf.Xsp.Cyn;
  920. if (dizMgt == dizColInf.Xep.Mgt) dizMgt = dizColInf.Xsp.Mgt;
  921. if (dizYel == dizColInf.Xep.Yel) dizYel = dizColInf.Xsp.Yel;
  922. if (dizBla == dizColInf.Xep.Bla) dizBla = dizColInf.Xsp.Bla;
  923. }
  924. }
  925. if (sft != 4) {
  926. if (linByt) {
  927. *linC00++ = bytCyn;
  928. *linM00++ = bytMgt;
  929. *linY00++ = bytYel;
  930. *linK00++ = bytBla;
  931. linByt--;
  932. }
  933. }
  934. while (linByt) {
  935. *linC00++ = (BYTE)0x00;
  936. *linM00++ = (BYTE)0x00;
  937. *linY00++ = (BYTE)0x00;
  938. *linK00++ = (BYTE)0x00;
  939. linByt--;
  940. }
  941. // DizInfChgCol(dizInf); // Dithering information renewal(Y)
  942. DizInfChgCol(dizInf, &dizColInf); // Dithering information renewal(Y)
  943. drwInf->StrYax += 1;
  944. drwInf->AllLinNum += 1;
  945. }
  946. drwInf->YaxOfs += 1;
  947. }
  948. return;
  949. }
  950. #endif
  951. //---------------------------------------------------------------------------------------------------
  952. // Dithering (mono 2value)
  953. //---------------------------------------------------------------------------------------------------
  954. static VOID DizPrcM02( // Return value no
  955. LPDIZINF dizInf, // Fixation dithering information
  956. LPDRWINF drwInf, // Drawing information
  957. DWORD linNum // Source data line number
  958. )
  959. {
  960. LPCMYK src;
  961. BYTE wrtPix;
  962. BYTE bytBla;
  963. CMYK cmy;
  964. LPBYTE dizBla;
  965. LPBYTE linK00;
  966. DWORD xax, yax;
  967. LPCMYK srcPtr;
  968. LONG xaxNrt, xaxDnt, yaxNrt, yaxDnt;
  969. LONG amrXax, amrYax, amrXax000;
  970. DWORD elmSiz, linByt;
  971. DIZCOLINF dizColInf;
  972. elmSiz = 1;
  973. // DizInfSetMon(dizInf, drwInf, elmSiz);
  974. DizInfSetMon(dizInf, &dizColInf, drwInf, elmSiz);
  975. dizBla = dizInf->TblBla;
  976. linK00 = drwInf->LinBufBla + drwInf->LinByt * drwInf->AllLinNum;
  977. xaxNrt = drwInf->XaxNrt; xaxDnt = drwInf->XaxDnt;
  978. yaxNrt = drwInf->YaxNrt; yaxDnt = drwInf->YaxDnt;
  979. src = drwInf->CmyBuf;
  980. // Check of zero divide 2002.3.23 >>>
  981. if ((xaxDnt == 0) || (yaxDnt == 0)) {
  982. ERR(("DizPrcM02() 0Div-Check [xaxDnt,yaxDnt=0] \n"));
  983. return;
  984. }
  985. // Check of zero divide 2002.3.23 <<<
  986. /****** Dithering main **************************************************/
  987. if ((xaxNrt == xaxDnt) && (yaxNrt == yaxDnt)) {
  988. /*===== Same size(Expansion/reduction no) ==========================*/
  989. for (yax = 0; yax < linNum; yax++) {
  990. /*..... Vertical axis movement .................................*/
  991. wrtPix = (BYTE)0x80;
  992. bytBla = (BYTE)0x00;
  993. // dizBla = DizBlaCur;
  994. dizBla = dizColInf.Cur.Bla;
  995. linByt = drwInf->LinByt;
  996. for (xax = 0; xax < drwInf->XaxSiz; xax++) {
  997. /*..... Horizontal axis movement ...........................*/
  998. /****** Dithering *******************************************/
  999. cmy = *src++;
  1000. if (cmy.Bla > *dizBla++) bytBla |= wrtPix; // Black
  1001. if (!(wrtPix >>= 1)) {
  1002. if (linByt) {
  1003. *linK00++ = bytBla;
  1004. linByt--;
  1005. }
  1006. wrtPix = (BYTE)0x80;
  1007. bytBla = (BYTE)0x00;
  1008. }
  1009. // if (dizBla == DizBlaXep) dizBla = DizBlaXsp;
  1010. if (dizBla == dizColInf.Xep.Bla) dizBla = dizColInf.Xsp.Bla;
  1011. }
  1012. if (wrtPix != 0x80) {
  1013. if (linByt) {
  1014. *linK00++ = bytBla;
  1015. linByt--;
  1016. }
  1017. }
  1018. while (linByt) {
  1019. *linK00++ = (BYTE)0x00;
  1020. linByt--;
  1021. }
  1022. // DizInfChgMon(dizInf); // Dithering information renewal(Y)
  1023. DizInfChgMon(dizInf, &dizColInf); // Dithering information renewal(Y)
  1024. drwInf->YaxOfs += 1;
  1025. drwInf->StrYax += 1;
  1026. drwInf->AllLinNum += 1;
  1027. }
  1028. return;
  1029. }
  1030. /*===== Expansion/reduction ============================================*/
  1031. amrXax000 = amrXax = (LONG)(drwInf->XaxOfs) * xaxNrt % xaxDnt;
  1032. amrYax = (LONG)(drwInf->YaxOfs) * yaxNrt % yaxDnt;
  1033. for (yax = 0; yax < linNum; yax++) {
  1034. /*..... Vertical axis movement .....................................*/
  1035. srcPtr = src;
  1036. for (amrYax += yaxNrt; ((amrYax >= yaxDnt) || (amrYax < 0));
  1037. amrYax -= yaxDnt) { // Magnification set for vertical
  1038. amrXax = amrXax000;
  1039. wrtPix = (BYTE)0x80;
  1040. bytBla = (BYTE)0x00;
  1041. // dizBla = DizBlaCur;
  1042. dizBla = dizColInf.Cur.Bla;
  1043. src = srcPtr;
  1044. linByt = drwInf->LinByt;
  1045. for (xax = 0; xax < drwInf->XaxSiz; xax++) {
  1046. /*..... Horizontal axis movement ...........................*/
  1047. cmy = *src++;
  1048. for (amrXax += xaxNrt; ((amrXax >= xaxDnt) || (amrXax < 0));
  1049. amrXax -= xaxDnt) { // Magnification set for Horizontal
  1050. /****** Dithering ***************************************/
  1051. if (cmy.Bla > *dizBla++) bytBla |= wrtPix; // Black
  1052. if (!(wrtPix >>= 1)) {
  1053. if (linByt) {
  1054. *linK00++ = bytBla;
  1055. linByt--;
  1056. }
  1057. wrtPix = (BYTE)0x80;
  1058. bytBla = (BYTE)0x00;
  1059. }
  1060. // if (dizBla == DizBlaXep) dizBla = DizBlaXsp;
  1061. if (dizBla == dizColInf.Xep.Bla) dizBla = dizColInf.Xsp.Bla;
  1062. }
  1063. }
  1064. if (wrtPix != 0x80) {
  1065. if (linByt) {
  1066. *linK00++ = bytBla;
  1067. linByt--;
  1068. }
  1069. }
  1070. while (linByt) {
  1071. *linK00++ = (BYTE)0x00;
  1072. linByt--;
  1073. }
  1074. // DizInfChgMon(dizInf); // Dithering information renewal(Y)
  1075. DizInfChgMon(dizInf, &dizColInf); // Dithering information renewal(Y)
  1076. drwInf->StrYax += 1;
  1077. drwInf->AllLinNum += 1;
  1078. }
  1079. drwInf->YaxOfs += 1;
  1080. }
  1081. return;
  1082. }
  1083. //---------------------------------------------------------------------------------------------------
  1084. // Dithering (mono 4value)
  1085. //---------------------------------------------------------------------------------------------------
  1086. #if !defined(CP80W9X) // CP-E8000 is invalid
  1087. static VOID DizPrcM04( // Return value no
  1088. LPDIZINF dizInf, // Fixation dithering information
  1089. LPDRWINF drwInf, // Drawing information
  1090. DWORD linNum // Source data line number
  1091. )
  1092. {
  1093. LPCMYK src;
  1094. BYTE wrtPix004, wrtPix008, wrtPix00c;
  1095. BYTE bytBla;
  1096. CMYK cmy;
  1097. LPBYTE dizBla;
  1098. LPBYTE linK00;
  1099. DWORD xax, yax;
  1100. LPCMYK srcPtr;
  1101. LONG xaxNrt, xaxDnt, yaxNrt, yaxDnt;
  1102. LONG amrXax, amrYax, amrXax000;
  1103. DWORD elmSiz, linByt;
  1104. DIZCOLINF dizColInf;
  1105. elmSiz = 3;
  1106. // DizInfSetMon(dizInf, drwInf, elmSiz);
  1107. DizInfSetMon(dizInf, &dizColInf, drwInf, elmSiz);
  1108. dizBla = dizInf->TblBla;
  1109. linK00 = drwInf->LinBufBla + drwInf->LinByt * drwInf->AllLinNum;
  1110. xaxNrt = drwInf->XaxNrt; xaxDnt = drwInf->XaxDnt;
  1111. yaxNrt = drwInf->YaxNrt; yaxDnt = drwInf->YaxDnt;
  1112. src = drwInf->CmyBuf;
  1113. // Check of zero divide 2002.3.23 >>>
  1114. if ((xaxDnt == 0) || (yaxDnt == 0)) {
  1115. ERR(("DizPrcM04() 0Div-Check [xaxDnt,yaxDnt=0] \n"));
  1116. return;
  1117. }
  1118. // Check of zero divide 2002.3.23 <<<
  1119. /****** Dithering main **************************************************/
  1120. if ((xaxNrt == xaxDnt) && (yaxNrt == yaxDnt)) {
  1121. /*===== Same size(Expansion/reduction no) ==========================*/
  1122. for (yax = 0; yax < linNum; yax++) {
  1123. /*..... Vertical axis movement .................................*/
  1124. wrtPix004 = (BYTE)0x40;
  1125. wrtPix008 = (BYTE)0x80;
  1126. wrtPix00c = (BYTE)0xc0;
  1127. bytBla = (BYTE)0x00;
  1128. // dizBla = DizBlaCur;
  1129. dizBla = dizColInf.Cur.Bla;
  1130. linByt = drwInf->LinByt;
  1131. for (xax = 0; xax < drwInf->XaxSiz; xax++) {
  1132. /*..... Horizontal axis movement ...........................*/
  1133. /****** Dithering *******************************************/
  1134. cmy = *src++;
  1135. if (cmy.Bla > *dizBla) { // Black
  1136. if (cmy.Bla > *(dizBla + 2)) bytBla |= wrtPix00c;
  1137. else if (cmy.Bla > *(dizBla + 1)) bytBla |= wrtPix008;
  1138. else bytBla |= wrtPix004;
  1139. }
  1140. wrtPix00c >>= 2; wrtPix008 >>= 2; wrtPix004 >>= 2;
  1141. if (!wrtPix004) {
  1142. if (linByt) {
  1143. *linK00++ = bytBla;
  1144. linByt--;
  1145. }
  1146. wrtPix004 = (BYTE)0x40;
  1147. wrtPix008 = (BYTE)0x80;
  1148. wrtPix00c = (BYTE)0xc0;
  1149. bytBla = (BYTE)0x00;
  1150. }
  1151. dizBla += elmSiz;
  1152. // if (dizBla == DizBlaXep) dizBla = DizBlaXsp;
  1153. if (dizBla == dizColInf.Xep.Bla) dizBla = dizColInf.Xsp.Bla;
  1154. }
  1155. if (wrtPix004 != 0x40) {
  1156. if (linByt) {
  1157. *linK00++ = bytBla;
  1158. linByt--;
  1159. }
  1160. }
  1161. while (linByt) {
  1162. *linK00++ = (BYTE)0x00;
  1163. linByt--;
  1164. }
  1165. // DizInfChgMon(dizInf); // Dithering information renewal(Y)
  1166. DizInfChgMon(dizInf, &dizColInf); // Dithering information renewal(Y)
  1167. drwInf->YaxOfs += 1;
  1168. drwInf->StrYax += 1;
  1169. drwInf->AllLinNum += 1;
  1170. }
  1171. return;
  1172. }
  1173. /*===== Expansion/reduction ============================================*/
  1174. amrXax000 = amrXax = (LONG)(drwInf->XaxOfs) * xaxNrt % xaxDnt;
  1175. amrYax = (LONG)(drwInf->YaxOfs) * yaxNrt % yaxDnt;
  1176. for (yax = 0; yax < linNum; yax++) {
  1177. /*..... Vertical axis movement .....................................*/
  1178. srcPtr = src;
  1179. for (amrYax += yaxNrt; ((amrYax >= yaxDnt) || (amrYax < 0));
  1180. amrYax -= yaxDnt) { // Magnification set for vertical
  1181. amrXax = amrXax000;
  1182. wrtPix004 = (BYTE)0x40;
  1183. wrtPix008 = (BYTE)0x80;
  1184. wrtPix00c = (BYTE)0xc0;
  1185. bytBla = (BYTE)0x00;
  1186. // dizBla = DizBlaCur;
  1187. dizBla = dizColInf.Cur.Bla;
  1188. src = srcPtr;
  1189. linByt = drwInf->LinByt;
  1190. for (xax = 0; xax < drwInf->XaxSiz; xax++) {
  1191. /*..... Horizontal axis movement ...........................*/
  1192. cmy = *src++;
  1193. for (amrXax += xaxNrt; ((amrXax >= xaxDnt) || (amrXax < 0));
  1194. amrXax -= xaxDnt) { // Magnification set for Horizontal
  1195. /****** Dithering ***************************************/
  1196. if (cmy.Bla > *dizBla) { /* Black */
  1197. if (cmy.Bla > *(dizBla + 2)) bytBla |= wrtPix00c;
  1198. else if (cmy.Bla > *(dizBla + 1)) bytBla |= wrtPix008;
  1199. else bytBla |= wrtPix004;
  1200. }
  1201. wrtPix00c >>= 2; wrtPix008 >>= 2; wrtPix004 >>= 2;
  1202. if (!wrtPix004) {
  1203. if (linByt) {
  1204. *linK00++ = bytBla;
  1205. linByt--;
  1206. }
  1207. wrtPix004 = (BYTE)0x40;
  1208. wrtPix008 = (BYTE)0x80;
  1209. wrtPix00c = (BYTE)0xc0;
  1210. bytBla = (BYTE)0x00;
  1211. }
  1212. dizBla += elmSiz;
  1213. // if (dizBla == DizBlaXep) dizBla = DizBlaXsp;
  1214. if (dizBla == dizColInf.Xep.Bla) dizBla = dizColInf.Xsp.Bla;
  1215. }
  1216. }
  1217. if (wrtPix004 != 0x40) {
  1218. if (linByt) {
  1219. *linK00++ = bytBla;
  1220. linByt--;
  1221. }
  1222. }
  1223. while (linByt) {
  1224. *linK00++ = (BYTE)0x00;
  1225. linByt--;
  1226. }
  1227. // DizInfChgMon(dizInf); // Dithering information renewal(Y)
  1228. DizInfChgMon(dizInf, &dizColInf); // Dithering information renewal(Y)
  1229. drwInf->StrYax += 1;
  1230. drwInf->AllLinNum += 1;
  1231. }
  1232. drwInf->YaxOfs += 1;
  1233. }
  1234. return;
  1235. }
  1236. #endif
  1237. //---------------------------------------------------------------------------------------------------
  1238. // Dithering (mono 16value)
  1239. //---------------------------------------------------------------------------------------------------
  1240. #if !defined(CP80W9X) // CP-E8000 is invalid
  1241. static VOID DizPrcM16( // Return value no
  1242. LPDIZINF dizInf, // Fixation dithering information
  1243. LPDRWINF drwInf, // Drawing information
  1244. DWORD linNum // Source data line number
  1245. )
  1246. {
  1247. LPCMYK src;
  1248. DWORD sft;
  1249. BYTE min, max, mid;
  1250. BYTE bytBla;
  1251. CMYK cmy;
  1252. LPBYTE dizBla;
  1253. LPBYTE linK00;
  1254. DWORD xax, yax;
  1255. LPCMYK srcPtr;
  1256. LONG xaxNrt, xaxDnt, yaxNrt, yaxDnt;
  1257. LONG amrXax, amrYax, amrXax000;
  1258. DWORD elmSiz, linByt;
  1259. DIZCOLINF dizColInf;
  1260. elmSiz = 15;
  1261. // DizInfSetMon(dizInf, drwInf, elmSiz);
  1262. DizInfSetMon(dizInf, &dizColInf, drwInf, elmSiz);
  1263. dizBla = dizInf->TblBla;
  1264. linK00 = drwInf->LinBufBla + drwInf->LinByt * drwInf->AllLinNum;
  1265. xaxNrt = drwInf->XaxNrt; xaxDnt = drwInf->XaxDnt;
  1266. yaxNrt = drwInf->YaxNrt; yaxDnt = drwInf->YaxDnt;
  1267. src = drwInf->CmyBuf;
  1268. // Check of zero divide 2002.3.23 >>>
  1269. if ((xaxDnt == 0) || (yaxDnt == 0)) {
  1270. ERR(("DizPrcM04() 0Div-Check [xaxDnt,yaxDnt=0] \n"));
  1271. return;
  1272. }
  1273. // Check of zero divide 2002.3.23 <<<
  1274. /****** Dithering main **************************************************/
  1275. if ((xaxNrt == xaxDnt) && (yaxNrt == yaxDnt)) {
  1276. /*===== Same size(Expansion/reduction no) ==========================*/
  1277. for (yax = 0; yax < linNum; yax++) {
  1278. /*..... Vertical axis movement .................................*/
  1279. sft = 4;
  1280. bytBla = (BYTE)0x00;
  1281. // dizBla = DizBlaCur;
  1282. dizBla = dizColInf.Cur.Bla;
  1283. linByt = drwInf->LinByt;
  1284. for (xax = 0; xax < drwInf->XaxSiz; xax++) {
  1285. /*..... Horizontal axis movement ...........................*/
  1286. /****** Dithering *******************************************/
  1287. cmy = *src++;
  1288. if (cmy.Bla > *dizBla) { // Black
  1289. if (cmy.Bla > *(dizBla + 14)) bytBla |= 0x0f << sft;
  1290. else {
  1291. min = 0; max = 13; mid = 7;
  1292. while (min < max) {
  1293. if (cmy.Bla > *(dizBla + mid)) min = mid;
  1294. else max = mid - 1;
  1295. mid = (min + max + 1) / 2;
  1296. }
  1297. bytBla |= (mid + 1) << sft;
  1298. }
  1299. }
  1300. if (sft == 0) {
  1301. if (linByt) {
  1302. *linK00++ = bytBla;
  1303. linByt--;
  1304. }
  1305. sft = 8;
  1306. bytBla = (BYTE)0x00;
  1307. }
  1308. sft-=4;
  1309. dizBla += elmSiz;
  1310. // if (dizBla == DizBlaXep) dizBla = DizBlaXsp;
  1311. if (dizBla == dizColInf.Xep.Bla) dizBla = dizColInf.Xsp.Bla;
  1312. }
  1313. if (sft != 4) {
  1314. if (linByt) {
  1315. *linK00++ = bytBla;
  1316. linByt--;
  1317. }
  1318. }
  1319. while (linByt) {
  1320. *linK00++ = (BYTE)0x00;
  1321. linByt--;
  1322. }
  1323. // DizInfChgMon(dizInf); // Dithering information renewal(Y)
  1324. DizInfChgMon(dizInf, &dizColInf); // Dithering information renewal(Y)
  1325. drwInf->StrYax += 1;
  1326. drwInf->AllLinNum += 1;
  1327. }
  1328. return;
  1329. }
  1330. /*===== Expansion/reduction ============================================*/
  1331. amrXax000 = amrXax = (LONG)(drwInf->XaxOfs) * xaxNrt % xaxDnt;
  1332. amrYax = (LONG)(drwInf->YaxOfs) * yaxNrt % yaxDnt;
  1333. for (yax = 0; yax < linNum; yax++) {
  1334. /*..... Vertical axis movement .....................................*/
  1335. srcPtr = src;
  1336. for (amrYax += yaxNrt; ((amrYax >= yaxDnt) || (amrYax < 0));
  1337. amrYax -= yaxDnt) { // Magnification set for vertical
  1338. amrXax = amrXax000;
  1339. sft = 4;
  1340. bytBla = (BYTE)0x00;
  1341. // dizBla = DizBlaCur;
  1342. dizBla = dizColInf.Cur.Bla;
  1343. src = srcPtr;
  1344. linByt = drwInf->LinByt;
  1345. for (xax = 0; xax < drwInf->XaxSiz; xax++) {
  1346. /*..... Horizontal axis movement ...........................*/
  1347. cmy = *src++;
  1348. for (amrXax += xaxNrt; ((amrXax >= xaxDnt) || (amrXax < 0));
  1349. amrXax -= xaxDnt) { // Magnification set for Horizontal
  1350. /****** Dithering ***************************************/
  1351. if (cmy.Bla > *dizBla) { // Black
  1352. if (cmy.Bla > *(dizBla + 14)) bytBla |= 0x0f << sft;
  1353. else {
  1354. min = 0; max = 13; mid = 7;
  1355. while (min < max) {
  1356. if (cmy.Bla > *(dizBla + mid)) min = mid;
  1357. else max = mid - 1;
  1358. mid = (min + max + 1) / 2;
  1359. }
  1360. bytBla |= (mid + 1) << sft;
  1361. }
  1362. }
  1363. if (sft == 0) {
  1364. if (linByt) {
  1365. *linK00++ = bytBla;
  1366. linByt--;
  1367. }
  1368. sft = 8;
  1369. bytBla = (BYTE)0x00;
  1370. }
  1371. sft-=4;
  1372. dizBla += elmSiz;
  1373. // if (dizBla == DizBlaXep) dizBla = DizBlaXsp;
  1374. if (dizBla == dizColInf.Xep.Bla) dizBla = dizColInf.Xsp.Bla;
  1375. }
  1376. }
  1377. if (sft != 4) {
  1378. if (linByt) {
  1379. *linK00++ = bytBla;
  1380. linByt--;
  1381. }
  1382. }
  1383. while (linByt) {
  1384. *linK00++ = (BYTE)0x00;
  1385. linByt--;
  1386. }
  1387. // DizInfChgMon(dizInf); // Dithering information renewal(Y)
  1388. DizInfChgMon(dizInf, &dizColInf); // Dithering information renewal(Y)
  1389. drwInf->StrYax += 1;
  1390. drwInf->AllLinNum += 1;
  1391. }
  1392. drwInf->YaxOfs += 1;
  1393. }
  1394. return;
  1395. }
  1396. #endif
  1397. //---------------------------------------------------------------------------------------------------
  1398. // Dithering information set (color)
  1399. //---------------------------------------------------------------------------------------------------
  1400. #if !defined(CP80W9X) // CP-E8000 is invalid
  1401. static VOID DizInfSetCol( // Return value no
  1402. LPDIZINF dizInf, // Fixation dithering information
  1403. LPDIZCOLINF dizColInf, // Dithering information (each color)
  1404. LPDRWINF drwInf, // Drawing information
  1405. DWORD elmSiz // Threshold (per 1pixel)
  1406. )
  1407. {
  1408. DWORD dizSiz, dzx, dzy;
  1409. LPBYTE diz;
  1410. // Check of zero divide 2002.3.23 >>>
  1411. if ((dizInf->SizCyn == 0) || (dizInf->SizMgt == 0) ||
  1412. (dizInf->SizYel == 0) || (dizInf->SizBla == 0)) {
  1413. ERR(("DizInfSetCol() 0Div-Check [dizInf->SizCyn,SizMgt,SizYel,SizBla=0] \n"));
  1414. return;
  1415. }
  1416. // Check of zero divide 2002.3.23 <<<
  1417. // dizSiz = dizInf->SizCyn; DizCynDYY = dizSiz * elmSiz;
  1418. dizSiz = dizInf->SizCyn; dizColInf->DYY.Cyn = dizSiz * elmSiz;
  1419. dzx = ((drwInf->StrXax) % dizSiz) * elmSiz;
  1420. // dzy = ((drwInf->StrYax) % dizSiz) * DizCynDYY;
  1421. dzy = ((drwInf->StrYax) % dizSiz) * dizColInf->DYY.Cyn;
  1422. diz = dizInf->TblCyn;
  1423. // DizCynCur = diz + dzy + dzx;
  1424. // DizCynXsp = diz + dzy; DizCynXep = DizCynXsp + DizCynDYY;
  1425. // DizCynYsp = diz + dzx; DizCynYep = DizCynYsp + dizSiz * DizCynDYY;
  1426. dizColInf->Cur.Cyn = diz + dzy + dzx;
  1427. dizColInf->Xsp.Cyn = diz + dzy; dizColInf->Xep.Cyn = dizColInf->Xsp.Cyn + dizColInf->DYY.Cyn;
  1428. dizColInf->Ysp.Cyn = diz + dzx; dizColInf->Yep.Cyn = dizColInf->Ysp.Cyn + dizSiz * dizColInf->DYY.Cyn;
  1429. // dizSiz = dizInf->SizMgt; DizMgtDYY = dizSiz * elmSiz;
  1430. dizSiz = dizInf->SizMgt; dizColInf->DYY.Mgt = dizSiz * elmSiz;
  1431. dzx = ((drwInf->StrXax) % dizSiz) * elmSiz;
  1432. // dzy = ((drwInf->StrYax) % dizSiz) * DizMgtDYY;
  1433. dzy = ((drwInf->StrYax) % dizSiz) * dizColInf->DYY.Mgt;
  1434. diz = dizInf->TblMgt;
  1435. // DizMgtCur = diz + dzy + dzx;
  1436. // DizMgtXsp = diz + dzy; DizMgtXep = DizMgtXsp + DizMgtDYY;
  1437. // DizMgtYsp = diz + dzx; DizMgtYep = DizMgtYsp + dizSiz * DizMgtDYY;
  1438. dizColInf->Cur.Mgt = diz + dzy + dzx;
  1439. dizColInf->Xsp.Mgt = diz + dzy; dizColInf->Xep.Mgt = dizColInf->Xsp.Mgt + dizColInf->DYY.Mgt;
  1440. dizColInf->Ysp.Mgt = diz + dzx; dizColInf->Yep.Mgt = dizColInf->Ysp.Mgt + dizSiz * dizColInf->DYY.Mgt;
  1441. // dizSiz = dizInf->SizYel; DizYelDYY = dizSiz * elmSiz;
  1442. dizSiz = dizInf->SizYel; dizColInf->DYY.Yel = dizSiz * elmSiz;
  1443. dzx = ((drwInf->StrXax) % dizSiz) * elmSiz;
  1444. // dzy = ((drwInf->StrYax) % dizSiz) * DizYelDYY;
  1445. dzy = ((drwInf->StrYax) % dizSiz) * dizColInf->DYY.Yel;
  1446. diz = dizInf->TblYel;
  1447. // DizYelCur = diz + dzy + dzx;
  1448. // DizYelXsp = diz + dzy; DizYelXep = DizYelXsp + DizYelDYY;
  1449. // DizYelYsp = diz + dzx; DizYelYep = DizYelYsp + dizSiz * DizYelDYY;
  1450. dizColInf->Cur.Yel = diz + dzy + dzx;
  1451. dizColInf->Xsp.Yel = diz + dzy; dizColInf->Xep.Yel = dizColInf->Xsp.Yel + dizColInf->DYY.Yel;
  1452. dizColInf->Ysp.Yel = diz + dzx; dizColInf->Yep.Yel = dizColInf->Ysp.Yel + dizSiz * dizColInf->DYY.Yel;
  1453. // dizSiz = dizInf->SizBla; DizBlaDYY = dizSiz * elmSiz;
  1454. dizSiz = dizInf->SizBla; dizColInf->DYY.Bla = dizSiz * elmSiz;
  1455. dzx = ((drwInf->StrXax) % dizSiz) * elmSiz;
  1456. // dzy = ((drwInf->StrYax) % dizSiz) * DizBlaDYY;
  1457. dzy = ((drwInf->StrYax) % dizSiz) * dizColInf->DYY.Bla;
  1458. diz = dizInf->TblBla;
  1459. // DizBlaCur = diz + dzy + dzx;
  1460. // DizBlaXsp = diz + dzy; DizBlaXep = DizBlaXsp + DizBlaDYY;
  1461. // DizBlaYsp = diz + dzx; DizBlaYep = DizBlaYsp + dizSiz * DizBlaDYY;
  1462. dizColInf->Cur.Bla = diz + dzy + dzx;
  1463. dizColInf->Xsp.Bla = diz + dzy; dizColInf->Xep.Bla = dizColInf->Xsp.Bla + dizColInf->DYY.Bla;
  1464. dizColInf->Ysp.Bla = diz + dzx; dizColInf->Yep.Bla = dizColInf->Ysp.Bla + dizSiz * dizColInf->DYY.Bla;
  1465. return;
  1466. }
  1467. #endif
  1468. //---------------------------------------------------------------------------------------------------
  1469. // Dithering information set (monochrome)
  1470. //---------------------------------------------------------------------------------------------------
  1471. static VOID DizInfSetMon( // Return value no
  1472. LPDIZINF dizInf, // Fixation dithering information
  1473. LPDIZCOLINF dizColInf, // Dithering information (each color)
  1474. LPDRWINF drwInf, // Drawing information
  1475. DWORD elmSiz // Threshold (per 1pixel)
  1476. )
  1477. {
  1478. DWORD dizSiz, dzx, dzy;
  1479. LPBYTE diz;
  1480. // Check of zero divide 2002.3.23 >>>
  1481. if (dizInf->SizBla == 0) {
  1482. ERR(("DizInfSetMon() 0Div-Check [dizInf->SizBla=0] \n"));
  1483. return;
  1484. }
  1485. // Check of zero divide 2002.3.23 <<<
  1486. // dizSiz = dizInf->SizBla; DizBlaDYY = dizSiz * elmSiz;
  1487. dizSiz = dizInf->SizBla; dizColInf->DYY.Bla = dizSiz * elmSiz;
  1488. dzx = ((drwInf->StrXax) % dizSiz) * elmSiz;
  1489. // dzy = ((drwInf->StrYax) % dizSiz) * DizBlaDYY;
  1490. dzy = ((drwInf->StrYax) % dizSiz) * dizColInf->DYY.Bla;
  1491. diz = dizInf->TblBla;
  1492. // DizBlaCur = diz + dzy + dzx;
  1493. // DizBlaXsp = diz + dzy; DizBlaXep = DizBlaXsp + DizBlaDYY;
  1494. // DizBlaYsp = diz + dzx; DizBlaYep = DizBlaYsp + dizSiz * DizBlaDYY;
  1495. dizColInf->Cur.Bla = diz + dzy + dzx;
  1496. dizColInf->Xsp.Bla = diz + dzy; dizColInf->Xep.Bla = dizColInf->Xsp.Bla + dizColInf->DYY.Bla;
  1497. dizColInf->Ysp.Bla = diz + dzx; dizColInf->Yep.Bla = dizColInf->Ysp.Bla + dizSiz * dizColInf->DYY.Bla;
  1498. return;
  1499. }
  1500. //---------------------------------------------------------------------------------------------------
  1501. // Dithering information renewal (color)
  1502. //---------------------------------------------------------------------------------------------------
  1503. #if !defined(CP80W9X) // CP-E8000 is invalid
  1504. static VOID DizInfChgCol( // Return value no
  1505. LPDIZINF dizInf, // Fixation dithering information
  1506. LPDIZCOLINF dizColInf // Dithering information (each color)
  1507. )
  1508. {
  1509. // DizCynCur += DizCynDYY; DizCynXsp += DizCynDYY; DizCynXep += DizCynDYY;
  1510. dizColInf->Cur.Cyn += dizColInf->DYY.Cyn;
  1511. dizColInf->Xsp.Cyn += dizColInf->DYY.Cyn;
  1512. dizColInf->Xep.Cyn += dizColInf->DYY.Cyn;
  1513. // DizMgtCur += DizMgtDYY; DizMgtXsp += DizMgtDYY; DizMgtXep += DizMgtDYY;
  1514. dizColInf->Cur.Mgt += dizColInf->DYY.Mgt;
  1515. dizColInf->Xsp.Mgt += dizColInf->DYY.Mgt;
  1516. dizColInf->Xep.Mgt += dizColInf->DYY.Mgt;
  1517. // DizYelCur += DizYelDYY; DizYelXsp += DizYelDYY; DizYelXep += DizYelDYY;
  1518. dizColInf->Cur.Yel += dizColInf->DYY.Yel;
  1519. dizColInf->Xsp.Yel += dizColInf->DYY.Yel;
  1520. dizColInf->Xep.Yel += dizColInf->DYY.Yel;
  1521. // DizBlaCur += DizBlaDYY; DizBlaXsp += DizBlaDYY; DizBlaXep += DizBlaDYY;
  1522. dizColInf->Cur.Bla += dizColInf->DYY.Bla;
  1523. dizColInf->Xsp.Bla += dizColInf->DYY.Bla;
  1524. dizColInf->Xep.Bla += dizColInf->DYY.Bla;
  1525. // if (DizCynCur == DizCynYep) {
  1526. // DizCynXsp = dizInf->TblCyn;
  1527. // DizCynXep = DizCynXsp + DizCynDYY;
  1528. // DizCynCur = DizCynYsp;
  1529. // }
  1530. if (dizColInf->Cur.Cyn == dizColInf->Yep.Cyn) {
  1531. dizColInf->Xsp.Cyn = dizInf->TblCyn;
  1532. dizColInf->Xep.Cyn = dizColInf->Xsp.Cyn + dizColInf->DYY.Cyn;
  1533. dizColInf->Cur.Cyn = dizColInf->Ysp.Cyn;
  1534. }
  1535. // if (DizMgtCur == DizMgtYep) {
  1536. // DizMgtXsp = dizInf->TblMgt;
  1537. // DizMgtXep = DizMgtXsp + DizMgtDYY;
  1538. // DizMgtCur = DizMgtYsp;
  1539. // }
  1540. if (dizColInf->Cur.Mgt == dizColInf->Yep.Mgt) {
  1541. dizColInf->Xsp.Mgt = dizInf->TblMgt;
  1542. dizColInf->Xep.Mgt = dizColInf->Xsp.Mgt + dizColInf->DYY.Mgt;
  1543. dizColInf->Cur.Mgt = dizColInf->Ysp.Mgt;
  1544. }
  1545. // if (DizYelCur == DizYelYep) {
  1546. // DizYelXsp = dizInf->TblYel;
  1547. // DizYelXep = DizYelXsp + DizYelDYY;
  1548. // DizYelCur = DizYelYsp;
  1549. // }
  1550. if (dizColInf->Cur.Yel == dizColInf->Yep.Yel) {
  1551. dizColInf->Xsp.Yel = dizInf->TblYel;
  1552. dizColInf->Xep.Yel = dizColInf->Xsp.Yel + dizColInf->DYY.Yel;
  1553. dizColInf->Cur.Yel = dizColInf->Ysp.Yel;
  1554. }
  1555. // if (DizBlaCur == DizBlaYep) {
  1556. // DizBlaXsp = dizInf->TblBla;
  1557. // DizBlaXep = DizBlaXsp + DizBlaDYY;
  1558. // DizBlaCur = DizBlaYsp;
  1559. // }
  1560. if (dizColInf->Cur.Bla == dizColInf->Yep.Bla) {
  1561. dizColInf->Xsp.Bla = dizInf->TblBla;
  1562. dizColInf->Xep.Bla = dizColInf->Xsp.Bla + dizColInf->DYY.Bla;
  1563. dizColInf->Cur.Bla = dizColInf->Ysp.Bla;
  1564. }
  1565. return;
  1566. }
  1567. #endif
  1568. //---------------------------------------------------------------------------------------------------
  1569. // Dithering information renewal (monochrome)
  1570. //---------------------------------------------------------------------------------------------------
  1571. static VOID DizInfChgMon( // Return value no
  1572. LPDIZINF dizInf, // Fixation dithering information
  1573. LPDIZCOLINF dizColInf // Dithering information (each color)
  1574. )
  1575. {
  1576. // DizBlaCur += DizBlaDYY; DizBlaXsp += DizBlaDYY; DizBlaXep += DizBlaDYY;
  1577. dizColInf->Cur.Bla += dizColInf->DYY.Bla;
  1578. dizColInf->Xsp.Bla += dizColInf->DYY.Bla;
  1579. dizColInf->Xep.Bla += dizColInf->DYY.Bla;
  1580. // if (DizBlaCur == DizBlaYep) {
  1581. // DizBlaXsp = dizInf->TblBla;
  1582. // DizBlaXep = DizBlaXsp + DizBlaDYY;
  1583. // DizBlaCur = DizBlaYsp;
  1584. // }
  1585. if (dizColInf->Cur.Bla == dizColInf->Yep.Bla) {
  1586. dizColInf->Xsp.Bla = dizInf->TblBla;
  1587. dizColInf->Xep.Bla = dizColInf->Xsp.Bla + dizColInf->DYY.Bla;
  1588. dizColInf->Cur.Bla = dizColInf->Ysp.Bla;
  1589. }
  1590. return;
  1591. }
  1592. // End of N5DIZPC.C