1 /* libhpojip -- HP OfficeJet image-processing library. */
3 /* Copyright (C) 1995-2002 Hewlett-Packard Company
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
13 * NON-INFRINGEMENT. See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20 * In addition, as a special exception, Hewlett-Packard Company
21 * gives permission to link the code of this program with any
22 * version of the OpenSSL library which is distributed under a
23 * license identical to that listed in the included LICENSE.OpenSSL
24 * file, and distribute linked combinations including the two.
25 * You must obey the GNU General Public License in all respects
26 * for all of the code used other than OpenSSL. If you modify
27 * this file, you may extend this exception to your version of the
28 * file, but you are not obligated to do so. If you do not wish to
29 * do so, delete this exception statement from your version.
32 /* Original author: Mark Overton and others.
34 * Ported to Linux by David Paschal.
37 /*****************************************************************************\
39 * hpojip.h - Interface into the Image Processing module
41 *****************************************************************************
43 * Mark Overton, Dec 1997
45 \*****************************************************************************/
51 #if defined(__cplusplus)
58 // #include <endian.h>
65 typedef unsigned char BYTE, *PBYTE, FAR *LPBYTE;
66 typedef unsigned short WORD, *PWORD, FAR *LPWORD;
67 typedef unsigned short USHORT, *PUSHORT, FAR *LPUSHORT;
68 typedef unsigned int DWORD, *PDWORD, FAR *LPDWORD;
69 typedef unsigned int UINT, *PUINT, FAR *LPUINT;
70 typedef unsigned long ULONG, *PULONG, FAR *LPULONG;
71 typedef enum { FALSE=0, TRUE=1 } BOOL;
72 typedef void VOID, *PVOID, FAR *LPVOID;
73 typedef long long int __int64;
79 } __attribute__((packed)) RGBQUAD;
81 /****************************************************************************\
82 ****************************************************************************
84 * COMMON DEFINITIONS for both xform drivers and ip functions
86 ****************************************************************************
87 \****************************************************************************/
89 #define IP_MAX_XFORMS 20 /* Max number of xforms we can handle. */
91 /* These bit-values are returned by all transform driver and ip functions.
92 * Zero or more of these bits is set, telling you if anything interesting
95 #define IP_READY_FOR_DATA 0X0001u
96 #define IP_PARSED_HEADER 0x0002u
97 #define IP_CONSUMED_ROW 0x0004u
98 #define IP_PRODUCED_ROW 0x0008u
99 #define IP_INPUT_ERROR 0x0010u
100 #define IP_FATAL_ERROR 0x0020u
101 #define IP_NEW_INPUT_PAGE 0x0040u
102 #define IP_NEW_OUTPUT_PAGE 0x0080u
103 #define IP_WRITE_INSERT_OK 0x0100u
104 #define IP_DONE 0x0200u
107 /* IP_IMAGE_TRAITS describes everything about an image. If an item is not
108 * known, a negative number is used, meaning "I don't know." So all items
114 int iComponentsPerPixel;
115 long lHorizDPI; /* 32.0 or 16.16 fixed-point */
116 long lVertDPI; /* 32.0 or 16.16 fixed-point */
120 } IP_IMAGE_TRAITS, *PIP_IMAGE_TRAITS, FAR*LPIP_IMAGE_TRAITS;
130 //#ifdef HPIP_INTERNAL
131 #include "xform.h" // this file uses the above definitions
133 //typedef struct IP_XFORM_TBL_s FAR *LPIP_XFORM_TBL;
137 /****************************************************************************\
138 ****************************************************************************
140 * Definitions for Exported IP Routines
142 ****************************************************************************
143 \****************************************************************************/
146 /* Synopsis of the interface:
150 * ipOpen - opens a new conversion-job
151 * ipConvert - converts some data
152 * ipClose - closes the conversion-job
154 * Ancillary routines:
156 * ipGetFuncPtrs - loads table with ptrs to these global routines
157 * ipGetClientDataPtr - returns ptr to client data-area in instance
158 * ipInsertedData - client inserted some data in output data stream
159 * ipGetImageTraits - returns traits of input and output images
162 /* handle for a conversion job */
163 typedef void FAR*IP_HANDLE, *FAR*PIP_HANDLE, FAR*FAR*LPIP_HANDLE;
165 typedef void (WINAPI *LPIP_PEEK_FUNC)(
166 IP_HANDLE hJob, /* handle for job making the callback */
167 LPIP_IMAGE_TRAITS pTraits, /* traits of the data being peeked at */
168 int nBytes, /* # bytes in buffer below */
169 LPBYTE pBuf, /* data being peeked at */
170 long nFilePos, /* file-position where data belongs */
171 PVOID pUserdata); /* Data passed to the user in peek calls. */
174 /* IP_XFORM - The list of the standard xforms supplied in image processor
176 * Warning: If the list below changes, you must also change an array in
177 * ipmain.c that is indexed by this enum.
180 X_FAX_ENCODE, X_FAX_DECODE, /* MH, MR and MMR formats */
181 X_PCX_ENCODE, X_PCX_DECODE,
182 /* X_BMP_ENCODE, X_BMP_DECODE, */
183 X_JPG_ENCODE, X_JPG_DECODE, X_JPG_FIX,
184 X_TIF_ENCODE, X_TIF_DECODE,
185 X_PNM_ENCODE, X_PNM_DECODE,
187 X_GRAY_2_BI, X_BI_2_GRAY,
192 X_TABLE, /* tables are: user1,user3,mirror,gamma,threshold,pass-thru */
205 } IP_XFORM, *PIP_XFORM, FAR*LPIP_XFORM;
208 #define IP_MAX_XFORM_INFO 8
210 /* IP_XFORM_SPEC - Fully specifies an xform
211 * Each transform driver documents what goes into aXformInfo.
214 LPIP_XFORM_TBL pXform; /* ptr to jmp-table for xform to do */
215 IP_XFORM eXform; /* which xform (used if pXform is NULL) */
216 LPIP_PEEK_FUNC pfReadPeek; /* callback when xform dvr reads data */
217 LPIP_PEEK_FUNC pfWritePeek; /* callback when xform dvr writes data */
218 PVOID pUserData; /* Data passed to user in peek functions. */
219 DWORD_OR_PVOID aXformInfo[IP_MAX_XFORM_INFO]; /* xform-specific info */
220 } IP_XFORM_SPEC, *PIP_XFORM_SPEC, FAR*LPIP_XFORM_SPEC;
224 /*****************************************************************************\
226 * ipOpen - Opens a new conversion job
228 *****************************************************************************
230 * This routine allocates some instance data, including space for nClientData.
231 * More memory is allocated once row-lengths are such are known.
232 * To deallocate all memory, ipClose must be called.
234 * The nXforms and pXforms parameters specify the sequence of transforms
235 * to go from input to output. The handle for the new job is returned
238 * A restriction on the list of xforms: the data-flows between xforms must be
239 * fixed-length buffers. This restricts you to raw raster rows between xforms.
240 * The data-flows into and out of ipConvert can be variable-length in nature.
242 * Return value: IP_DONE=success; IP_FATAL_ERROR=misc error.
244 \*****************************************************************************/
246 EXPORT(WORD) ipOpen (
247 int nXforms, /* in: number of xforms in lpXforms below */
248 LPIP_XFORM_SPEC lpXforms, /* in: list of xforms we should perform */
249 int nClientData, /* in: # bytes of additional client data */
250 LPIP_HANDLE phJob); /* out: handle for conversion job */
254 /*****************************************************************************\
256 * ipMirrorBytes - Swaps bits in each byte of buffer
257 * (bits 0<->7, 1<->6, etc.)
259 \*****************************************************************************/
261 VOID ipMirrorBytes(PBYTE pbInputBuf,DWORD dwInputAvail);
265 /*****************************************************************************\
267 * ipConvert - Converts some input data (work-horse function)
269 *****************************************************************************
271 * This function consumes input data and produces output data via the
272 * input- and output-buffer parameters. And it tells you what's happening
273 * via its function return value.
275 * On entry, pbInputBuf and wInputAvail specify the location and number of
276 * data-bytes in the input buffer. On return, pwInputUsed tells you how
277 * many of those input bytes were consumed. pdwInputNextPos tells you
278 * where in the input file you should read next for the following call;
279 * 0 is the beginning of the file. This is almost always the current file
280 * position plus pwInputUsed; if not, a file-seek is being requested.
282 * The output buffer parameters are analogous to the input parameters,
283 * except that pdwOutputThisPos tells you where the bytes just output
284 * should be written in the output file. That is, it applies to *this*
285 * write, not the *next* write, unlike the input arrangement.
286 * The output buffer pointers are allowed to be NULL, in which case
287 * the output is discarded.
289 * The function return value is a bit-mask that tells you if anything
290 * interesting happened. Multiple bits can be set. This information
291 * should be treated as independent of the data-transfers occuring via
292 * the parameters. The IP_CONSUMED_ROW and IP_PRODUCED_ROW bits can
293 * be used to count how many rows have been input and output.
295 * The IP_NEW_OUTPUT_PAGE bit is set when or after the last row of the
296 * page has been sent, and before the first row of the following page (if
299 * You may wish to insert secret data, such as thumbnails, into the
300 * output stream. When ipConvert returns the IP_WRITE_INSERT_OK bit,
301 * it is giving you permission to write stuff AFTER you write the output
302 * buffer it gave you. After adding your secret data, you must call
303 * ipInsertedData to tell us how many bytes were added.
305 * When there is no more input data, ipConvert must be called repeatedly
306 * with a NULL pbInputBuf parameter, which tells the processor to flush out
307 * any buffered rows. Keep calling it until it returns the IP_DONE bit.
309 * Do not call ipConvert again after it has returned either error bit or
312 * At any time after ipConvert returns the IP_PARSED_HEADER bit,
313 * ipGetImageTraits may be called to obtain the input and output traits.
314 * IP_PARSED_HEADER is returned in *every* call after the header was parsed.
316 * Return value: Zero or more of these bits may be set:
318 * IP_PARSED_HEADER = input header has been parsed; traits are known
319 * IP_CONSUMED_ROW = an input row was parsed
320 * IP_PRODUCED_ROW = an output row was produced
321 * IP_INPUT_ERROR = syntax error in input data
322 * IP_FATAL_ERROR = misc error (internal error or bad param)
323 * IP_NEW_INPUT_PAGE = just encountered end of page on input
324 * IP_NEW_OUTPUT_PAGE = just finished outputting a page
325 * IP_WRITE_INSERT_OK = okay to insert data in output file
326 * IP_DONE = conversion is completed.
328 \*****************************************************************************/
330 EXPORT(WORD) ipConvert (
331 IP_HANDLE hJob, /* in: handle to conversion job */
332 DWORD dwInputAvail, /* in: # avail bytes in input buf */
333 LPBYTE pbInputBuf, /* in: ptr to input buffer */
334 LPDWORD pdwInputUsed, /* out: # bytes used from input buf */
335 LPDWORD pdwInputNextPos, /* out: file-pos to read from next */
336 DWORD dwOutputAvail, /* in: # avail bytes in output buf */
337 LPBYTE pbOutputBuf, /* in: ptr to output buffer */
338 LPDWORD pdwOutputUsed, /* out: # bytes written in out buf */
339 LPDWORD pdwOutputThisPos); /* out: file-pos to write this data */
343 /*****************************************************************************\
345 * ipClose - Destroys the given conversion job
347 *****************************************************************************
349 * This routine deallocates all memory associated with the given conversion
350 * job. It may be called at any time, which is how you do an abort.
352 * Return value: IP_DONE=success; IP_FATAL_ERROR=misc error.
354 \*****************************************************************************/
356 EXPORT(WORD) ipClose (
357 IP_HANDLE hJob); /* in: handle to conversion job */
360 /****************************************************************************\
362 * ipResultMask - Selects bit-results to be returned by ipConvert
364 ****************************************************************************
366 * The mask parameter is the OR of the IP_... bits you want returned by
367 * calls to ipConvert. A 1 means you want that bit; 0 means you don't.
368 * By disabling frequently-returned bits, efficiency will improve because
369 * fewer ipConvert calls will be made because each call can do more work.
371 * The mask is all zeroes by default. The IP_DONE, IP_FATAL_ERROR, and
372 * IP_INPUT_ERROR bits are always enabled, regardless of their bit-values
375 \*****************************************************************************/
377 EXPORT(WORD) ipResultMask (
378 IP_HANDLE hJob, /* in: handle to conversion job */
379 WORD wMask); /* in: result bits you are interested in */
382 /*****************************************************************************\
384 * ipGetClientDataPtr - Returns ptr to client's data in conversion instance
386 *****************************************************************************
388 * ipOpen accepts an nClientData parameter which is the number of extra bytes
389 * we allocate for the client for his own use. This function returns the
390 * pointer to that memory in the given conversion instance.
392 * Return value: IP_DONE=success; IP_FATAL_ERROR=misc error.
394 \*****************************************************************************/
396 EXPORT(WORD) ipGetClientDataPtr (
397 IP_HANDLE hJob, /* in: handle to conversion job */
398 LPVOID FAR*ppvClientData); /* out: ptr to client's memory area */
402 /*****************************************************************************\
404 * ipSetDefaultInputTraits - Specifies default input image traits
406 *****************************************************************************
408 * The header of the file-type handled by the first transform might not
409 * include *all* the image traits we'd like to know. Those not specified
410 * in the file-header are filled in from info provided by this routine.
412 * Return value: IP_DONE=success; IP_FATAL_ERROR=misc error.
414 \*****************************************************************************/
416 EXPORT(WORD) ipSetDefaultInputTraits (
417 IP_HANDLE hJob, /* in: handle to conversion job */
418 LPIP_IMAGE_TRAITS pTraits); /* in: default image traits */
422 /*****************************************************************************\
424 * ipGetOutputTraits - Returns the output traits before ipConvert is called
426 *****************************************************************************
428 * If the first xform does not have a header, then you can call this function
429 * *after* calling ipSetDefaultInputTraits to get the output image traits.
430 * Ordinarily, you'd have to call ipConvert a few times and wait until it tells
431 * you that the (non-existent) header has been parsed. But if you need the
432 * output traits before calling ipConvert, this function will return them.
434 * Return value: IP_DONE=success; IP_FATAL_ERROR=misc error.
436 \*****************************************************************************/
438 EXPORT(WORD) ipGetOutputTraits (
439 IP_HANDLE hJob, /* in: handle to conversion job */
440 LPIP_IMAGE_TRAITS pTraits); /* out: output image traits */
444 /*****************************************************************************\
446 * ipGetImageTraits - Returns traits of input and output images
448 *****************************************************************************
450 * At any time after ipConvert has returned the IP_PARSED_HEADER bit, this
451 * function may be called to obtain the traits of the input and output images.
452 * If a pointer parameter is NULL, that traits record is not returned.
454 * After the conversion job is done, these traits will contain the actual
455 * number of rows input and output.
457 * Return value: IP_DONE=success; IP_FATAL_ERROR=misc error.
459 \*****************************************************************************/
461 EXPORT(WORD) ipGetImageTraits (
462 IP_HANDLE hJob, /* in: handle to conversion job */
463 LPIP_IMAGE_TRAITS pInputTraits, /* out: traits of input image */
464 LPIP_IMAGE_TRAITS pOutputTraits); /* out: traits of output image */
468 /*****************************************************************************\
470 * ipInsertedData - Client inserted some bytes into our output stream
472 *****************************************************************************
474 * After ipConvert returns the IP_WRITE_INSERT_OK bit, and after the client
475 * writes out the output buffer, he is permitted to write out some additional
476 * data for his own use, such as a thumbnail image. After writing the added
477 * data, the client calls this function to tell us how much data he wrote.
479 * Return value: IP_DONE=success; IP_FATAL_ERROR=misc error.
481 \*****************************************************************************/
483 EXPORT(WORD) ipInsertedData (
484 IP_HANDLE hJob, /* in: handle to conversion job */
485 DWORD dwNumBytes); /* in: # of bytes of additional data written */
489 /*****************************************************************************\
491 * ipOverrideDPI - Force a different DPI to be reported in the output
493 *****************************************************************************
495 * The values supplied only change the DPI that's *reported* in the output
496 * traits and in the header (if any) of the output file. These DPI values
497 * do *not* affect the transforms, and do *not* affect or change any scaling.
499 * The image processor code supplies these values in the input traits of
500 * the last transform in the list of transforms so that they'll make it
501 * in the output file header.
503 * The DPI values are in fixed-point with 16 bits of fraction. A value of
504 * 0 means "no override; use the normal value".
506 * Return value: IP_DONE=success; IP_FATAL_ERROR=misc error.
508 \*****************************************************************************/
510 EXPORT(WORD) ipOverrideDPI (
511 IP_HANDLE hJob, /* in: handle to conversion job */
512 DWORD dwHorizDPI, /* in: horiz DPI as 16.16; 0 means no override */
513 DWORD dwVertDPI); /* in: vert DPI as 16.16; 0 means no override */
517 /*****************************************************************************\
519 * ipGetFuncPtrs - Loads jump-table with pointers to the ip entry points
521 *****************************************************************************
523 * This function loads a jump-table (typedef'ed below) for your convenience
524 * so you won't have to call GetProcAddress on every function.
526 * Return value: IP_DONE=success; IP_FATAL_ERROR=misc error.
528 \*****************************************************************************/
530 /*****************************************************************************\
532 * ipGetXformTable - Returns ptr to IP_XFORM_TBL for transform.
534 *****************************************************************************
537 * Return value: IP_DONE=success; IP_FATAL_ERROR=misc error.
539 \*****************************************************************************/
541 EXPORT(WORD) ipGetXformTable (LPIP_XFORM_TBL phXform);
545 /*** Prototype for ipGetFuncPtrs function ***/
546 typedef WORD (WINAPI *IPOPEN) (int, LPIP_XFORM_SPEC,
548 typedef WORD (WINAPI *IPCONVERT) (IP_HANDLE, DWORD, LPBYTE,
549 LPDWORD, LPDWORD, DWORD,
550 LPBYTE, LPDWORD, LPDWORD);
551 typedef WORD (WINAPI *IPCLOSE) (IP_HANDLE);
552 typedef WORD (WINAPI *IPGETCLIENTDATAPTR) (IP_HANDLE, LPVOID FAR *);
553 typedef WORD (WINAPI *IPRESULTMASK) (IP_HANDLE, WORD);
554 typedef WORD (WINAPI *IPSETDEFAULTINPUTTRAITS) (IP_HANDLE,
556 typedef WORD (WINAPI *IPGETIMAGETRAITS) (IP_HANDLE,
559 typedef WORD (WINAPI *IPINSERTEDDATA) (IP_HANDLE, DWORD);
560 typedef WORD (WINAPI *IPOVERRIDEDPI) (IP_HANDLE, DWORD, DWORD);
562 typedef WORD (WINAPI *IPGETXFORMTABLE) (LPIP_XFORM_TBL);
564 typedef WORD (WINAPI *IPGETOUTPUTTRAITS) (IP_HANDLE,
568 WORD wStructSize; /* # of bytes in this struct */
572 IPGETCLIENTDATAPTR ipGetClientDataPtr;
573 IPRESULTMASK ipResultMask;
574 IPSETDEFAULTINPUTTRAITS ipSetDefaultInputTraits;
575 IPGETIMAGETRAITS ipGetImageTraits;
576 IPINSERTEDDATA ipInsertedData;
577 IPOVERRIDEDPI ipOverrideDPI;
578 IPGETOUTPUTTRAITS ipGetOutputTraits;
579 } IP_JUMP_TBL, * PIP_JUMP_TBL, FAR * LPIP_JUMP_TBL;
581 /*** Prototype for ipGetFuncPtrs function ***/
582 typedef WORD (WINAPI *LPFNIPGETFUNCPTRS) (LPIP_JUMP_TBL);
584 EXPORT(WORD) ipGetFuncPtrs (LPIP_JUMP_TBL lpJumpTbl);
586 /****************************************************************************\
587 ****************************************************************************
589 * OPTION DEFINITIONS for xform drivers
591 ****************************************************************************
592 \****************************************************************************/
596 /* This .h file contains symbols for the transform in the corresponding .c file.
597 * See that .c file for instructions on using this transform.
600 #define IP_BI_2_GRAY_OUTPUT_BPP 0
601 #define IP_BI_2_GRAY_WHITE_PIXEL 1
602 #define IP_BI_2_GRAY_BLACK_PIXEL 2
609 /* This .h file contains symbols for the transform in the corresponding .c file.
610 * See that .c file for instructions on using this transform.
613 #define IP_BMP_NEGATIVE_HEIGHT 0
620 /* This .h file contains symbols for the transform in the corresponding .c file.
621 * See that .c file for instructions on using this transform.
624 #define IP_CHANGE_BPP_OUTPUT_BPP 0
629 /* This .h file contains symbols for the transform in the corresponding .c file.
630 * See that .c file for instructions on using this transform.
633 #define IP_CNV_COLOR_SPACE_WHICH_CNV 0
634 #define IP_CNV_COLOR_SPACE_GAMMA 1
636 /* The following conversions are possible: */
639 IP_CNV_YCC_TO_CIELAB = 0,
640 IP_CNV_CIELAB_TO_YCC = 1,
641 IP_CNV_YCC_TO_SRGB = 2,
642 IP_CNV_SRGB_TO_YCC = 3,
643 IP_CNV_LHS_TO_SRGB = 4,
644 IP_CNV_SRGB_TO_LHS = 5,
645 IP_CNV_BGR_SWAP = 100
651 /* This .h file contains symbols for the transform in the corresponding .c file.
652 * See that .c file for instructions on using this transform.
655 #define IP_CONVOLVE_NROWS 0
656 #define IP_CONVOLVE_NCOLS 1
657 #define IP_CONVOLVE_MATRIX 2
658 #define IP_CONVOLVE_DIVISOR 3
660 #define IP_CONVOLVE_MAXSIZE 9 /* up to 9x9 matrix */
665 /* This .h file contains symbols for the transform in the corresponding .c file.
666 * See that .c file for instructions on using this transform.
669 #define IP_CROP_LEFT 0
670 #define IP_CROP_RIGHT 1
671 #define IP_CROP_TOP 2
672 #define IP_CROP_MAXOUTROWS 3
677 /* This .h file contains symbols for the transform in the corresponding .c file.
678 * See that .c file for instructions on using this transform.
681 #define IP_FAKE_MONO_BPP 0
686 /* This .h file contains symbols for the transform in the corresponding .c file.
687 * See that .c file for instructions on using this transform.
690 #define IP_FAX_FORMAT 0
691 #define IP_FAX_NO_EOLS 1
692 #define IP_FAX_MIN_ROW_LEN 2
694 enum {IP_FAX_MH, IP_FAX_MR, IP_FAX_MMR};
699 /* This .h file contains symbols for the transform in the corresponding .c file.
700 * See that .c file for instructions on using this transform.
703 #define IP_GRAY_2_BI_THRESHOLD 0
708 /* This .h file contains symbols for the transform in the corresponding .c file.
709 * See that .c file for instructions on using this transform.
712 #define IP_GRAYOUT_LEFT 0
713 #define IP_GRAYOUT_RIGHT 1
714 #define IP_GRAYOUT_TOP 2
715 #define IP_GRAYOUT_BOTTOM 3
722 /* xheader.h - aXformInfo[0] struct given to xheader.c, the header generator
724 * Mark Overton, March 1998
727 #define IP_HEADER_SPEC 0
729 /* aXformInfo[IP_HEADER_SPEC] shall be a pointer pointing to this: */
732 PSTR pszLeftStr; // ptr to left-justified string; 0 -> none
733 PSTR pszCenterStr; // ptr to centered string; 0 -> none
734 PSTR pszRightStr; // ptr to right-justified string; 0 -> none
735 WORD wCharSet; // character set (may be a two-byte set)
736 PSTR pszTypeFace; // ptr to name of typeface (required)
737 float fHeightPoints; // point-size of font
738 float fMarginPoints; // left and right margin, in points
739 BOOL bOverlay; // 0=append header, 1=overlay it on top of page
740 RGBQUAD rgbWhite; // a white pixel
741 RGBQUAD rgbBlack; // a black pixel
742 } __attribute__((packed)) XHEADER_SPEC, *PXHEADER_SPEC, FAR*LPXHEADER_SPEC;
744 /* A header is one line of text appearing at the top of faxes. This is known
745 * as a "TTI" in faxland. We implement this as a left-justified portion, a
746 * centered portion, and a right-justified portion. All three portions are
749 * Note that xheader.c copies over the string fields in the struct. Therefore,
750 * those strings may go away after the call to cvtOpen.
752 * The bOverlay field controls whether the header is concatenated
753 * to the top of the page (0), or overlays the top of the page (1).
755 * xheader.c needs to know what values to use for white and black pixels,
756 * so rgbWhite and rgbBlack are a white pixel and black pixel repectively.
757 * If the page data is gray (8 bits/pixel), only the rgbRed field is used.
758 * If the page data is bilevel, then only the least significant bit of rgbRed
766 /* This .h file contains symbols xjpg_dec.c and xjpg_enc.c
767 * See those .c files for instructions on using these transforms.
770 /* Specifications for decoder: */
772 #define IP_JPG_DECODE_OUTPUT_SUBSAMPLED 0
773 #define IP_JPG_DECODE_FROM_DENALI 1
775 /* Specifications for encoder: */
777 #define IP_JPG_ENCODE_QUALITY_FACTORS 0
778 #define IP_JPG_ENCODE_SAMPLE_FACTORS 1
779 #define IP_JPG_ENCODE_ALREADY_SUBSAMPLED 2
780 #define IP_JPG_ENCODE_FOR_DENALI 3
781 #define IP_JPG_ENCODE_OUTPUT_DNL 4
782 #define IP_JPG_ENCODE_FOR_COLOR_FAX 5
783 #define IP_JPG_ENCODE_DUMMY_HEADER_LEN 6
788 /* This .h file contains symbols for the transform in the corresponding .c file.
789 * See that .c file for instructions on using this transform.
792 #define IP_PAD_LEFT 0
793 #define IP_PAD_RIGHT 1
795 #define IP_PAD_BOTTOM 3
796 #define IP_PAD_VALUE 4
797 #define IP_PAD_MIN_HEIGHT 5
802 /* This .h file contains symbols for the transform in the corresponding .c file.
803 * See that .c file for instructions on using this transform.
806 #define IP_ROTATE_UPPER_LEFT 0
807 #define IP_ROTATE_UPPER_RIGHT 1
808 #define IP_ROTATE_LOWER_LEFT 2
809 #define IP_ROTATE_OUTPUT_SIZE 3
810 #define IP_ROTATE_FAST 4
815 /* This .h file contains symbols for the transform in the corresponding .c file.
816 * See that .c file for instructions on using this transform.
819 #define IP_SATURATION_FACTOR 0
824 /* This .h file contains symbols for the transform in the corresponding .c file.
825 * See that .c file for instructions on using this transform.
828 #define IP_SCALE_HORIZ_FACTOR 0
829 #define IP_SCALE_VERT_FACTOR 1
830 #define IP_SCALE_FAST 2
835 /* This .h file contains symbols for the transform in the corresponding .c file.
836 * See that .c file for instructions on using this transform.
839 #define IP_SKEL_SPEC_1 0
840 #define IP_SKEL_SPEC_2 1
845 /* This .h file contains symbols for the transform in the corresponding .c file.
846 * See that .c file for instructions on using this transform.
849 #define IP_TABLE_WHICH 0
850 #define IP_TABLE_OPTION 1
852 #define IP_TABLE_COLOR_1 1
853 #define IP_TABLE_COLOR_2 2
854 #define IP_TABLE_COLOR_3 3
865 IP_TABLE_USER_THREE_WORD
871 /* This .h file contains symbols for the transform in the corresponding .c file.
872 * See that .c file for instructions on using this transform.
875 #define IP_THUMB_SCALE_SPEC 0
880 /* This .h file contains symbols for the transform in the corresponding .c file.
881 * See that .c file for instructions on using this transform.
884 #define IP_TIFF_FILE_PATH 0
889 /* This .h file contains symbols for the transform in the corresponding .c file.
890 * See that .c file for instructions on using this transform.
893 #define IP_TONEMAP_POINTER 0
894 #define IP_TONEMAP_LUM_SPACE 1
899 /* This .h file contains symbols for the transform in the corresponding .c file.
900 * See that .c file for instructions on using this transform.
903 #define IP_Y_EXTRACT_COLOR_SPACE 0
906 IP_Y_EXTRACT_LUM_CHROME,
909 } IP_Y_EXTRACT_WHICH_SPACE;
911 #if defined(__cplusplus)