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.

2117 lines
87 KiB

  1. /*++
  2. Copyright (c) 1990-1999 Microsoft Corporation
  3. Module Name:
  4. ht.h
  5. Abstract:
  6. This module contains all the public defines, constants, structures and
  7. functions declarations for accessing the DLL.
  8. Author:
  9. 15-Jan-1991 Tue 21:13:21 created -by- Daniel Chou (danielc)
  10. [Environment:]
  11. GDI Device Driver - Halftone.
  12. [Notes:]
  13. Revision History:
  14. 29-Oct-1991 Tue 14:33:43 updated -by- Daniel Chou (danielc)
  15. 1) Change HALFTONEPATTERN data structure.
  16. a) 'Flags' field from WORD to BYTE
  17. b) 'MaximumHTDensityIndex' from WORD to BYTE
  18. c) Change the field order.
  19. 2) Remove ReferenceWhite/ReferenceBlack from HTCOLORADJUSTMENT data
  20. structure.
  21. 3)
  22. --*/
  23. #ifndef _HT_
  24. #define _HT_
  25. //
  26. // For compilers that don't support nameless unions
  27. //
  28. #ifndef DUMMYUNIONNAME
  29. #ifdef NONAMELESSUNION
  30. #define DUMMYUNIONNAME u
  31. #define DUMMYUNIONNAME2 u2
  32. #define DUMMYUNIONNAME3 u3
  33. #define DUMMYUNIONNAME4 u4
  34. #else
  35. #define DUMMYUNIONNAME
  36. #define DUMMYUNIONNAME2
  37. #define DUMMYUNIONNAME3
  38. #define DUMMYUNIONNAME4
  39. #endif
  40. #endif
  41. #ifndef far
  42. #define far
  43. #endif
  44. #ifndef FAR
  45. #define FAR far
  46. #endif
  47. typedef CHAR FAR *LPCHAR;
  48. typedef SHORT FAR *LPSHORT;
  49. typedef UINT FAR *LPUINT;
  50. //
  51. // The DECI4/UDECI4 is a special number used in halftone DLL, this number
  52. // just like regular short, unsigned short number, except it using lower
  53. // four decimal digits as right side of the decimal point, that is
  54. // 10000 is as 1.0000, and -12345 will be -1.2345.
  55. //
  56. typedef short DECI4;
  57. typedef unsigned short UDECI4;
  58. typedef DECI4 FAR *PDECI4;
  59. typedef UDECI4 FAR *PUDECI4;
  60. #define DECI4_0 (DECI4)0
  61. #define DECI4_1 (DECI4)10000
  62. #define DECI4_Neg1 (DECI4)-10000
  63. #define UDECI4_0 (UDECI4)0
  64. #define UDECI4_1 (UDECI4)10000
  65. #define SIZE_BYTE sizeof(BYTE)
  66. #define SIZE_CHAR sizeof(CHAR)
  67. #define SIZE_WORD sizeof(WORD)
  68. #define SIZE_SHORT sizeof(SHORT)
  69. #define SIZE_LONG sizeof(LONG)
  70. #define SIZE_DWORD sizeof(DWORD)
  71. #define SIZE_UINT sizeof(UINT)
  72. #define SIZE_INT sizeof(INT)
  73. #define SIZE_UDECI4 sizeof(UDECI4)
  74. #define SIZE_DECI4 sizeof(DECI4)
  75. #define COUNT_ARRAY(array) (sizeof(array) / sizeof(array[0]))
  76. #define B_BITPOS(x) ((BYTE)(1 << (x)))
  77. #define W_BITPOS(x) ((WORD)(1 << (x)))
  78. #define DW_BITPOS(x) ((DWORD)(1 << (x)))
  79. #define BIT_IF(b,t) (((t)) ? (b) : ((b)-(b)))
  80. #define SET_BIT(x,b) ((x) |= (b))
  81. #define CLR_BIT(x,b) ((x) &= ~(b))
  82. #define INV_BIT(x,b) ((x) ^= (b))
  83. #define HAS_BIT(x,b) ((x) & (b))
  84. //
  85. // The following are the error return values for the HTHalftoneBitmap() call.
  86. //
  87. #define HTERR_WRONG_VERSION_HTINITINFO -1
  88. #define HTERR_INSUFFICIENT_MEMORY -2
  89. #define HTERR_CANNOT_DEALLOCATE_MEMORY -3
  90. #define HTERR_COLORTABLE_TOO_BIG -4
  91. #define HTERR_QUERY_SRC_BITMAP_FAILED -5
  92. #define HTERR_QUERY_DEST_BITMAP_FAILED -6
  93. #define HTERR_QUERY_SRC_MASK_FAILED -7
  94. #define HTERR_SET_DEST_BITMAP_FAILED -8
  95. #define HTERR_INVALID_SRC_FORMAT -9
  96. #define HTERR_INVALID_SRC_MASK_FORMAT -10
  97. #define HTERR_INVALID_DEST_FORMAT -11
  98. #define HTERR_INVALID_DHI_POINTER -12
  99. #define HTERR_SRC_MASK_BITS_TOO_SMALL -13
  100. #define HTERR_INVALID_HTPATTERN_INDEX -14
  101. #define HTERR_INVALID_HALFTONE_PATTERN -15
  102. #define HTERR_HTPATTERN_SIZE_TOO_BIG -16
  103. #define HTERR_NO_SRC_COLORTRIAD -17
  104. #define HTERR_INVALID_COLOR_TABLE -18
  105. #define HTERR_INVALID_COLOR_TYPE -29
  106. #define HTERR_INVALID_COLOR_TABLE_SIZE -20
  107. #define HTERR_INVALID_PRIMARY_SIZE -21
  108. #define HTERR_INVALID_PRIMARY_VALUE_MAX -22
  109. #define HTERR_INVALID_PRIMARY_ORDER -23
  110. #define HTERR_INVALID_COLOR_ENTRY_SIZE -24
  111. #define HTERR_INVALID_FILL_SRC_FORMAT -25
  112. #define HTERR_INVALID_FILL_MODE_INDEX -26
  113. #define HTERR_INVALID_STDMONOPAT_INDEX -27
  114. #define HTERR_INVALID_DEVICE_RESOLUTION -28
  115. #define HTERR_INVALID_TONEMAP_VALUE -29
  116. #define HTERR_NO_TONEMAP_DATA -30
  117. #define HTERR_TONEMAP_VALUE_IS_SINGULAR -31
  118. #define HTERR_INVALID_BANDRECT -32
  119. #define HTERR_STRETCH_RATIO_TOO_BIG -33
  120. #define HTERR_CHB_INV_COLORTABLE_SIZE -34
  121. #define HTERR_HALFTONE_INTERRUPTTED -35
  122. #define HTERR_NO_SRC_HTSURFACEINFO -36
  123. #define HTERR_NO_DEST_HTSURFACEINFO -37
  124. #define HTERR_8BPP_PATSIZE_TOO_BIG -38
  125. #define HTERR_16BPP_555_PATSIZE_TOO_BIG -39
  126. #define HTERR_INVALID_ABINFO -40
  127. #define HTERR_INTERNAL_ERRORS_START -10000
  128. #define COLOR_TYPE_RGB 0
  129. #define COLOR_TYPE_XYZ 1
  130. #define COLOR_TYPE_YIQ 2
  131. #define COLOR_TYPE_MAX 2
  132. #define PRIMARY_ORDER_123 0
  133. #define PRIMARY_ORDER_132 1
  134. #define PRIMARY_ORDER_213 2
  135. #define PRIMARY_ORDER_231 3
  136. #define PRIMARY_ORDER_321 4
  137. #define PRIMARY_ORDER_312 5
  138. #define PRIMARY_ORDER_MAX 5
  139. #define PRIMARY_ORDER_RGB PRIMARY_ORDER_123
  140. #define PRIMARY_ORDER_RBG PRIMARY_ORDER_132
  141. #define PRIMARY_ORDER_GRB PRIMARY_ORDER_213
  142. #define PRIMARY_ORDER_GBR PRIMARY_ORDER_231
  143. #define PRIMARY_ORDER_BGR PRIMARY_ORDER_321
  144. #define PRIMARY_ORDER_BRG PRIMARY_ORDER_312
  145. #define PRIMARY_ORDER_CMY PRIMARY_ORDER_123
  146. #define PRIMARY_ORDER_CYM PRIMARY_ORDER_132
  147. #define PRIMARY_ORDER_MCY PRIMARY_ORDER_213
  148. #define PRIMARY_ORDER_MYC PRIMARY_ORDER_231
  149. #define PRIMARY_ORDER_YMC PRIMARY_ORDER_321
  150. #define PRIMARY_ORDER_YCM PRIMARY_ORDER_312
  151. #define PRIMARY_ORDER_XYZ PRIMARY_ORDER_123
  152. #define PRIMARY_ORDER_XZY PRIMARY_ORDER_132
  153. #define PRIMARY_ORDER_YXZ PRIMARY_ORDER_213
  154. #define PRIMARY_ORDER_YZX PRIMARY_ORDER_231
  155. #define PRIMARY_ORDER_ZYX PRIMARY_ORDER_321
  156. #define PRIMARY_ORDER_ZXY PRIMARY_ORDER_312
  157. #define PRIMARY_ORDER_YIQ PRIMARY_ORDER_123
  158. #define PRIMARY_ORDER_YQI PRIMARY_ORDER_132
  159. #define PRIMARY_ORDER_IYQ PRIMARY_ORDER_213
  160. #define PRIMARY_ORDER_IQY PRIMARY_ORDER_231
  161. #define PRIMARY_ORDER_QIY PRIMARY_ORDER_321
  162. #define PRIMARY_ORDER_QYI PRIMARY_ORDER_312
  163. //
  164. // COLORTRIAD
  165. //
  166. // This data structure describe the source color informations
  167. //
  168. // Type - One of the following type may be specified.
  169. //
  170. // COLOR_TYPE_RGB - primaries are RGB.
  171. // COLOR_TYPE_XYZ - primaries are CIE XYZ.
  172. // COLOR_TYPE_YIQ - primaries are NTSC YIQ.
  173. //
  174. // BytesPerPrimary - Specified how many bytes used per primary color, it
  175. // must be one of the following
  176. //
  177. // 1 - BYTE
  178. // 2 - WORD
  179. // 4 - DWORD
  180. //
  181. // All 3 primaries must be consecutive in memory.
  182. //
  183. // BytesPerEntry - Specified how many bytes used for color table entry,
  184. // each entry specified 3 primaries colors.
  185. //
  186. // PrimaryOrder - The primaries order in the color table, it can be
  187. // one of the defined PRIMARY_ORDER_abc, for each entry
  188. // in the memory it defined as
  189. //
  190. // PRIMARY_ORDER_abc
  191. // |||
  192. // ||+-- highest memory location
  193. // ||
  194. // |+--- middle
  195. // |
  196. // +---- Lowest memory location
  197. //
  198. // All 3 primaries must be consecutive in memory.
  199. //
  200. // PrimaryValueMax - The maximum value for the primary color, this is used
  201. // to nomalized the input colors, for example a 8-bit
  202. // RGB color table will specified 255.
  203. //
  204. // ColorTableEntries - Total entries of the color table pointed by the
  205. // pColorTable.
  206. //
  207. // pColorTable - Pointer to the start of color table, the size of the
  208. // this color table must at least (BytesPerEntry *
  209. // ColorTableEntries).
  210. //
  211. // If the first primary color in the color table entry
  212. // is not at first byte of the pColorTable, then caller
  213. // must specified the pColorTable at first primary
  214. // color. (pColorTable += Offset(first primary).
  215. //
  216. //
  217. typedef struct _COLORTRIAD {
  218. BYTE Type;
  219. BYTE BytesPerPrimary;
  220. BYTE BytesPerEntry;
  221. BYTE PrimaryOrder;
  222. LONG PrimaryValueMax;
  223. DWORD ColorTableEntries;
  224. LPVOID pColorTable;
  225. } COLORTRIAD, FAR *PCOLORTRIAD;
  226. //
  227. // HTSURFACEINFO
  228. //
  229. // This data structure describe the the input/output surface in order for
  230. // halftone function to render the output, this data structure only used for
  231. // the memory device.
  232. //
  233. // hSurface - This is 32-bits handle which will be passed back
  234. // to the caller's callback function.
  235. //
  236. // Flags - One or more following flags may be defined
  237. //
  238. // HTSIF_SCANLINES_TOPDOWN
  239. //
  240. // This flag is ignored
  241. //
  242. // SurfaceFormat - Following formats are defined
  243. //
  244. // BMF_1BPP
  245. //
  246. // 1-bit per pel format, this is the index
  247. // number (0 or 1) for the color table/palette.
  248. //
  249. // BMF_4BPP
  250. //
  251. // 4-bit per pel and pack two pels to a byte
  252. // starting from high nibble (bit 4-7) format,
  253. // this is the index number (0-7) for the
  254. // color table/palette. (ONLY LOW 3 bits of
  255. // the nibble is used)
  256. //
  257. // BMF_4BPP_VGA16
  258. //
  259. // 4-bit per pel and pack two pels to a byte
  260. // starting from high nibble (bit 4-7) format,
  261. // this is the index number (0-15) for the
  262. // standard VGA 16 colors table/palette.
  263. //
  264. // The different from BMF_4BPP is this indices
  265. // are fixed to standard VGA 16 colors as
  266. //
  267. // Index# Colors Lightness
  268. // ---------------------------------
  269. // 0 Black 0%
  270. // 1 Red 50%
  271. // 2 Green 50%
  272. // 3 Yellow 50%
  273. // 4 Blue 50%
  274. // 5 Magenata 50%
  275. // 6 Cyan 50%
  276. // 7 Gray 50%
  277. // 8 Gray 75%
  278. // 9 Red 100%
  279. // 10 Green 100%
  280. // 11 Yellow 100%
  281. // 12 Blue 100%
  282. // 13 Magenata 100%
  283. // 14 Cyan 100%
  284. // 15 White 100%
  285. //
  286. // Notice that the color order is
  287. //
  288. // Bit 2 = Blue, Bit 1 = Green, Bit 0 = Red
  289. //
  290. // This format can only be used as destination
  291. // surface, when used as destination surface
  292. // the halftone dll automatically set it to
  293. // USE_ADDITIVE_PRIMS and set the primaries
  294. // order as PRIMARY_ORDER_BGR.
  295. //
  296. // BMF_8BPP
  297. //
  298. // 8-bit per pel format (1 byte each), this is
  299. // the index number (0-255) for the color
  300. // table/palette. The format is not allowed
  301. // for the destination surface.
  302. //
  303. // BMF_8BPP_VGA256
  304. //
  305. // 8-bit per pel format (1 byte each), this is
  306. // the index number (0-255) for the color
  307. // table/palette.
  308. //
  309. // The different from BMF_8BPP is this indices
  310. // are fixed to halftone special colors.
  311. //
  312. // The color table (palette) is defined by
  313. // halftone.dll, the display should call
  314. // HT_Get8BPPFormatPalette() api call to get
  315. // the current palette used by the halftone.
  316. //
  317. // The HT_GetBPPFormatPalette() will only need
  318. // to called once until next time the display
  319. // caliberation occurred.
  320. //
  321. // Halftone.dll will not used all 256 colors
  322. // in the system palette, it will leave some
  323. // 20 or more entries for the system colors.
  324. //
  325. // BMF_16BPP
  326. //
  327. // 16-bit per pel format (16 bits each), this
  328. // is the index number (0-65535) for the color
  329. // table/palette. The format is not allowed
  330. // for the destination surface.
  331. //
  332. // BMF_16BPP_555
  333. //
  334. // 16-bit per pel format (only 15 bits used),
  335. // each primary occupy 5 bits, the layout of
  336. // bits as follow
  337. //
  338. // bit 10-15 - Primary A
  339. // bit 5- 9 - Primary B
  340. // bit 0- 4 - Primary C
  341. //
  342. // The order of the Primary A, B and C is
  343. // specfied by PRIMARY_ORDER_xxx.
  344. //
  345. // for each primary there are 32 gradations,
  346. // and halftone.dll output is assume to be
  347. // linear. (non-gamma corrected), this format
  348. // only allowed for destination surface.
  349. //
  350. // BMF_24BPP
  351. //
  352. // 24-bit per pel format (8-bit per color),
  353. // the order of RGB color stored in the source
  354. // bitmap or color table.
  355. //
  356. // BMF_32BPP
  357. //
  358. // Same as BMF_24BPP but with extra byte
  359. // packing, if the extra byte is packed at
  360. // begining (the first color is starting from
  361. // second byte of that 4 bytes) then caller
  362. // must set the pColorTable = pColorTable + 1
  363. // or set pPlane = pPlane + 1, to skip first
  364. // unused byte.
  365. //
  366. // NOTE: Allowed source formats are
  367. //
  368. // 1) BMF_1BPP
  369. // 2) BMF_4BPP
  370. // 3) BMF_8BPP
  371. // 4) BMF_16BPP
  372. // 5) BMF_24BPP
  373. // 6) BMF_32BPP
  374. //
  375. // Allowed destination formats are
  376. //
  377. // 1) BMF_1BPP
  378. // 2) BMF_4BPP
  379. // 3) BMF_4BPP_VGA16
  380. // 4) BMF_8BPP_VGA256
  381. // 5) BMF_16BPP_555
  382. //
  383. // Any other mismatch cause error returned.
  384. //
  385. // ScanLineAlignBytes - Total bytes needed to aligned for each scan line
  386. // in the surface bitmap, it can be any unsigned
  387. // 8-bit number, the common ones are defined as
  388. //
  389. // BMF_ALIGN_BYTE ( 8-bit aligned)
  390. // BMF_ALIGN_WORD (16-bit aligned)
  391. // BMF_ALIGN_DWORD (32-bit aligned)
  392. // BMF_ALIGN_QWORD (64-bit aligned)
  393. //
  394. // Width - The width of the surface in pels.
  395. //
  396. // Height - The height of the surface in scan lines.
  397. //
  398. // ScanLineDelta - Specified scan lines Delta in bytes, this member
  399. // indicate how many bytes to be added for advanced
  400. // to next scan line
  401. //
  402. // pPlane - This pointer points to the first scan line in
  403. // the defined surface, Scan #0 that is.
  404. //
  405. // pColorTriad - Pointe to the COLORTRIAD data structure to
  406. // specified the source color table, this pointer
  407. // only examined by the halftone.dll for source
  408. // surface.
  409. //
  410. #if !defined( BMF_DEVICE ) && \
  411. !defined( BMF_1BPP ) && \
  412. !defined( BMF_4BPP ) && \
  413. !defined( BMF_8BPP ) && \
  414. !defined( BMF_16BPP ) && \
  415. !defined( BMF_24BPP ) && \
  416. !defined( BMF_32BPP )
  417. #define BMF_1BPP 1
  418. #define BMF_4BPP 2
  419. #define BMF_8BPP 3
  420. #define BMF_16BPP 4
  421. #define BMF_24BPP 5
  422. #define BMF_32BPP 6
  423. #endif
  424. #define BMF_4BPP_VGA16 255
  425. #define BMF_8BPP_VGA256 254
  426. #define BMF_16BPP_555 253
  427. #define BMF_16BPP_565 252
  428. #define BMF_HT_LAST BMF_16BPP_565
  429. //
  430. // Following are common used alignment bytes for the bitmap
  431. //
  432. #define BMF_ALIGN_BYTE 1 // 8 bits = 1 byte
  433. #define BMF_ALIGN_WORD 2 // 16 bits = 2 bytes
  434. #define BMF_ALIGN_DWORD 4 // 32 bits = 4 bytes
  435. #define BMF_ALIGN_QWORD 8 // 64 bits = 8 bytes
  436. #define HTSIF_SCANLINES_TOPDOWN W_BITPOS(0)
  437. typedef struct _HTSURFACEINFO {
  438. ULONG_PTR hSurface;
  439. WORD Flags;
  440. BYTE SurfaceFormat;
  441. BYTE ScanLineAlignBytes;
  442. LONG Width;
  443. LONG Height;
  444. LONG ScanLineDelta;
  445. LPBYTE pPlane;
  446. PCOLORTRIAD pColorTriad;
  447. } HTSURFACEINFO;
  448. typedef HTSURFACEINFO FAR *PHTSURFACEINFO;
  449. //
  450. // HTCALLBACKPARAMS
  451. //
  452. // This is structure is used durning the bitmap halftone process to obtains
  453. // the source or destination bitmap surface pointers.
  454. //
  455. //
  456. // hSurface - This is the handle which passed to the
  457. // halftone DLL, durning the HTHalftoneBitmap() call,
  458. // (in HTSURFACEINFO data structure) it may be
  459. // handle to source or destination depends on the
  460. // nature of the callback.
  461. //
  462. // CallBackMode - Specified the nature of the callback.
  463. //
  464. // HTCALLBACK_QUERY_SRC
  465. //
  466. // The callback is quering the source bitmap
  467. // pointer.
  468. //
  469. // HTCALLBACK_QUERY_SRC_MASK
  470. //
  471. // The callback is quering the source mask
  472. // bitmap pointer.
  473. //
  474. // HTCALLBACK_QUERY_DEST
  475. //
  476. // The callback is quering the destination
  477. // bitmap pointer(s).
  478. //
  479. // HTCALLBACK_SET_DEST
  480. //
  481. // The callback is used to release halftoned
  482. // destination. It will called in following
  483. // conditions:
  484. //
  485. // 1) Before HTCALLBACK_QUERY_DEST call
  486. // except for the very first query
  487. // destination.
  488. //
  489. // 2) After the halftone process is
  490. // completed. This give the chance for
  491. // the caller to process the last
  492. // halftoned destination block.
  493. //
  494. // SurfaceFormat - This is the surface format specified in the
  495. // original HTSURFACEINFO.
  496. //
  497. // Flags - This is the copy of HTSURFACEINFO.Flags.
  498. //
  499. // BytesPerScanLine - This is the total bytes per scan line for the
  500. // surface bitmap which computed by the halftone
  501. // DLL according to the 'ScanLineAlignBytes' in the
  502. // HTSURFACEINFO data structure, it can be used by
  503. // the caller to calculate source/destination
  504. // pointers information.
  505. //
  506. // ScanStart - Requested starting scan line number, the scan
  507. // lines are number from 0 up, this number will
  508. // guaranteed has following propertites:
  509. //
  510. // 1) It always greater than or equal to zero.
  511. // 2) It will never greater than or equal to the
  512. // 'height' field specified in the
  513. // HTSURFACEINFO.
  514. //
  515. // NOTE: for banding destination surface it
  516. // will never greater than or equal to
  517. // the (rclBand.bottom - rclBand.top).
  518. //
  519. // 3) The scan line number 0 always refer to the
  520. // physical lowest bitmap memory location
  521. // regardless HTSIF_SCANLINES_TOPDOWN flag set
  522. // or not, durning callback the caller only
  523. // need to compute array like bitmap buffer,
  524. // halftone DLL will compute the correct
  525. // ScanStart if the bitmap is not TOPDOWN.
  526. //
  527. // ScanCount - Total scan lines requested starting from
  528. // ScanStart, this number will guaranteed has
  529. // following propertites:
  530. //
  531. // 1) It always greater than zero.
  532. // 2) Never greater then the MaximumQueryScanLines
  533. // specified for the surface (in HTSURFACEINFO
  534. // data structure).
  535. //
  536. // NOTE: for banding destination surface it
  537. // will never greater than the
  538. // (rclBand.bottom - rclBand.top).
  539. //
  540. // NOTE: 1) ScanStart/ScanCount
  541. //
  542. // If the flags HTSURFACEINFO data
  543. // structure HTSIF_SCANLINES_TOPDOWN is not
  544. // specified then halftone DLL automatically
  545. // calculate the correct ScanStart/ScanCount
  546. // for read/write the up-side-down bitmap.
  547. //
  548. // For example:
  549. //
  550. // If the surface bitmap is up-side-down
  551. // type DIB) and has 100 scan lines height
  552. // (scan line #99 is the top of the bitmap),
  553. // if halftone DLL need to get to scan line
  554. // 10-14 (Start from scan line 10 and 5
  555. // lines) then halftone DLL will flip Y,
  556. // and passed ScanStart = 85 and ScanCount
  557. // = 5, but if the HTSIF_SCANLINES_TOPDOWN
  558. // flag is set (Non DIB type format) then
  559. // callback parameters will then be
  560. // ScanStart = 10 and ScanCount = 5.
  561. //
  562. // 2) The ScanStart for the callback function
  563. // always consider the lowest bitmap in the
  564. // memory as scan line 0, that is when
  565. // callback fucntion received control, it
  566. // only need to consider the ScanStart as
  567. // physical scan line location which the
  568. // Scan line #0 always starting from lowest
  569. // bitmap memory location.
  570. //
  571. // 3) The width of the destination buffer is
  572. // considered as 'Width' field specified
  573. // for the destination HTSURFACEINFO, if
  574. // destination is BANDed (horizontal or
  575. // vertical) then its width is computed as
  576. // Band.right - Band.left. and the result
  577. // always Band.left/Band.top aligned.
  578. //
  579. // 4) If caller return 'ScanCount' diff from
  580. // the one requested then caller must check
  581. //
  582. // HTSIF_SCANLINES_TOPDOWN flag is SET
  583. //
  584. // 1. Process 'ScanStart' and
  585. // 'ScanCount' fields as normal.
  586. //
  587. // 2. Set New ScanCount to passed
  588. // callback data structure.
  589. // (ie. HTCallBackParam.ScanCount)
  590. //
  591. //
  592. // HTSIF_SCANLINES_TOPDOWN flag is CLEAR
  593. //
  594. // 1. Re-compute 'ScanStart' before
  595. // compute pPlane as
  596. //
  597. // ScanStart = ScanStart -
  598. // (NewScanCount -
  599. // RequsetedScanCount)
  600. //
  601. // 2. Process 'ScanStart' and
  602. // 'ScanCount' fields as normal.
  603. //
  604. // 3. Set New ScanStart to passed
  605. // callback data structure.
  606. // (ie. HTCallBackParam.ScanStart)
  607. //
  608. // 4. Set New ScanCount to passed
  609. // callback data structure.
  610. // (ie. HTCallBackParam.ScanCount)
  611. //
  612. // The returned new 'ScanCount' must not
  613. // greater then the 'RemainedSize' field.
  614. //
  615. // MaximumQueryScanLines - This is the copy of the MaximumQueryScanLines
  616. // field from the HTSURFACEINFO data structure which
  617. // passed to the the HT_HaltoneBitmap() calls.
  618. // Depends on the nature of the callback, it may be
  619. // source or destination.
  620. //
  621. // NOTE: for banding surface, it will be limited to
  622. // (rclBand.bottom - rclBand.top) if it is
  623. // greater than that number.
  624. //
  625. // RemainedSize - This field specified how many scan lines remained
  626. // to be queried, the remainded scan lines are not
  627. // include current call.
  628. //
  629. // pPlane - pointer points to the begining of first plane of
  630. // the surface. If the callback is quering the
  631. // source then this is the only pointer which need
  632. // to be updated by the callback function.
  633. //
  634. // NOTE: The pPlane must points to the first byte
  635. // of the 'ScanStart' scan line number.
  636. //
  637. // Field(s) returned from callback
  638. //
  639. // 1) HTCALLBACK_QUERY_SRC - pPlane (Options: ScanStart/ScanCount)
  640. // 2) HTCALLBACK_QUERY_SRC_MASK - pPlane (Options: ScanStart/ScanCount)
  641. // 2) HTCALLBACK_QUERY_DEST - pPlane (Options: ScanStart/ScanCount)
  642. // 4) HTCALLBACK_SET_DEST - none.
  643. //
  644. #define HTCALLBACK_QUERY_SRC 0
  645. #define HTCALLBACK_QUERY_SRC_MASK 1
  646. #define HTCALLBACK_QUERY_DEST 2
  647. #define HTCALLBACK_SET_DEST 3
  648. #define HTCALLBACK_MODE_MAX HTCALLBACK_SET_DEST
  649. typedef struct _HTCALLBACKPARAMS {
  650. ULONG_PTR hSurface;
  651. BYTE CallBackMode;
  652. BYTE SurfaceFormat;
  653. WORD Flags;
  654. LONG BytesPerScanLine;
  655. LONG ScanStart;
  656. WORD ScanCount;
  657. WORD MaximumQueryScanLines;
  658. LONG RemainedSize;
  659. LPBYTE pPlane;
  660. } HTCALLBACKPARAMS;
  661. typedef HTCALLBACKPARAMS FAR *PHTCALLBACKPARAMS;
  662. //
  663. // _HTCALLBACKFUNC
  664. //
  665. // The callback function is used to obtain the source and/destination bitmap
  666. // surface durning the halftone process, the halftone DLL will using call
  667. // back function is following sequences.
  668. //
  669. // 1) Callback to obtain block of the source bitmap, it depensds on
  670. // the maximum query scan lines limit by the caller. (in HTSURFACEINFO)
  671. //
  672. // 3) Callback to obtain block of the destination bitmap, it depends on
  673. // the maximum query scan lines limit by the caller. (in HTSURFACEINFO)
  674. //
  675. // 4) Repeat 1), 2), 3) until destination maximum queried scan lines are
  676. // processed then callback to the caller to release the processed
  677. // destination.
  678. //
  679. // 5) Repat 1), 2), 3) and 4) unitil all source/destination scan lines are
  680. // processed.
  681. //
  682. // The return value of the callback is a boolean value, if false the halftone
  683. // processed is interrupted and an erro code is returned, if callback function
  684. // return true then halftone DLL assume that all queried scan lines are
  685. // reachable by the return pointer (in the HTCALLBACKPARAMS data structure).
  686. //
  687. // NOTE: 1) If the callback function query for 100 lines and return value is
  688. // ture then there must all 100 scan lines can be accessable by the
  689. // halftone dll through the pointer(s).
  690. //
  691. // 2) If the caller has all the bitmap in the memory it should set the
  692. // maximum query scan lines count to the bitmap height to reduced the
  693. // callback calls.
  694. //
  695. // 3) If the caller do not need to released the halftoned destination
  696. // then it should not set the HTCBPF_NEED_SET_DEST_CALLBACK flag
  697. // to reduces callback calls.
  698. //
  699. // The callback function must be
  700. //
  701. // 1) Must return a 16-bit 'BOOLEAN' (TRUE/FALSE)
  702. // 2) Must 32-bit far function
  703. // 3) _loadds if you using your data segment at all from callback fuction
  704. //
  705. typedef BOOL (APIENTRY *_HTCALLBACKFUNC)(PHTCALLBACKPARAMS pHTCBParams);
  706. #define HTCALLBACKFUNCTION BOOL APIENTRY
  707. //
  708. // HALFTONEPATTERN
  709. //
  710. // The HALFTONEPATTERN data structure is used to describe the halftone
  711. // pattern which will be used by a particular device, if the device choosed
  712. // to used halftone DLL's default pattern then following data structure will
  713. // be automatically calculated by the halftone DLL.
  714. //
  715. // Flags - Various halftone flags for the cell, can be one
  716. // of the following:
  717. //
  718. // Width - Specified the width of the pattern in pels, this
  719. // field must not greater than MAX_HTPATTERN_WIDTH.
  720. //
  721. // Height - Specified the Width of the pattern in scan line,
  722. // this field only must not greater than
  723. // MAX_HTPATTERN_HEIGHT.
  724. //
  725. // pHTPatA
  726. // pHTPatB
  727. // pHTPatC - Specified caller defined pattern. The data items
  728. // points by these pointer must have minimum of
  729. // (Width * Height) bytes.
  730. //
  731. // These are the pointers to BYTE array contains
  732. // threshold data, the size of the array must be
  733. // 'Width * Height' in bytes. The data in the
  734. // array should range from 1 to 255, a zero (0)
  735. // indicate the pixel location is ignored.
  736. //
  737. // All thresholds values are indicate additive
  738. // intensities, a zero indicate black pixel always.
  739. // a 255 threshold value indicate the pixel always
  740. // turn on to white.
  741. //
  742. // Halftone DLL use this thresholds array with
  743. // device X, Y, PEL resolution and specified input/
  744. // output relationship to compute color
  745. // transformation
  746. //
  747. #define MAX_HTPATTERN_WIDTH 256
  748. #define MAX_HTPATTERN_HEIGHT 256
  749. //
  750. // Following are the predefined halftone pattern sizes for 'HTPatternIndex'
  751. //
  752. #define HTPAT_SIZE_2x2 0
  753. #define HTPAT_SIZE_2x2_M 1
  754. #define HTPAT_SIZE_4x4 2
  755. #define HTPAT_SIZE_4x4_M 3
  756. #define HTPAT_SIZE_6x6 4
  757. #define HTPAT_SIZE_6x6_M 5
  758. #define HTPAT_SIZE_8x8 6
  759. #define HTPAT_SIZE_8x8_M 7
  760. #define HTPAT_SIZE_10x10 8
  761. #define HTPAT_SIZE_10x10_M 9
  762. #define HTPAT_SIZE_12x12 10
  763. #define HTPAT_SIZE_12x12_M 11
  764. #define HTPAT_SIZE_14x14 12
  765. #define HTPAT_SIZE_14x14_M 13
  766. #define HTPAT_SIZE_16x16 14
  767. #define HTPAT_SIZE_16x16_M 15
  768. #define HTPAT_SIZE_SUPERCELL 16
  769. #define HTPAT_SIZE_SUPERCELL_M 17
  770. #define HTPAT_SIZE_USER 18
  771. #define HTPAT_SIZE_MAX_INDEX HTPAT_SIZE_USER
  772. #define HTPAT_SIZE_DEFAULT HTPAT_SIZE_SUPERCELL_M
  773. typedef struct _HALFTONEPATTERN {
  774. WORD cbSize;
  775. WORD Flags;
  776. WORD Width;
  777. WORD Height;
  778. LPBYTE pHTPatA;
  779. LPBYTE pHTPatB;
  780. LPBYTE pHTPatC;
  781. } HALFTONEPATTERN, FAR *PHALFTONEPATTERN;
  782. //
  783. // CIECOORD
  784. //
  785. // This data structure defined a C.I.E color space coordinate point, the
  786. // coordinate is in DECI4 format.
  787. //
  788. // x - x coordinate in C.I.E color space
  789. //
  790. // y - y coordinate in C.I.E color space.
  791. //
  792. // Y - The liminance for the color
  793. //
  794. //
  795. #define CIE_x_MIN (UDECI4)10
  796. #define CIE_x_MAX (UDECI4)8000
  797. #define CIE_y_MIN (UDECI4)10
  798. #define CIE_y_MAX (UDECI4)8500
  799. typedef struct _CIECOORD {
  800. UDECI4 x;
  801. UDECI4 y;
  802. UDECI4 Y;
  803. } CIECOORD;
  804. typedef CIECOORD FAR *PCIECOORD;
  805. //
  806. // CIEINFO
  807. //
  808. // This data structure describe the red, green, blue, cyan, magenta, yellow
  809. // and alignment white coordinate in the C.I.E color space plus the Luminance
  810. // factor, these are used to calculate the C.I.E. transform matrix and its
  811. // inversion.
  812. //
  813. // Red - Red primary color in CIRCOORD format.
  814. //
  815. // Green - Green primary color in CIRCOORD format.
  816. //
  817. // Blue - Blue primary color in CIRCOORD format.
  818. //
  819. // Cyan - Cyan primary color in CIRCOORD format.
  820. //
  821. // Magenta - Magenta primary color in CIRCOORD format.
  822. //
  823. // Yellow - Yellow primary color in CIRCOORD format.
  824. //
  825. // AlignmentWhite - Alignment white in CIECOORD format.
  826. //
  827. typedef struct _CIEINFO {
  828. CIECOORD Red;
  829. CIECOORD Green;
  830. CIECOORD Blue;
  831. CIECOORD Cyan;
  832. CIECOORD Magenta;
  833. CIECOORD Yellow;
  834. CIECOORD AlignmentWhite;
  835. } CIEINFO;
  836. typedef CIEINFO FAR *PCIEINFO;
  837. //
  838. // SOLIDDYESINFO
  839. //
  840. // This data structure specified device cyan, magenta and yellow dyes
  841. // concentration.
  842. //
  843. // MagentaInCyanDye - Mangenta component proportion in Cyan dye.
  844. //
  845. // YellowInCyanDye - Yellow component proportion in Cyan dye.
  846. //
  847. // CyanInMagentaDye - Cyan component proportion in Magenta dye.
  848. //
  849. // YellowInMagentaDye - Yellow component proportion in Magenta dye.
  850. //
  851. // CyanInYellowDye - Yellow component proportion in Cyan dye.
  852. //
  853. // MagentaInYellowDye - Magenta component proportion in Cyan dye.
  854. //
  855. // NOTE: all fields in this data structure is UDECI4 number, range from
  856. // UDECI4_0 to UDECI_4, ie,; 0.0 to 1.0, this a inpurity proportion
  857. // percentge in primary dye, for example a MagentaInCyanDye=1200
  858. // mean a 0.12% of magenta component is in device Cyan dye.
  859. //
  860. typedef struct _SOLIDDYESINFO {
  861. UDECI4 MagentaInCyanDye;
  862. UDECI4 YellowInCyanDye;
  863. UDECI4 CyanInMagentaDye;
  864. UDECI4 YellowInMagentaDye;
  865. UDECI4 CyanInYellowDye;
  866. UDECI4 MagentaInYellowDye;
  867. } SOLIDDYESINFO, FAR *PSOLIDDYESINFO;
  868. //
  869. // HTCOLORADJUSTMENT
  870. //
  871. // This data structure is a collection of the device color adjustments, it
  872. // can be changed at any calls.
  873. //
  874. // Flags - CLRADJF_NEGATIVE
  875. //
  876. // Produced negative picture
  877. //
  878. // CLRADJF_LOG_FILTER
  879. //
  880. // Specified a relative logarithm should
  881. // used to calculate the final density.
  882. //
  883. // IlluminantIndex - Specified the default illuminant of the light
  884. // source which the object will be view under.
  885. // The predefined value has ILLUMINANT_xxxx
  886. // form.
  887. //
  888. // RedPowerGamma - The n-th power applied to the red color
  889. // before any other color tramsformations,
  890. // this is an UDECI4 value.
  891. //
  892. // For example if the RED = 0.8 (DECI4=8000)
  893. // and the RedPowerGammaAdjustment = 0.7823
  894. // (DECI4 = 7823) then the red is equal to
  895. //
  896. // 0.7823
  897. // 0.8 = 0.8398
  898. //
  899. // GreenPowerGamma - The n-th power applied to the green color
  900. // before any other color transformations, this
  901. // is an UDECI4 value.
  902. //
  903. // BluePowerGamma - The n-th power applied to the blue color
  904. // before any other color transformations, this
  905. // is an UDECI4 value.
  906. //
  907. // NOTE: RedPowerGamma/GreenPowerGamma/BluePoweGamma are
  908. // UDECI4 values and range from 100 to 65535 if any
  909. // one of these values is less than 100 (0.01) then
  910. // halftone dll automatically set all power gamma
  911. // adjustments to selected default.
  912. //
  913. // ReferenceBlack - The black shadow reference for the colors
  914. // passed to the halftone dll, if a color's
  915. // lightness is darker than the reference black
  916. // then halftone dll will treated as completed
  917. // blackness and render it with device maximum
  918. // density.
  919. //
  920. // ReferenceWhite - The white hightlight reference for the colors
  921. // passed to the halftone dll, if a color's
  922. // lightness is lighter than the reference white
  923. // then halftone will treated as a specular
  924. // hightlight and redner with device maximum
  925. // intensity.
  926. //
  927. // NOTE: ReferenceBlack Range: 0.0000 - 0.4000
  928. // ReferenceWhite Range: 0.6000 - 1.0000
  929. //
  930. // Contrast - Primary color contrast adjustment, this is
  931. // a SHORT number range from -100 to 100, this
  932. // is the black to white ratio, -100 is the
  933. // lowest contrast, 100 is the highest and 0
  934. // indicate no adjustment.
  935. //
  936. // Brightness - The brightness adjustment, this is a SHORT
  937. // number range from -100 to 100, the brightness
  938. // is adjusted by apply to change the overall
  939. // saturations for the image, -100 is lowest
  940. // brightness, 100 is the hightest and a zero
  941. // indicate no adjustment.
  942. //
  943. // Colorfulness - The primary color are so adjusted that it
  944. // will either toward or away from black/white
  945. // colors, this is a SHORT number range from
  946. // -100 to 100. -100 has less colorful, 100 is
  947. // most colorfull, and a zero indicate no
  948. // adjustment.
  949. //
  950. // RedGreenTint - Tint adjustment between Red/Green primary
  951. // color, the value is a SHORT range from -100
  952. // to 100, it adjust color toward Red if number
  953. // is positive, adjust toward Green if number
  954. // is negative, and a zero indicate no
  955. // adjustment.
  956. //
  957. // NOTE: For Contrast/Brightness/Colorfulness/RedGreenTint adjustments, if its
  958. // value is outside of the range (-100 to 100) then halftone DLL
  959. // automatically set its to selected default value.
  960. //
  961. #ifndef _WINGDI_
  962. // in WinGDI.H
  963. //
  964. // The following are predefined alignment white for 'IlluminantIndex'.
  965. //
  966. // If ILLUMINANT_DEFAULT is specified
  967. //
  968. // 1) if pDeviceCIEInfo is NULL or pDeviceCIEInfo->Red.x eqaul to 0 then
  969. // halftone DLL automatically choosed approx. illuminant for the output
  970. // device.
  971. //
  972. // 2) if pDeviceCIEInfo is NOT null and pDeviceCIEInf->Red.x not equal to 0
  973. // then the 'White' field is used as illuminant alignment white.
  974. //
  975. // If other ILLUMINANT_xxxx is specified it will be used as alignment white
  976. // even pDeviceCIEInfo is not null.
  977. //
  978. // If the IlluminantIndex is > ILLUMINANT_MAX_INDEX then halftone DLL will
  979. // automatically choosed approx. illuminant even pDeviceCIEInfo is not NULL.
  980. //
  981. #define ILLUMINANT_DEVICE_DEFAULT 0
  982. #define ILLUMINANT_A 1
  983. #define ILLUMINANT_B 2
  984. #define ILLUMINANT_C 3
  985. #define ILLUMINANT_D50 4
  986. #define ILLUMINANT_D55 5
  987. #define ILLUMINANT_D65 6
  988. #define ILLUMINANT_D75 7
  989. #define ILLUMINANT_F2 8
  990. #define ILLUMINANT_MAX_INDEX ILLUMINANT_F2
  991. #define ILLUMINANT_TUNGSTEN ILLUMINANT_A
  992. #define ILLUMINANT_DAYLIGHT ILLUMINANT_C
  993. #define ILLUMINANT_FLUORESCENT ILLUMINANT_F2
  994. #define ILLUMINANT_NTSC ILLUMINANT_C
  995. #endif
  996. #define MIN_COLOR_ADJ COLOR_ADJ_MIN
  997. #define MAX_COLOR_ADJ COLOR_ADJ_MAX
  998. #define MIN_POWER_GAMMA RGB_GAMMA_MIN
  999. #define NTSC_POWER_GAMMA (UDECI4)22000
  1000. //
  1001. // The following is the default value
  1002. //
  1003. #define REFLECT_DENSITY_DEFAULT REFLECT_DENSITY_LOG
  1004. #define ILLUMINANT_DEFAULT 0
  1005. #define HT_DEF_RGB_GAMMA UDECI4_1
  1006. #define REFERENCE_WHITE_DEFAULT UDECI4_1
  1007. #define REFERENCE_BLACK_DEFAULT UDECI4_0
  1008. #define CONTRAST_ADJ_DEFAULT 0
  1009. #define BRIGHTNESS_ADJ_DEFAULT 0
  1010. #define COLORFULNESS_ADJ_DEFAULT 0
  1011. #define REDGREENTINT_ADJ_DEFAULT 0
  1012. #define CLRADJF_NEGATIVE CA_NEGATIVE
  1013. #define CLRADJF_LOG_FILTER CA_LOG_FILTER
  1014. #define CLRADJF_FLAGS_MASK (CLRADJF_NEGATIVE | \
  1015. CLRADJF_LOG_FILTER)
  1016. #ifndef _WINGDI_
  1017. //
  1018. // In WinGDI.H
  1019. //
  1020. #define REFERENCE_WHITE_MIN (UDECI4)6000
  1021. #define REFERENCE_WHITE_MAX UDECI4_1
  1022. #define REFERENCE_BLACK_MIN UDECI4_0
  1023. #define REFERENCE_BLACK_MAX (UDECI4)4000
  1024. typedef struct tagCOLORADJUSTMENT {
  1025. WORD caSize;
  1026. WORD caFlags;
  1027. WORD caIlluminantIndex;
  1028. WORD caRedGamma;
  1029. WORD caGreenGamma;
  1030. WORD caBlueGamma;
  1031. WORD caReferenceBlack;
  1032. WORD caReferenceWhite;
  1033. SHORT caContrast;
  1034. SHORT caBrightness;
  1035. SHORT caColorfulness;
  1036. SHORT caRedGreenTint;
  1037. } COLORADJUSTMENT, *PCOLORADJUSTMENT, FAR *LPCOLORADJUSTMENT;
  1038. #endif
  1039. #define HTCOLORADJUSTMENT COLORADJUSTMENT
  1040. typedef HTCOLORADJUSTMENT *PHTCOLORADJUSTMENT;
  1041. //
  1042. // HTINITINFO
  1043. //
  1044. // This data structure is a collection of the device characteristics and
  1045. // will used by the halftone DLL to carry out the color composition for the
  1046. // designated device.
  1047. //
  1048. // Version - Specified the version number of HTINITINFO data
  1049. // structure. for this version it should set to the
  1050. // HTINITINFO_VERSION
  1051. //
  1052. // Flags - Various flag defined the initialization
  1053. // requirements.
  1054. //
  1055. // HIF_SQUARE_DEVICE_PEL
  1056. //
  1057. // Specified that the device pel is square
  1058. // rather then round object. this only make
  1059. // differences when the field
  1060. // 'PelResolutionRatio' is greater than 0.01
  1061. // and it is not 1.0000.
  1062. //
  1063. // HIF_HAS_BLACK_DYE
  1064. //
  1065. // Indicate the device has separate black dye
  1066. // instead of mix cyan/magenta/yellow dyes to
  1067. // procduced black, this flag will be ignored
  1068. // if HIF_ADDITIVE_PRIMS is defined.
  1069. //
  1070. // HIF_ADDITIVE_PRIMS
  1071. //
  1072. // Specified that final device primaries are
  1073. // additively, that is adding device primaries
  1074. // will produce lighter result. (this is true
  1075. // for monitor devices and certainly false for
  1076. // the reflect devices such as printers).
  1077. //
  1078. // HIF_USE_8BPP_BITMASK
  1079. //
  1080. // Specified use CMYBitMask8BPP field is used,
  1081. // when destination surface is BMF_8BPP_VGA256
  1082. // see CMYBitMask8BPP field for more detail
  1083. //
  1084. // HIF_INVERT_8BPP_BITMASK_IDX
  1085. // Render the 8bpp mask mode with inversion of
  1086. // its indices. This is implemented for fix
  1087. // Windows GDI rop problem, it will render as
  1088. // RGB additive indices. The caller must
  1089. // do a inversion of final image's Indices
  1090. // (Idx = ~Idx or Idx ^= 0xFF) to get the
  1091. // correct CMY332 data. When this bit is
  1092. // set, the HT_Get8BPPMaskPalette must have
  1093. // its pPaletteEntry[0] Initialized to as
  1094. //
  1095. // pPaletteEntry[0].peRed = 'R';
  1096. // pPaletteEntry[0].peGreen = 'G';
  1097. // pPaletteEntry[0].peBlue = 'B';
  1098. // pPaletteEntry[0].peFlags = '0';
  1099. //
  1100. // to indicate that a RGB indices inverted
  1101. // palette should be returned and not the
  1102. // standard CMY palette (Index 0 is white and
  1103. // Index 255 is black).
  1104. //
  1105. // The inverted palette has is first entry as
  1106. // BLACK and last entry as WHITE
  1107. //
  1108. // pPaletteEntry[0].peRed = 0x00;
  1109. // pPaletteEntry[0].peGreen = 0x00;
  1110. // pPaletteEntry[0].peBlue = 0x00;
  1111. // pPaletteEntry[0].peFlags = 0x00;
  1112. //
  1113. // Notice that this setting WILL NOT work on
  1114. // earlier version of halftone (Windows 2000
  1115. // and earlier), so the caller must check the
  1116. // OS version or check the returned palette
  1117. // to ensure that first palette entry is
  1118. // BLACk rather than WHITE. If first
  1119. // entries is WHITE after initialized to
  1120. // 'R', 'G', 'B', '0' then this is a older
  1121. // version of system that does not recongnized
  1122. // the initialzed value. In this case the
  1123. // caller should not invert (Idx ^= 0xFF) the
  1124. // halftoned imaged indices when render it
  1125. // to the devices, because the halftone
  1126. // images in this case is CMY based already.
  1127. //
  1128. //
  1129. // HTPatternIndex - Default halftone pattern index number, the
  1130. // indices is predefine as HTPAT_SIZE_xxxx, this
  1131. // field only used if pHTalftonePattern pointer is
  1132. // not NULL.
  1133. //
  1134. // DevicePowerGamma - This field is used to adjust halftone pattern
  1135. // cell's gamma, the gamma applied to all the rgb
  1136. // colors, see gamma description in
  1137. // HTCOLORADJUSTMENT above.
  1138. //
  1139. // HTCallBackFunction - a 32-bit pointer to the caller supplied callback
  1140. // function which used by the halftone DLL to
  1141. // obtained the source/destination bitmap pointer
  1142. // durning the halftone process, if this pointer is
  1143. // NULL then halftone dll assume that caller does
  1144. // not need any callback and generate an error if a
  1145. // callback is needed.
  1146. //
  1147. // pHalftonePattern - pointer to HALFTONEPATTERN data structure, see
  1148. // descriptions above, if this pointer is NULL then
  1149. // halftone using HTPatternIndex field to select
  1150. // default halftone dll's pattern.
  1151. //
  1152. // pInputRGBInfo - Specified input's rgb color' coordinates within
  1153. // the C.I.E. color spaces. If this pointer is NULL
  1154. // or pInputRGBInfo->Red.x is 0 (UDECI4_0) then it
  1155. // default using NTSC standard to convert the input
  1156. // colors.
  1157. //
  1158. // pDeviceCIEInfo - Specified device primary color coordinates within
  1159. // the C.I.E. color space, see CIEINFO data
  1160. // structure, if the pointer is NULL or
  1161. // pDeviceCIEInfo->Red.x is 0 (UDECI4_0) then
  1162. // halftone DLL choose the default for the output
  1163. // device.
  1164. //
  1165. // pDeviceSolidDyesInfo - Specified device solid dyes concentrations, this
  1166. // field will be ignored if HIF_ADDITIVE_PRIMS flag
  1167. // is defined, if HIF_ADDITIVE_PRIMS is not set and
  1168. // this pointer is NULL then halftone dll choose
  1169. // approximate default for the output device.
  1170. //
  1171. // DeviceResXDPI - Specified the device horizontal (x direction)
  1172. // resolution in 'dots per inch' measurement.
  1173. //
  1174. // DeviceResYDPI - Specified the device vertical (y direction)
  1175. // resolution in 'dots per inch' measurement.
  1176. //
  1177. // DevicePelsDPI - Specified the device pel/dot/nozzle diameter
  1178. // (if rounded) or width/height (if squared) in
  1179. // 'dots per inch' measurement.
  1180. //
  1181. // This value is measure as if each pel only touch
  1182. // each other at edge of the pel.
  1183. //
  1184. // If this value is 0, then it assume that each
  1185. // device pel is rectangular shape and has
  1186. // DeviceResXDPI in X direction and DeviceResYDPI
  1187. // in Y direction.
  1188. //
  1189. // DefHTColorAdjustment - Specified the default color adjustment for
  1190. // this device. see HTCOLORADJUSTMENT data
  1191. // structure above for detail.
  1192. //
  1193. // DeviceRGamma
  1194. // DeviceGGamma
  1195. // DeviceBGamma - Red, Green, Blue gammas for the device
  1196. //
  1197. // CMYBitMask8BPP - only used for the BMF_8BPP_VGA256 destination
  1198. // surface. It indicate the how the device surface
  1199. // color are translated, when HTF_USE_8BPP_BITMASK
  1200. // bit is turn on, this byte is the CYAN. MAGENTA
  1201. // YELLOW dye levels indicator.
  1202. //
  1203. // This byte indicate how many levels for each cyan,
  1204. // magenta and yellow color, and this is how the
  1205. // halftone write to the destination surface.
  1206. //
  1207. //
  1208. // Bit 7 6 5 4 3 2 1 0
  1209. // | | | | | |
  1210. // +---+ +---+ +=+
  1211. // | | |
  1212. // | | +-- Yellow 0-3 (4 levels)
  1213. // | |
  1214. // | +-- Magenta 0-7 (8 levels)
  1215. // |
  1216. // +-- Cyan 0-7 (8 levels)
  1217. //
  1218. //
  1219. // The maximum in the bits configuration is 3:3:2,
  1220. // Other invalid combination generate different
  1221. // output as
  1222. //
  1223. // 0 - Indicate a gray scale output, the output
  1224. // byte is a 0-255 of 256 levels gray
  1225. //
  1226. // 1 - a 5x5x5 cube output, each cyan, magenta
  1227. // and yellow color are 0-4 of 5 levels and
  1228. // each color is in 25% increment.
  1229. //
  1230. // 2 - a 6x6x6 cube output, each cyan, magenta
  1231. // and yellow color are 0-5 of 6 levels and
  1232. // each color is in 20% increment.
  1233. //
  1234. // Other value that have 0 level in one of cyan,
  1235. // magenta or yellow will generate an error.
  1236. //
  1237. // To obtain a palette for each of configuration
  1238. // you can call HT_Get8BPPMaskPalette()
  1239. //
  1240. #define HTINITINFO_VERSION2 (DWORD)0x48546902 // 'HTi\02'
  1241. #define HTINITINFO_VERSION (DWORD)0x48546903 // 'HTi\03'
  1242. #define HTINITINFO_V3_CB_EXTRA 8
  1243. #define HIF_SQUARE_DEVICE_PEL 0x0001
  1244. #define HIF_HAS_BLACK_DYE 0x0002
  1245. #define HIF_ADDITIVE_PRIMS 0x0004
  1246. #define HIF_USE_8BPP_BITMASK 0x0008
  1247. #define HIF_INK_HIGH_ABSORPTION 0x0010
  1248. #define HIF_INK_ABSORPTION_INDICES 0x0060
  1249. #define HIF_DO_DEVCLR_XFORM 0x0080
  1250. #define HIF_USED_BY_DDI 0x0100
  1251. #define HIF_PRINT_DRAFT_MODE 0x0200
  1252. #define HIF_INVERT_8BPP_BITMASK_IDX 0x0400
  1253. #define HIF_BIT_MASK (HIF_SQUARE_DEVICE_PEL | \
  1254. HIF_HAS_BLACK_DYE | \
  1255. HIF_ADDITIVE_PRIMS | \
  1256. HIF_USE_8BPP_BITMASK | \
  1257. HIF_INK_HIGH_ABSORPTION | \
  1258. HIF_INK_ABSORPTION_INDICES | \
  1259. HIF_DO_DEVCLR_XFORM | \
  1260. HIF_PRINT_DRAFT_MODE | \
  1261. HIF_INVERT_8BPP_BITMASK_IDX)
  1262. #define HIF_INK_ABSORPTION_IDX0 0x0000
  1263. #define HIF_INK_ABSORPTION_IDX1 0x0020
  1264. #define HIF_INK_ABSORPTION_IDX2 0x0040
  1265. #define HIF_INK_ABSORPTION_IDX3 0x0060
  1266. #define HIF_HIGHEST_INK_ABSORPTION (HIF_INK_HIGH_ABSORPTION | \
  1267. HIF_INK_ABSORPTION_IDX3)
  1268. #define HIF_HIGHER_INK_ABSORPTION (HIF_INK_HIGH_ABSORPTION | \
  1269. HIF_INK_ABSORPTION_IDX2)
  1270. #define HIF_HIGH_INK_ABSORPTION (HIF_INK_HIGH_ABSORPTION | \
  1271. HIF_INK_ABSORPTION_IDX1)
  1272. #define HIF_NORMAL_INK_ABSORPTION HIF_INK_ABSORPTION_IDX0
  1273. #define HIF_LOW_INK_ABSORPTION (HIF_INK_ABSORPTION_IDX1)
  1274. #define HIF_LOWER_INK_ABSORPTION (HIF_INK_ABSORPTION_IDX2)
  1275. #define HIF_LOWEST_INK_ABSORPTION (HIF_INK_ABSORPTION_IDX3)
  1276. #define HTBITMASKPALRGB_DW (DWORD)'0BGR'
  1277. #define SET_HTBITMASKPAL2RGB(pPal) (*((LPDWORD)(pPal)) = HTBITMASKPALRGB_DW)
  1278. #define IS_HTBITMASKPALRGB(pPal) (*((LPDWORD)(pPal)) == (DWORD)0)
  1279. //
  1280. // This defined the minimum acceptable device resolutions
  1281. //
  1282. #define MIN_DEVICE_DPI 12
  1283. typedef struct _HTINITINFO {
  1284. DWORD Version;
  1285. WORD Flags;
  1286. WORD HTPatternIndex;
  1287. _HTCALLBACKFUNC HTCallBackFunction;
  1288. PHALFTONEPATTERN pHalftonePattern;
  1289. PCIEINFO pInputRGBInfo;
  1290. PCIEINFO pDeviceCIEInfo;
  1291. PSOLIDDYESINFO pDeviceSolidDyesInfo;
  1292. UDECI4 DevicePowerGamma;
  1293. WORD DeviceResXDPI;
  1294. WORD DeviceResYDPI;
  1295. WORD DevicePelsDPI;
  1296. HTCOLORADJUSTMENT DefHTColorAdjustment;
  1297. UDECI4 DeviceRGamma;
  1298. UDECI4 DeviceGGamma;
  1299. UDECI4 DeviceBGamma;
  1300. BYTE CMYBitMask8BPP;
  1301. BYTE bReserved;
  1302. } HTINITINFO, FAR *PHTINITINFO;
  1303. //
  1304. // BITBLTPARAMS
  1305. //
  1306. // This data structure is used when calling the HT_HalftoneBitmap(), it
  1307. // defined where to halftone from the source bitmap to the destination
  1308. // bitmap.
  1309. //
  1310. // Flags - Various flags defined how the source, destination and
  1311. // source mask should be calculated.
  1312. //
  1313. // BBPF_HAS_DEST_CLIPRECT
  1314. //
  1315. // Indicate that there is a clipping
  1316. // rectangle for the destination and it is
  1317. // specified by DestClipXLeft, DestClipXRight,
  1318. // DestClipYTop and DestClipYBottom
  1319. //
  1320. // BBPF_USE_ADDITIVE_PRIMS
  1321. //
  1322. // Specified if the halftone result will be
  1323. // using Red/Green/Blue primary color or
  1324. // using Cyan/Magenta/Yellow primary color, depends
  1325. // on the destination surface format as
  1326. //
  1327. // BMF_1BPP:
  1328. //
  1329. // Additive Prims: 0=Black, 1=White
  1330. // Substractive Prims: 0=White, 1=Black
  1331. //
  1332. // BMF_4BPP_VGA16:
  1333. //
  1334. // Always using RED, GREEN, BLUE primaries, and
  1335. // ignored this flag.
  1336. //
  1337. // BMF_4BPP:
  1338. //
  1339. // Additive Prims: RED, GREEN. BLUE
  1340. // Substractive Prims: CYAN, MAGENTA, YELLOW
  1341. //
  1342. // The order of the RGB, or CMY is specified by
  1343. // DestPrimaryOrder field. (see below)
  1344. //
  1345. // BMF_8BPP_VGA256:
  1346. // BMF_16BPP_555:
  1347. // BMF_16BPP_565:
  1348. // BMF_24BPP:
  1349. // BMF_32BPP:
  1350. //
  1351. // Always using RED, GREEN, BLUE primaries, and
  1352. // ignored this flag.
  1353. //
  1354. // BBPF_NEGATIVE_DEST
  1355. //
  1356. // Invert the final destination surface, so
  1357. // after the halftone it just the negative
  1358. // result from the source.
  1359. //
  1360. // BBPF_INVERT_SRC_MASK
  1361. //
  1362. // Invert the source mask bits before using
  1363. // it, this in effect make mask bit 0 (off)
  1364. // for copy the source and mask bit 1 (on)
  1365. // for preserved the destination.
  1366. //
  1367. // BBPF_HAS_BANDRECT
  1368. //
  1369. // Set to specified that rclBand RECTL data structrue
  1370. // should be used to compute for the caller's
  1371. // destination bitmap buffer.
  1372. //
  1373. // If this flag is not set then halftone dll assumed
  1374. // the caller's bitmap buffer is same width/height
  1375. // as specified in the destination HTSURFACEINFO.
  1376. //
  1377. // BBPF_BW_ONLY
  1378. //
  1379. // Produced monochrome version of the output even the
  1380. // destination is the color device.
  1381. //
  1382. // BBPF_TILE_SRC
  1383. //
  1384. // Tilt the source to destination and source bitmap
  1385. // when this bit is set the source mask is ignored.
  1386. //
  1387. // BBPF_ICM_ON
  1388. //
  1389. // When set, the halftone will use the input color
  1390. // directly without any modification
  1391. //
  1392. // BBPF_NO_ANTIALIASING
  1393. //
  1394. // Turn off anti-aliasing when halftone
  1395. //
  1396. //
  1397. // DestPrimaryOrder- Specified destination primary color order, it can be
  1398. // either PRIMARY_ORDER_RGB or PRIMARY_ORDER_CMY group, it
  1399. // depends on the surface format has following meaning.
  1400. //
  1401. // BMF_1BPP:
  1402. //
  1403. // This field is ignored.
  1404. //
  1405. // BMF_4BPP_VGA16:
  1406. //
  1407. // This field automatically set to PRIMARY_ORDER_BGR
  1408. // by the halftone DLL.
  1409. //
  1410. // BMF_4BPP:
  1411. //
  1412. // for each byte there are two indices entries, and
  1413. // for each nibble has following meaning, notice that
  1414. // bit 3/7 always set to 0, the index number only
  1415. // range from 0 to 7.
  1416. //
  1417. // PRIMARY_ORDER_abc
  1418. // |||
  1419. // ||+-- bit 0/4
  1420. // ||
  1421. // |+--- bit 1/5
  1422. // |
  1423. // +---- bit 2/7
  1424. //
  1425. // BMF_8BPP_VGA256:
  1426. //
  1427. // This field is ignored, the palette entries and its
  1428. // order is defined by halftone DLL at run time, the
  1429. // caller should get the palette for the VGA256
  1430. // surface through HT_Get8BPPFormatPalette() API call.
  1431. //
  1432. // BMF_16BPP_555:
  1433. //
  1434. // PRIMARY_ORDER_abc
  1435. // |||
  1436. // ||+-- bit 0-4 (5 bits)
  1437. // ||
  1438. // |+--- bit 5-9 (5 bits)
  1439. // |
  1440. // +---- bit 10-14 (5 bits)
  1441. //
  1442. // BMF_16BPP_565:
  1443. //
  1444. // This field is ignored, it alway assume BGR as
  1445. // shown below
  1446. //
  1447. // PRIMARY_ORDER_BGR
  1448. // |||
  1449. // ||+-- bit 0-4 (5 bits)
  1450. // ||
  1451. // |+--- bit 5-10 (6 bits)
  1452. // |
  1453. // +---- bit 11-15 (5 bits)
  1454. //
  1455. // BMF_24BPP:
  1456. //
  1457. // This field is ignored, it alway assume BGR as
  1458. // shown below
  1459. //
  1460. // PRIMARY_ORDER_BGR
  1461. // |||
  1462. // ||+-- bit 0-7 (8 bits)
  1463. // ||
  1464. // |+--- bit 8-15 (8 bits)
  1465. // |
  1466. // +---- bit 16-23 (8 bits)
  1467. //
  1468. // BMF_32BPP:
  1469. //
  1470. // PRIMARY_ORDER_abc
  1471. // |||
  1472. // ||+-- bit 0-7 (8 bits)
  1473. // ||
  1474. // |+--- bit 8-15 (8 bits)
  1475. // |
  1476. // +---- bit 16-23 (8 bits)
  1477. //
  1478. //
  1479. // rclSrc - RECTL data structure defined the source rectangle area
  1480. // to be bitblt from, fields in this data structure are
  1481. // relative to the source HTSURFACEINFO's width/height.
  1482. //
  1483. // rclDest - RECTL data structure defined the destination rectangle
  1484. // area to be bitblt to, fields in this data structure are
  1485. // relative to the destination HTSURFACEINFO's width/height.
  1486. //
  1487. // rclClip - RECTL data structure defined the destination clipping
  1488. // rectangle area, fields in this data structure are
  1489. // relative to the destination HTSURFACEINFO's width/height.
  1490. //
  1491. // rclBand - RECTL data structure defined the device banding rectangle
  1492. // area, fields in this data structure are relative to the
  1493. // destination HTSURFACEINFO's width/height.
  1494. //
  1495. // This RECTL only used if BBPF_HAS_BANDRECT flag is set,
  1496. // when this flag is set, halftone DLL will automatically
  1497. // clipped the destination to this rectangle area and
  1498. // copied this rectangle to the output buffer with rclBand's
  1499. // left/top aligned to the buffer's physical origin. The
  1500. // destination's buffer (bitmap) must the format specified
  1501. // in the destination HTSURFACEINFO.
  1502. //
  1503. // If rclBand rectangle is larger than the logical destination
  1504. // surface size (destination HTSURFACEINFO), halftone dll
  1505. // still move the the band's left/top location to the 0/0
  1506. // origin and extra width/height is remain unchanged.
  1507. //
  1508. // The rclBand normally is used for device which does not
  1509. // have enough memory to hold all the destination surface
  1510. // at one time, it just like to repeatly using same buffer
  1511. // to temporary holding the halftone results.
  1512. //
  1513. // The rclBand's left/top/right/bottom may not be negative
  1514. // numbers.
  1515. //
  1516. // ptlSrcMask - a POINTL data structure to specified the logical
  1517. // coordinate of starting point for the source mask bitmap,
  1518. // this field only used if a HTSURFACEINFO for the source
  1519. // mask is passed.
  1520. //
  1521. // This source mask bitmap must always monochrome and its
  1522. // width/height must
  1523. //
  1524. // Width >= ptlSrcMask.x + source surface width.
  1525. // Height >= ptlSrcMask.y + source surface height;
  1526. //
  1527. //
  1528. // NOTE: 1) all RECTL data structure are left/top inclusive and right/bottom
  1529. // exclusive.
  1530. //
  1531. // 2) if rclSrc rectangle is not will ordered it specified the source
  1532. // should be inverted before process for not ordered directions.
  1533. //
  1534. // 3) if rclDest rectangle is not will ordered it specified the
  1535. // destination should be inverted after process for not ordered
  1536. // directions.
  1537. //
  1538. // 4) if BBPF_HAS_DEST_CLIPRECT flag is set and rclClip is not well
  1539. // ordered or its left equal to its right, or its top equal to its
  1540. // bottom, then all destination are clipped, destination will not
  1541. // be updated that is.
  1542. //
  1543. // 5) if BBPF_HAS_BANDRECT flag is set and rclBand is not well orderd
  1544. // or it left eqaul to its right, or its top eqaul to its bottom,
  1545. // then a HTERR_INVALID_BANDRECT is returned.
  1546. //
  1547. //
  1548. //
  1549. // ABIF_USE_CONST_ALPHA_VALUE - The ConstAlphaValue field is used
  1550. // ABIF_DSTPAL_IS_RGRBUAD - The pDstPal Pointed to RGBQUAD structure
  1551. // array rather PALETTEENTRY array
  1552. // ABIF_SRC_ALPHA_IS_PREMUL - In 32bpp per-pixel alpha blending the
  1553. // source RGB already pre-multiply with its
  1554. // per-pixel alpha value
  1555. // ABIF_BLEND_DEST_ALPHA - Only valid if source and destination
  1556. // both are 32bpp and per-pixel alpha is used
  1557. // d = s + (1 - s) * d
  1558. //
  1559. #define ABIF_USE_CONST_ALPHA_VALUE 0x01
  1560. #define ABIF_DSTPAL_IS_RGBQUAD 0x02
  1561. #define ABIF_SRC_ALPHA_IS_PREMUL 0x04
  1562. #define ABIF_BLEND_DEST_ALPHA 0x08
  1563. typedef struct _ABINFO {
  1564. BYTE Flags;
  1565. BYTE ConstAlphaValue;
  1566. WORD cDstPal;
  1567. LPPALETTEENTRY pDstPal;
  1568. } ABINFO, *PABINFO;
  1569. #define BBPF_HAS_DEST_CLIPRECT 0x0001
  1570. #define BBPF_USE_ADDITIVE_PRIMS 0x0002
  1571. #define BBPF_NEGATIVE_DEST 0x0004
  1572. #define BBPF_INVERT_SRC_MASK 0x0008
  1573. #define BBPF_HAS_BANDRECT 0x0010
  1574. #define BBPF_BW_ONLY 0x0020
  1575. #define BBPF_TILE_SRC 0x0040
  1576. #define BBPF_ICM_ON 0x0080
  1577. #define BBPF_NO_ANTIALIASING 0x0100
  1578. #define BBPF_DO_ALPHA_BLEND 0x0200
  1579. typedef struct _BITBLTPARAMS {
  1580. WORD Flags;
  1581. BYTE bReserved;
  1582. BYTE DestPrimaryOrder;
  1583. PABINFO pABInfo;
  1584. RECTL rclSrc;
  1585. RECTL rclDest;
  1586. RECTL rclClip;
  1587. RECTL rclBand;
  1588. POINTL ptlBrushOrg;
  1589. POINTL ptlSrcMask;
  1590. LPVOID pBBData;
  1591. } BITBLTPARAMS, FAR *PBITBLTPARAMS;
  1592. //
  1593. // DEVICEHALFTONEINFO
  1594. //
  1595. // This data structure is passed for every HT_xxx api calls except the
  1596. // HT_CreateDeviceHalftoneInfo() which return the pointer to this data
  1597. // structure. It is used to identify the device color characteristics
  1598. // durning the halftone process.
  1599. //
  1600. // DeviceOwnData - this field will initially set to NULL, and will be
  1601. // used by the caller to stored useful information
  1602. // such as handle/pointer.
  1603. //
  1604. // cxPattern - width of the halftone pattern in pels
  1605. //
  1606. // cyPattern - height of the halftone pattern in pels.
  1607. //
  1608. // HTColorAdjustment - Current default color adjustment, if an halftone
  1609. // APIs required a PHTCOLORADJUSTMENT parameter and its
  1610. // passed as NULL pointer then default color adjustment
  1611. // is taken from here, the caller can change the
  1612. // HTCOLORADJUSTMENT data structure to affect all the
  1613. // color adjustment on this device.
  1614. //
  1615. typedef struct _DEVICEHALFTONEINFO {
  1616. ULONG_PTR DeviceOwnData;
  1617. WORD cxPattern;
  1618. WORD cyPattern;
  1619. HTCOLORADJUSTMENT HTColorAdjustment;
  1620. } DEVICEHALFTONEINFO;
  1621. typedef DEVICEHALFTONEINFO FAR *PDEVICEHALFTONEINFO;
  1622. typedef PDEVICEHALFTONEINFO FAR *PPDEVICEHALFTONEINFO;
  1623. //
  1624. // CHBINFO
  1625. //
  1626. // This data structure is one of the parameter passed to the halftone entry
  1627. // point HT_CreateHalftoneBrush();
  1628. //
  1629. // Flags - one or more following flags can be defined
  1630. //
  1631. // CHBF_BW_ONLY
  1632. //
  1633. // Create only black/white even the device is
  1634. // color.
  1635. //
  1636. // CHBF_USE_ADDITIVE_PRIMS
  1637. //
  1638. //
  1639. // Specified if the halftone result will be
  1640. // using Red/Green/Blue primary color or using
  1641. // Cyan/Magenta/Yellow primary color, depends
  1642. // on the destination surface format as
  1643. //
  1644. // BMF_1BPP:
  1645. //
  1646. // Additive Prims: 0=Black, 1=White
  1647. // Substractive Prims: 0=White, 1=Black
  1648. //
  1649. // BMF_4BPP_VGA16:
  1650. // BMF_8BPP_VGA256:
  1651. // BMF_16BPP_555:
  1652. // BMF_24BPP:
  1653. //
  1654. // Always using RED, GREEN, BLUE primaries
  1655. // and this flag is ignored.
  1656. //
  1657. // BMF_4BPP:
  1658. //
  1659. // Additive Prims: RED, GREEN. BLUE
  1660. // Substractive Prims: CYAN, MAGENTA, YELLOW
  1661. //
  1662. // The order of the RGB, or CMY is specified
  1663. // by DestPrimaryOrder field. (see below)
  1664. //
  1665. // CHBF_NEGATIVE_BRUSH
  1666. //
  1667. // Create the negative version of the brush.
  1668. //
  1669. //
  1670. // DestSurfaceFormat - One of the following can be specified,
  1671. //
  1672. // BMF_1BPP, BMF_4BPP, BMF_4BPP_VGA16,
  1673. // BMF_8BPP_VGA256, BMF_16BPP_555.
  1674. //
  1675. // for VGA16, VGA256, 16BPP_555 surface format
  1676. // see HTSURFACEINFO for descriptions.
  1677. //
  1678. // DestScanLineAlignBytes - Alignment bytes needed for each output pattern
  1679. // scan line, some common ones are
  1680. //
  1681. // BMF_ALIGN_BYTE ( 8-bit aligned)
  1682. // BMF_ALIGN_WORD (16-bit aligned)
  1683. // BMF_ALIGN_DWORD (32-bit aligned)
  1684. // BMF_ALIGN_QWORD (64-bit aligned)
  1685. //
  1686. // DestPrimaryOrder - Specified destination primary color order, it can
  1687. // be either PRIMARY_ORDER_RGB or PRIMARY_ORDER_CMY
  1688. // group, it depends on the surface format has
  1689. // following meaning.
  1690. //
  1691. // BMF_1BPP:
  1692. //
  1693. // This field is ignored.
  1694. //
  1695. //
  1696. // BMF_4BPP_VGA16:
  1697. //
  1698. // This field automatically set to
  1699. // PRIMARY_ORDER_BGR by the halftone DLL.
  1700. //
  1701. // BMF_4BPP:
  1702. //
  1703. // for each byte there are two indices
  1704. // entries, and for each nibble has following
  1705. // meaning, notice that bit 3/7 always set to
  1706. // 0, the index number only range from 0 to 7.
  1707. //
  1708. // PRIMARY_ORDER_abc
  1709. // |||
  1710. // ||+-- bit 0/4
  1711. // ||
  1712. // |+--- bit 1/5
  1713. // |
  1714. // +---- bit 2/7
  1715. //
  1716. //
  1717. // BMF_8BPP_VGA256:
  1718. //
  1719. // This field is ignored, the palette entries
  1720. // and its order is defined by halftone DLL
  1721. // at run time, the caller should get the
  1722. // palette for the VGA256 surface through
  1723. // HT_Get8BPPFormatPalette() API call.
  1724. //
  1725. // BMF_16BPP_555:
  1726. //
  1727. // PRIMARY_ORDER_abc
  1728. // |||
  1729. // ||+-- bit 0-4 (5 bits)
  1730. // ||
  1731. // |+--- bit 5-9 (5 bits)
  1732. // |
  1733. // +---- bit 10-15 (5 bits)
  1734. //
  1735. //
  1736. //
  1737. #define CHBF_BW_ONLY 0x01
  1738. #define CHBF_USE_ADDITIVE_PRIMS 0x02
  1739. #define CHBF_NEGATIVE_BRUSH 0x04
  1740. #define CHBF_BOTTOMUP_BRUSH 0x08
  1741. #define CHBF_ICM_ON 0x10
  1742. typedef struct _CHBINFO {
  1743. BYTE Flags;
  1744. BYTE DestSurfaceFormat;
  1745. BYTE DestScanLineAlignBytes;
  1746. BYTE DestPrimaryOrder;
  1747. } CHBINFO;
  1748. //
  1749. // STDMONOPATTERN
  1750. //
  1751. // This data structure is used when calling the HT_CreateStdMonoPattern().
  1752. //
  1753. // Flags - One or more following flags may be defined
  1754. //
  1755. // SMP_TOPDOWN
  1756. //
  1757. // Specified that first scan line of the pattern
  1758. // bitmap will be the viewing top, if this flag
  1759. // is not defined then the last scan line is the
  1760. // viewing top.
  1761. //
  1762. // SMP_0_IS_BLACK
  1763. //
  1764. // specified that the in the bitmap a bit value
  1765. // 0 = black and bit value 1=white, if this flag
  1766. // is not defined then bit value 0=white and
  1767. // bit value 1=black.
  1768. //
  1769. // ScanLineAlignBytes - Alignment bytes needed for each output pattern scan
  1770. // line, some common ones are
  1771. //
  1772. // BMF_ALIGN_BYTE ( 8-bit aligned)
  1773. // BMF_ALIGN_WORD (16-bit aligned)
  1774. // BMF_ALIGN_DWORD (32-bit aligned)
  1775. // BMF_ALIGN_QWORD (64-bit aligned)
  1776. //
  1777. // PatternIndex - Specified the pattern index number, this has the
  1778. // predefined value as HT_STDMONOPAT_xxxx. If a invalid
  1779. // index number is passed then it return an error
  1780. // HTERR_INVALID_STDMONOPAT_INDEX is returned.
  1781. //
  1782. // LineWidth - This field only applied to the pattern which has
  1783. // lines in them, the value range from 0-255 (byte) and
  1784. // it repesent as LineWidth/1000 of inch, for example
  1785. // a 3 indicate 3/1000 = 0.003 inch width, if this value
  1786. // is less than the device minimum pel size, it will
  1787. // default to the 1 pel, the maximum is 255/1000 = 0.255
  1788. // inch width.
  1789. //
  1790. // If a zero is specified then it halftone will using
  1791. // default line width settting.
  1792. //
  1793. // LinesPerInch - This field only applied to the pattern wich has lines
  1794. // in them, the value range from 0 to 255 (byte). The
  1795. // LinesPerInch is calculated in the perpendicular
  1796. // direction of two parallel lines, the distances
  1797. // between two parallel lines that is.
  1798. //
  1799. // If a zero is specified then it halftone will using
  1800. // default line per inch setting.
  1801. //
  1802. // BytesPerScanLine - If will be filled by halftone dll to specified the
  1803. // size in bytes for each scan line in the pattern.
  1804. //
  1805. // cxPels - It will be filled by halftone dll of the final
  1806. // pattern's width in pel.
  1807. //
  1808. // cyPels - It will be filled by halftone dll of the final
  1809. // pattern's height in scan line.
  1810. //
  1811. // pPattern - Specified the memory location where the pattern will
  1812. // be stored, if this field is NULL then it will fill in
  1813. // the width/height fields.
  1814. //
  1815. //
  1816. #define HT_SMP_HORZ_LINE 0
  1817. #define HT_SMP_VERT_LINE 1
  1818. #define HT_SMP_HORZ_VERT_CROSS 2
  1819. #define HT_SMP_DIAG_15_LINE_UP 3
  1820. #define HT_SMP_DIAG_15_LINE_DOWN 4
  1821. #define HT_SMP_DIAG_15_CROSS 5
  1822. #define HT_SMP_DIAG_30_LINE_UP 6
  1823. #define HT_SMP_DIAG_30_LINE_DOWN 7
  1824. #define HT_SMP_DIAG_30_CROSS 8
  1825. #define HT_SMP_DIAG_45_LINE_UP 9
  1826. #define HT_SMP_DIAG_45_LINE_DOWN 10
  1827. #define HT_SMP_DIAG_45_CROSS 11
  1828. #define HT_SMP_DIAG_60_LINE_UP 12
  1829. #define HT_SMP_DIAG_60_LINE_DOWN 13
  1830. #define HT_SMP_DIAG_60_CROSS 14
  1831. #define HT_SMP_DIAG_75_LINE_UP 15
  1832. #define HT_SMP_DIAG_75_LINE_DOWN 16
  1833. #define HT_SMP_DIAG_75_CROSS 17
  1834. #define HT_SMP_PERCENT_SCREEN_START (HT_SMP_DIAG_75_CROSS + 1)
  1835. #define HT_SMP_PERCENT_SCREEN(x) (x + HT_SMP_PERCENT_SCREEN_START)
  1836. #define HT_SMP_MAX_INDEX HT_SMP_PERCENT_SCREEN(100)
  1837. #define SMP_TOPDOWN W_BITPOS(0)
  1838. #define SMP_0_IS_BLACK W_BITPOS(1)
  1839. typedef struct _STDMONOPATTERN {
  1840. WORD Flags;
  1841. BYTE ScanLineAlignBytes;
  1842. BYTE PatternIndex;
  1843. BYTE LineWidth;
  1844. BYTE LinesPerInch;
  1845. WORD BytesPerScanLine;
  1846. WORD cxPels;
  1847. WORD cyPels;
  1848. LPBYTE pPattern;
  1849. } STDMONOPATTERN;
  1850. typedef STDMONOPATTERN FAR *PSTDMONOPATTERN;
  1851. //
  1852. // Following is used in ConvertColorTable
  1853. //
  1854. #define CCTF_BW_ONLY 0x0001
  1855. #define CCTF_NEGATIVE 0x0002
  1856. #define CCTF_ICM_ON 0x0004
  1857. //////////////////////////////////////////////////////////////////////////////
  1858. // //
  1859. // //
  1860. // Exposed Halftone DLL APIs //
  1861. // //
  1862. // //
  1863. //////////////////////////////////////////////////////////////////////////////
  1864. #ifndef _HTAPI_ENTRY_
  1865. LONG
  1866. APIENTRY
  1867. HT_CreateDeviceHalftoneInfo(
  1868. PHTINITINFO pHTInitInfo,
  1869. PPDEVICEHALFTONEINFO ppDeviceHalftoneInfo
  1870. );
  1871. BOOL
  1872. APIENTRY
  1873. HT_DestroyDeviceHalftoneInfo(
  1874. PDEVICEHALFTONEINFO pDeviceHalftoneInfo
  1875. );
  1876. LONG
  1877. APIENTRY
  1878. HT_CreateHalftoneBrush(
  1879. PDEVICEHALFTONEINFO pDeviceHalftoneInfo,
  1880. PHTCOLORADJUSTMENT pHTColorAdjustment,
  1881. PCOLORTRIAD pColorTriad,
  1882. CHBINFO CHBInfo,
  1883. LPVOID pOutputBuffer
  1884. );
  1885. #ifndef _WINDDI_
  1886. LONG
  1887. APIENTRY
  1888. HT_ComputeRGBGammaTable(
  1889. WORD GammaTableEntries,
  1890. WORD GammaTableType,
  1891. UDECI4 RedGamma,
  1892. UDECI4 GreenGamma,
  1893. UDECI4 BlueGamma,
  1894. LPBYTE pGammaTable
  1895. );
  1896. LONG
  1897. APIENTRY
  1898. HT_Get8BPPFormatPalette(
  1899. LPPALETTEENTRY pPaletteEntry,
  1900. UDECI4 RedGamma,
  1901. UDECI4 GreenGamma,
  1902. UDECI4 BlueGamma
  1903. );
  1904. LONG
  1905. APIENTRY
  1906. HT_Get8BPPMaskPalette(
  1907. LPPALETTEENTRY pPaletteEntry,
  1908. BOOL Use8BPPMaskPal,
  1909. BYTE CMYMask,
  1910. UDECI4 RedGamma,
  1911. UDECI4 GreenGamma,
  1912. UDECI4 BlueGamma
  1913. );
  1914. #endif
  1915. LONG
  1916. APIENTRY
  1917. HT_CreateStandardMonoPattern(
  1918. PDEVICEHALFTONEINFO pDeviceHalftoneInfo,
  1919. PSTDMONOPATTERN pStdMonoPattern
  1920. );
  1921. LONG
  1922. APIENTRY
  1923. HT_HalftoneBitmap(
  1924. PDEVICEHALFTONEINFO pDeviceHalftoneInfo,
  1925. PHTCOLORADJUSTMENT pHTColorAdjustment,
  1926. PHTSURFACEINFO pSourceHTSurfaceInfo,
  1927. PHTSURFACEINFO pSourceMaskHTSurfaceInfo,
  1928. PHTSURFACEINFO pDestinationHTSurfaceInfo,
  1929. PBITBLTPARAMS pBitbltParams
  1930. );
  1931. #endif // _HTAPI_ENTRY_
  1932. #endif // _HT_