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.

247 lines
13 KiB

  1. //***************************************************************************************************
  2. // COLMATCH.H
  3. //
  4. // Functions of color matching(C Header)
  5. //---------------------------------------------------------------------------------------------------
  6. // copyright(C) 1997-2000 CASIO COMPUTER CO.,LTD. / CASIO ELECTRONICS MANUFACTURING CO.,LTD.
  7. //***************************************************************************************************
  8. //---------------------------------------------------------------------------------------------------
  9. // Include Header file
  10. //---------------------------------------------------------------------------------------------------
  11. #include "COLDEF.H"
  12. #include "COMDIZ.H"
  13. #include "N501DIZ.H"
  14. //---------------------------------------------------------------------------------------------------
  15. // Printer name
  16. //---------------------------------------------------------------------------------------------------
  17. #define PRN_N5 0
  18. //---------------------------------------------------------------------------------------------------
  19. // Color Matching DLL name
  20. //---------------------------------------------------------------------------------------------------
  21. #define N501_ColCchIni N501ColCchIni
  22. #define N501_ColMchPrc N501ColMchPrc
  23. #define N501_ColCnvC2r N501ColCnvC2r
  24. #define N501_ColDizInfSet N501ColDizInfSet
  25. #define N501_ColDizPrc N501ColDizPrc
  26. #define N501_ColLutMakGlbMon N501ColLutMakGlbMon
  27. #define N501_ColUcrTblMak N501ColUcrTblMak
  28. #define N501_ColPtcPrc N501ColPtcPrc
  29. #define N501_ColCtrRgb N501ColCtrRgb
  30. #define N501_ColCtrCmy N501ColCtrCmy
  31. #define N501_ColLutDatRdd N501ColLutDatRdd
  32. #define N501_ColLutMakGlb N501ColLutMakGlb
  33. #define N501_ColLutMak032 N501ColLutMak032
  34. #define N501_ColColDatRdd N501ColColDatRdd
  35. #define N501_ColDrwInfSet N501ColDrwInfSet
  36. #define N501_ColGryTblMak N501ColGryTblMak
  37. #define N501_ExeJpgDcdJdg ExeJpgDcdJdg
  38. #define N501_ExeJpgEcd ExeJpgEcd
  39. #define Qty_BmpFilWrkSizGet BmpFilWrkSizGet
  40. #define Qty_BmpFilterExe BmpFilterExe
  41. #define Qty_BmpEnlWrkSizGet BmpEnlWrkSizGet
  42. #define Qty_BmpEnlExe BmpEnlExe
  43. //---------------------------------------------------------------------------------------------------
  44. // Data define
  45. //---------------------------------------------------------------------------------------------------
  46. #define No 0
  47. #define Yes 1
  48. #define XX_RES_300DPI 0
  49. #define XX_RES_600DPI 1
  50. #define XX_MONO 0
  51. #define XX_COLOR 1
  52. #define XX_COLOR_SINGLE 2
  53. #define XX_COLOR_MANY 3
  54. #define XX_COLOR_MANY2 4
  55. #define XX_DITH_IMG 0
  56. #define XX_DITH_GRP 1
  57. #define XX_DITH_TXT 2
  58. #define XX_DITH_GOSA 3
  59. #define XX_DITH_NORMAL 4
  60. #define XX_DITH_HS_NORMAL 5
  61. #define XX_DITH_DETAIL 6
  62. #define XX_DITH_EMPTY 7
  63. #define XX_DITH_SPREAD 8
  64. #define XX_DITH_NON 9
  65. #define XX_MAXDITH 10
  66. #define XX_COLORMATCH_BRI 1
  67. #define XX_COLORMATCH_TINT 2
  68. #define XX_COLORMATCH_VIV 3
  69. #define XX_COLORMATCH_NONE 4
  70. #define XX_BITFONT_OFF 0
  71. #define XX_BITFONT_ON 1
  72. #define XX_CMYBLACK_GRYBLK 0
  73. #define XX_CMYBLACK_BLKTYPE1 1
  74. #define XX_CMYBLACK_BLKTYPE2 2
  75. #define XX_CMYBLACK_BLACK 3
  76. #define XX_CMYBLACK_TYPE1 4
  77. #define XX_CMYBLACK_TYPE2 5
  78. #define XX_CMYBLACK_NONE 6
  79. #define XX_COMPRESS_OFF 0
  80. #define XX_COMPRESS_AUTO 1
  81. #define XX_COMPRESS_RASTER 3
  82. #define XX_TONE_2 0
  83. #define XX_TONE_4 1
  84. #define XX_TONE_16 2
  85. #define XX_ICM_NON 1
  86. #define XX_ICM_USE 2
  87. #define WRITESPOOLBUF(p, s, n) \
  88. ((p)->pDrvProcs->DrvWriteSpoolBuf(p, s, n))
  89. #define PALETTE_SIZE 1
  90. #define BYTE_LENGTH(s) (sizeof (s) - 1)
  91. #define MagPixel(Dat, Nrt, Dnt) ((((Dat) + 1) * (Nrt) / (Dnt)) - ((Dat) * (Nrt) / (Dnt)))
  92. typedef char FAR *HPSTR;
  93. typedef BYTE FAR *HPBYTE;
  94. //===================================================================================================
  95. // Dither pattern buffer
  96. //===================================================================================================
  97. typedef struct {
  98. LPBYTE lpC; // Cyan
  99. LPBYTE lpM; // Magenta
  100. LPBYTE lpY; // Yellow
  101. LPBYTE lpK; // Black
  102. } DIZBUF, FAR *LPDIZBUF;
  103. //===================================================================================================
  104. // Read buffer size
  105. //===================================================================================================
  106. #define LUTFILESIZ 70L * 1024L // N501 Buffer size for LUT file read
  107. #define DIZFILESIZ 408L * 1024L // N501 Buffer size for DIZ file read
  108. #define LUT032SIZ 128L * 1024L // N501 Buffer size for LUT32GRID
  109. #define UCRTBLSIZ 2048L // N501 Buffer size for UCR table
  110. #define UCRWRKSIZ 32768 // N501 Buffer size for UCR table work
  111. #define sRGBLUTFILESIZ 16L * 1024L // N501 Buffer size for LUT file read (sRGB)
  112. #define LUTMAKGLBSIZ 16L * 1024L // N501 Buffer size for LUTMAKGLB
  113. #define GRYTBLSIZ 256L // N501 Buffer size for Gray transfer table
  114. //===================================================================================================
  115. // Color matching structure
  116. //===================================================================================================
  117. typedef struct {
  118. WORD wReso; // Resolution
  119. WORD ColMon; // Color/Monochrome
  120. WORD DatBit; // Data bit(1:2value 2:4value 4:16value)
  121. WORD BytDot; // DPI (2value:8 4value:4 16value:2)
  122. struct { // Strcture for color matching
  123. WORD Mode; // Type of color matching
  124. WORD GryKToner; //+N5 Gray color use black toner ?
  125. WORD Viv; // Vividly?(For N4-612Printer)
  126. WORD LutNum; // LUT table No.
  127. WORD Diz; // Type od dithering
  128. SHORT Tnr; // Toner density(-30 to 30)
  129. WORD CmyBlk; // Replace CMY by black toner ?
  130. WORD Speed; // 0:high 1:normal
  131. WORD Gos32; // GOSA?
  132. WORD PColor; // Original color?
  133. WORD Ucr; //+N5 Ucr
  134. WORD SubDef; // Bright, contrast and gamma ?
  135. SHORT Bright; // bright
  136. SHORT Contrast; // contrast
  137. WORD GamRed; // Color balance(R)
  138. WORD GamGreen; // Color balance(G)
  139. WORD GamBlue; // Color balance(B)
  140. LPRGBINF lpRGBInf; //+N5 RGB transformation information
  141. LPCMYKINF lpCMYKInf; //+N5 CMYK transformation information
  142. LPCOLMCHINF lpColMch; //+N5 Color matching information
  143. LPDIZINF lpDizInf; //+N5 Dithering pattern information
  144. UINT CchMch; // Cache information for Color Matching
  145. UINT CchCnv; // Cache information for use black toner
  146. RGBS CchRGB; // Cache information for input RGB
  147. CMYK CchCMYK; // Cache information for output CMYK
  148. WORD LutMakGlb; //+N5 Global LUT make ?
  149. WORD KToner; // Black toner usage
  150. } Mch;
  151. UINT InfSet; //+N5 Color information setting completion
  152. WORD Dot; //+N5 Dot tone (TONE2, TONE4, TONE16)
  153. LPVOID lpColIF; //+N5 RGBINF / CMYKINF / COLMCHINF / DIZINF pointer
  154. LPVOID LutTbl; //+N5 Look-up table
  155. LPVOID CchRGB; //+N5 Cache table for RGB
  156. LPVOID CchCMYK; //+N5 Cache table for CMYK
  157. LPVOID DizTbl[4]; //+N5 Dither pattern table
  158. LPRGB lpTmpRGB; //+N5 RGB convert area (*Temp area)
  159. LPCMYK lpTmpCMYK; //+N5 CMYK convert area (*Temp area)
  160. LPDRWINF lpDrwInf; //+N5 Draw information (*Temp area)
  161. LPBYTE lpLut032; //+N5 LUT32GRID
  162. LPBYTE lpUcr; //+N5 Ucr table
  163. LPBYTE lpLutMakGlb; //+N5 LUTMAKGLB
  164. LPBYTE lpGryTbl; //+N5 Gray transfer table
  165. } DEVCOL, FAR *LPDEVCOL;
  166. //===================================================================================================
  167. // Bitmap buffer structure
  168. //===================================================================================================
  169. typedef struct {
  170. WORD Diz; // Method of dithering
  171. WORD Style; // Method of spooling
  172. WORD DatBit; // Databit(1:2value 2:4value 4:16value)
  173. struct {
  174. struct { // Member of RGB buffer(for 1 line)
  175. WORD AllWhite; // All data is white?
  176. DWORD Siz; // Size
  177. LPRGB Pnt; // Pointer
  178. } Rgb;
  179. struct { // Member of CMYK buffer(for 1 line)
  180. DWORD Siz; // Size
  181. LPCMYK Pnt; // Poiner
  182. } Cmyk;
  183. struct { // Member of CMYK(2/4/16value)bitmap buffer(maximum 64KB)
  184. DWORD Siz; // Size
  185. WORD BseLin; // The number of lines that require
  186. WORD Lin; // The number of lines that allocate
  187. LPBYTE Pnt[4]; // Pointer
  188. } Bit;
  189. } Drv;
  190. } BMPBIF, FAR* LPBMPBIF;
  191. //***************************************************************************************************
  192. // Functions
  193. //***************************************************************************************************
  194. //===================================================================================================
  195. // Initialize the members of color-matching
  196. //===================================================================================================
  197. BOOL FAR PASCAL ColMatchInit(PDEVOBJ);
  198. //===================================================================================================
  199. // Disable the color-matching
  200. //===================================================================================================
  201. BOOL FAR PASCAL ColMatchDisable(PDEVOBJ);
  202. //===================================================================================================
  203. // DIB spools to the printer
  204. //===================================================================================================
  205. BOOL FAR PASCAL DIBtoPrn(PDEVOBJ, PBYTE, PBITMAPINFOHEADER, PBYTE, PIPPARAMS);
  206. //===================================================================================================
  207. // Convert RGB data into CMYK data
  208. //===================================================================================================
  209. BOOL FAR PASCAL ColMatching(PDEVOBJ, UINT, UINT, LPRGB, UINT, LPCMYK);
  210. //===================================================================================================
  211. // Convert CMYK data into Dither data
  212. //===================================================================================================
  213. UINT FAR PASCAL Dithering(PDEVOBJ, UINT, UINT, POINT, POINT, MAG, MAG, LPCMYK, DWORD,
  214. LPBYTE, LPBYTE, LPBYTE, LPBYTE);
  215. //===================================================================================================
  216. // Color Control
  217. //===================================================================================================
  218. VOID FAR PASCAL ColControl(PDEVOBJ, LPRGB, UINT);
  219. // End of File