1 /* libhpojip -- HP OfficeJet image-processing library. */
2 
3 /* Copyright (C) 1995-2002 HP Company
4  *
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.
9  *
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.
14  *
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,
18  * MA 02111-1307, USA.
19  *
20  * In addition, as a special exception, HP 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.
30  */
31 
32 /* Original author: Mark Overton and others.
33  *
34  * Ported to Linux by David Paschal.
35  */
36 
37 /*****************************************************************************\
38  *
39  * hpojip.h - Interface into the Image Processing module
40  *
41  *****************************************************************************
42  *
43  * Mark Overton, Dec 1997
44  *
45 \*****************************************************************************/
46 
47 
48 #if !defined HPIP_INC
49 #define HPIP_INC
50 
51 #if defined(__cplusplus)
52 	extern "C" {
53 #endif
54 
55 #include <stdlib.h>
56 
57 /* TODO: Fix this! */
58 // #include <endian.h>
59 #undef LITTLE_ENDIAN
60 
61 #define FAR
62 #define WINAPI
63 #define EXPORT(x) x
64 
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 #ifndef FALSE
72 #define FALSE			0
73 #endif
74 #ifndef TRUE
75 #define TRUE			1
76 #endif
77 typedef int				BOOL;
78 //typedef enum { FALSE=0, TRUE=1 } BOOL;
79 
80 typedef void VOID;
81 typedef void *PVOID, FAR *LPVOID;
82 typedef long long int __int64;
83 
84 typedef struct {
85 	BYTE rgbRed:8;
86 	BYTE rgbGreen:8;
87 	BYTE rgbBlue:8;
88 } __attribute__((packed)) RGBQUAD;
89 
90 /****************************************************************************\
91  ****************************************************************************
92  *
93  * COMMON DEFINITIONS for both xform drivers and ip functions
94  *
95  ****************************************************************************
96 \****************************************************************************/
97 
98 #define IP_MAX_XFORMS	20	/* Max number of xforms we can handle. */
99 
100 /* These bit-values are returned by all transform driver and ip functions.
101  * Zero or more of these bits is set, telling you if anything interesting
102  * happened.
103  */
104 #define IP_READY_FOR_DATA      0X0001u
105 #define IP_PARSED_HEADER       0x0002u
106 #define IP_CONSUMED_ROW        0x0004u
107 #define IP_PRODUCED_ROW        0x0008u
108 #define IP_INPUT_ERROR         0x0010u
109 #define IP_FATAL_ERROR         0x0020u
110 #define IP_NEW_INPUT_PAGE      0x0040u
111 #define IP_NEW_OUTPUT_PAGE     0x0080u
112 #define IP_WRITE_INSERT_OK     0x0100u
113 #define IP_DONE                0x0200u
114 
115 
116 /* IP_IMAGE_TRAITS describes everything about an image.  If an item is not
117  * known, a negative number is used, meaning "I don't know."  So all items
118  * are signed.
119  */
120 typedef struct {
121     int  iPixelsPerRow;
122     int  iBitsPerPixel;
123     int  iComponentsPerPixel;
124     long lHorizDPI;           /* 32.0 or 16.16 fixed-point */
125     long lVertDPI;            /* 32.0 or 16.16 fixed-point */
126     long lNumRows;
127     int  iNumPages;
128     int  iPageNum;
129 } IP_IMAGE_TRAITS, *PIP_IMAGE_TRAITS, FAR*LPIP_IMAGE_TRAITS;
130 
131 typedef union {
132 	DWORD dword;
133 	PVOID pvoid;
134 	__int64 i64;
135 	RGBQUAD rgbquad;
136 	float fl;
137 } DWORD_OR_PVOID;
138 
139 //#ifdef HPIP_INTERNAL
140 #include "xform.h"   // this file uses the above definitions
141 //#else
142 //typedef struct IP_XFORM_TBL_s FAR *LPIP_XFORM_TBL;
143 //#endif
144 
145 
146 /****************************************************************************\
147  ****************************************************************************
148  *
149  * Definitions for Exported IP Routines
150  *
151  ****************************************************************************
152 \****************************************************************************/
153 
154 
155 /* Synopsis of the interface:
156  *
157  *    Main routines:
158  *
159  *       ipOpen             - opens a new conversion-job
160  *       ipConvert          - converts some data
161  *       ipClose            - closes the conversion-job
162  *
163  *    Ancillary routines:
164  *
165  *       ipGetFuncPtrs      - loads table with ptrs to these global routines
166  *       ipGetClientDataPtr - returns ptr to client data-area in instance
167  *       ipInsertedData     - client inserted some data in output data stream
168  *       ipGetImageTraits   - returns traits of input and output images
169  */
170 
171 /* handle for a conversion job */
172 typedef void FAR*IP_HANDLE, *FAR*PIP_HANDLE, FAR*FAR*LPIP_HANDLE;
173 
174 typedef void (WINAPI *LPIP_PEEK_FUNC)(
175     IP_HANDLE         hJob,       /* handle for job making the callback */
176     LPIP_IMAGE_TRAITS pTraits,    /* traits of the data being peeked at */
177     int               nBytes,     /* # bytes in buffer below */
178     LPBYTE            pBuf,       /* data being peeked at */
179     long              nFilePos,   /* file-position where data belongs */
180     PVOID             pUserdata); /* Data passed to the user in peek calls. */
181 
182 
183 /* IP_XFORM - The list of the standard xforms supplied in image processor
184  *
185  * Warning: If the list below changes, you must also change an array in
186  * ipmain.c that is indexed by this enum.
187  */
188 typedef enum {
189     X_FAX_ENCODE,  X_FAX_DECODE,   /* MH, MR and MMR formats */
190     X_PCX_ENCODE,  X_PCX_DECODE,
191     /* X_BMP_ENCODE,  X_BMP_DECODE, */
192     X_JPG_ENCODE,  X_JPG_DECODE, X_JPG_FIX,
193     X_TIF_ENCODE,  X_TIF_DECODE,
194     X_PNM_ENCODE,  X_PNM_DECODE,
195     X_SCALE,
196     X_GRAY_2_BI, X_BI_2_GRAY,
197     X_CNV_COLOR_SPACE,
198     X_Y_EXTRACT,
199     /* X_HEADER, */
200     X_THUMB,
201     X_TABLE,      /* tables are: user1,user3,mirror,gamma,threshold,pass-thru */
202     X_CROP,
203     X_TONEMAP,
204     X_SATURATION,
205     X_ROTATE,
206     X_PAD,
207     X_FAKE_MONO,
208     X_GRAYOUT,
209     X_CHANGE_BPP,
210     X_MATRIX,
211     X_CONVOLVE,
212     X_INVERT,
213     X_SKEL,
214 } IP_XFORM, *PIP_XFORM, FAR*LPIP_XFORM;
215 
216 
217 #define IP_MAX_XFORM_INFO	8
218 
219 /* IP_XFORM_SPEC - Fully specifies an xform
220  * Each transform driver documents what goes into aXformInfo.
221  */
222 typedef struct {
223     LPIP_XFORM_TBL pXform;        /* ptr to jmp-table for xform to do */
224     IP_XFORM       eXform;        /* which xform (used if pXform is NULL) */
225     LPIP_PEEK_FUNC pfReadPeek;    /* callback when xform dvr reads data */
226     LPIP_PEEK_FUNC pfWritePeek;   /* callback when xform dvr writes data */
227     PVOID          pUserData;     /* Data passed to user in peek functions. */
228     DWORD_OR_PVOID aXformInfo[IP_MAX_XFORM_INFO]; /* xform-specific info */
229 } IP_XFORM_SPEC, *PIP_XFORM_SPEC, FAR*LPIP_XFORM_SPEC;
230 
231 
232 
233 /*****************************************************************************\
234  *
235  * ipOpen - Opens a new conversion job
236  *
237  *****************************************************************************
238  *
239  * This routine allocates some instance data, including space for nClientData.
240  * More memory is allocated once row-lengths are such are known.
241  * To deallocate all memory, ipClose must be called.
242  *
243  * The nXforms and pXforms parameters specify the sequence of transforms
244  * to go from input to output.  The handle for the new job is returned
245  * in *pXform.
246  *
247  * A restriction on the list of xforms: the data-flows between xforms must be
248  * fixed-length buffers. This restricts you to raw raster rows between xforms.
249  * The data-flows into and out of ipConvert can be variable-length in nature.
250  *
251  * Return value: IP_DONE=success; IP_FATAL_ERROR=misc error.
252  *
253 \*****************************************************************************/
254 
255 EXPORT(WORD) ipOpen (
256     int             nXforms,      /* in:  number of xforms in lpXforms below */
257     LPIP_XFORM_SPEC lpXforms,     /* in:  list of xforms we should perform */
258     int             nClientData,  /* in:  # bytes of additional client data */
259     LPIP_HANDLE     phJob);       /* out: handle for conversion job */
260 
261 
262 
263 /*****************************************************************************\
264  *
265  * ipMirrorBytes - Swaps bits in each byte of buffer
266  *                 (bits 0<->7, 1<->6, etc.)
267  *
268 \*****************************************************************************/
269 
270 VOID ipMirrorBytes(PBYTE pbInputBuf,DWORD dwInputAvail);
271 
272 
273 
274 /*****************************************************************************\
275  *
276  * ipConvert - Converts some input data (work-horse function)
277  *
278  *****************************************************************************
279  *
280  * This function consumes input data and produces output data via the
281  * input- and output-buffer parameters.  And it tells you what's happening
282  * via its function return value.
283  *
284  * On entry, pbInputBuf and wInputAvail specify the location and number of
285  * data-bytes in the input buffer.  On return, pwInputUsed tells you how
286  * many of those input bytes were consumed.  pdwInputNextPos tells you
287  * where in the input file you should read next for the following call;
288  * 0 is the beginning of the file.  This is almost always the current file
289  * position plus pwInputUsed; if not, a file-seek is being requested.
290  *
291  * The output buffer parameters are analogous to the input parameters,
292  * except that pdwOutputThisPos tells you where the bytes just output
293  * should be written in the output file.  That is, it applies to *this*
294  * write, not the *next* write, unlike the input arrangement.
295  * The output buffer pointers are allowed to be NULL, in which case
296  * the output is discarded.
297  *
298  * The function return value is a bit-mask that tells you if anything
299  * interesting happened.  Multiple bits can be set.  This information
300  * should be treated as independent of the data-transfers occuring via
301  * the parameters.  The IP_CONSUMED_ROW and IP_PRODUCED_ROW bits can
302  * be used to count how many rows have been input and output.
303  *
304  * The IP_NEW_OUTPUT_PAGE bit is set when or after the last row of the
305  * page has been sent, and before the first row of the following page (if
306  * any) is sent.
307  *
308  * You may wish to insert secret data, such as thumbnails, into the
309  * output stream.  When ipConvert returns the IP_WRITE_INSERT_OK bit,
310  * it is giving you permission to write stuff AFTER you write the output
311  * buffer it gave you.  After adding your secret data, you must call
312  * ipInsertedData to tell us how many bytes were added.
313  *
314  * When there is no more input data, ipConvert must be called repeatedly
315  * with a NULL pbInputBuf parameter, which tells the processor to flush out
316  * any buffered rows.  Keep calling it until it returns the IP_DONE bit.
317  *
318  * Do not call ipConvert again after it has returned either error bit or
319  * IP_DONE.
320  *
321  * At any time after ipConvert returns the IP_PARSED_HEADER bit,
322  * ipGetImageTraits may be called to obtain the input and output traits.
323  * IP_PARSED_HEADER is returned in *every* call after the header was parsed.
324  *
325  * Return value:  Zero or more of these bits may be set:
326  *
327  *     IP_PARSED_HEADER    = input header has been parsed; traits are known
328  *     IP_CONSUMED_ROW     = an input row was parsed
329  *     IP_PRODUCED_ROW     = an output row was produced
330  *     IP_INPUT_ERROR      = syntax error in input data
331  *     IP_FATAL_ERROR      = misc error (internal error or bad param)
332  *     IP_NEW_INPUT_PAGE   = just encountered end of page on input
333  *     IP_NEW_OUTPUT_PAGE  = just finished outputting a page
334  *     IP_WRITE_INSERT_OK  = okay to insert data in output file
335  *     IP_DONE             = conversion is completed.
336  *
337 \*****************************************************************************/
338 
339 EXPORT(WORD) ipConvert (
340     IP_HANDLE   hJob,              /* in:  handle to conversion job */
341     DWORD       dwInputAvail,      /* in:  # avail bytes in input buf */
342     LPBYTE      pbInputBuf,        /* in:  ptr to input buffer */
343     LPDWORD     pdwInputUsed,      /* out: # bytes used from input buf */
344     LPDWORD     pdwInputNextPos,   /* out: file-pos to read from next */
345     DWORD       dwOutputAvail,     /* in:  # avail bytes in output buf */
346     LPBYTE      pbOutputBuf,       /* in:  ptr to output buffer */
347     LPDWORD     pdwOutputUsed,     /* out: # bytes written in out buf */
348     LPDWORD     pdwOutputThisPos); /* out: file-pos to write this data */
349 
350 
351 
352 /*****************************************************************************\
353  *
354  * ipClose - Destroys the given conversion job
355  *
356  *****************************************************************************
357  *
358  * This routine deallocates all memory associated with the given conversion
359  * job.  It may be called at any time, which is how you do an abort.
360  *
361  * Return value: IP_DONE=success; IP_FATAL_ERROR=misc error.
362  *
363 \*****************************************************************************/
364 
365 EXPORT(WORD) ipClose (
366     IP_HANDLE hJob);     /* in:  handle to conversion job */
367 
368 
369 /****************************************************************************\
370  *
371  * ipResultMask - Selects bit-results to be returned by ipConvert
372  *
373  ****************************************************************************
374  *
375  * The mask parameter is the OR of the IP_... bits you want returned by
376  * calls to ipConvert.  A 1 means you want that bit; 0 means you don't.
377  * By disabling frequently-returned bits, efficiency will improve because
378  * fewer ipConvert calls will be made because each call can do more work.
379  *
380  * The mask is all zeroes by default.  The IP_DONE, IP_FATAL_ERROR, and
381  * IP_INPUT_ERROR bits are always enabled, regardless of their bit-values
382  * in the mask.
383  *
384 \*****************************************************************************/
385 
386 EXPORT(WORD) ipResultMask (
387     IP_HANDLE hJob,     /* in:  handle to conversion job */
388     WORD      wMask);   /* in:  result bits you are interested in */
389 
390 
391 /*****************************************************************************\
392  *
393  * ipGetClientDataPtr - Returns ptr to client's data in conversion instance
394  *
395  *****************************************************************************
396  *
397  * ipOpen accepts an nClientData parameter which is the number of extra bytes
398  * we allocate for the client for his own use.  This function returns the
399  * pointer to that memory in the given conversion instance.
400  *
401  * Return value: IP_DONE=success; IP_FATAL_ERROR=misc error.
402  *
403 \*****************************************************************************/
404 
405 EXPORT(WORD) ipGetClientDataPtr (
406     IP_HANDLE     hJob,            /* in:  handle to conversion job */
407     LPVOID    FAR*ppvClientData);  /* out: ptr to client's memory area */
408 
409 
410 
411 /*****************************************************************************\
412  *
413  * ipSetDefaultInputTraits - Specifies default input image traits
414  *
415  *****************************************************************************
416  *
417  * The header of the file-type handled by the first transform might not
418  * include *all* the image traits we'd like to know.  Those not specified
419  * in the file-header are filled in from info provided by this routine.
420  *
421  * Return value: IP_DONE=success; IP_FATAL_ERROR=misc error.
422  *
423 \*****************************************************************************/
424 
425 EXPORT(WORD) ipSetDefaultInputTraits (
426     IP_HANDLE         hJob,      /* in: handle to conversion job */
427     LPIP_IMAGE_TRAITS pTraits);  /* in: default image traits */
428 
429 
430 
431 /*****************************************************************************\
432  *
433  * ipGetOutputTraits - Returns the output traits before ipConvert is called
434  *
435  *****************************************************************************
436  *
437  * If the first xform does not have a header, then you can call this function
438  * *after* calling ipSetDefaultInputTraits to get the output image traits.
439  * Ordinarily, you'd have to call ipConvert a few times and wait until it tells
440  * you that the (non-existent) header has been parsed.  But if you need the
441  * output traits before calling ipConvert, this function will return them.
442  *
443  * Return value: IP_DONE=success; IP_FATAL_ERROR=misc error.
444  *
445 \*****************************************************************************/
446 
447 EXPORT(WORD) ipGetOutputTraits (
448     IP_HANDLE         hJob,      /* in:  handle to conversion job */
449     LPIP_IMAGE_TRAITS pTraits);  /* out: output image traits */
450 
451 
452 
453 /*****************************************************************************\
454  *
455  * ipGetImageTraits - Returns traits of input and output images
456  *
457  *****************************************************************************
458  *
459  * At any time after ipConvert has returned the IP_PARSED_HEADER bit, this
460  * function may be called to obtain the traits of the input and output images.
461  * If a pointer parameter is NULL, that traits record is not returned.
462  *
463  * After the conversion job is done, these traits will contain the actual
464  * number of rows input and output.
465  *
466  * Return value: IP_DONE=success; IP_FATAL_ERROR=misc error.
467  *
468 \*****************************************************************************/
469 
470 EXPORT(WORD) ipGetImageTraits (
471     IP_HANDLE         hJob,           /* in:  handle to conversion job */
472     LPIP_IMAGE_TRAITS pInputTraits,   /* out: traits of input image */
473     LPIP_IMAGE_TRAITS pOutputTraits); /* out: traits of output image */
474 
475 
476 
477 /*****************************************************************************\
478  *
479  * ipInsertedData - Client inserted some bytes into our output stream
480  *
481  *****************************************************************************
482  *
483  * After ipConvert returns the IP_WRITE_INSERT_OK bit, and after the client
484  * writes out the output buffer, he is permitted to write out some additional
485  * data for his own use, such as a thumbnail image.  After writing the added
486  * data, the client calls this function to tell us how much data he wrote.
487  *
488  * Return value: IP_DONE=success; IP_FATAL_ERROR=misc error.
489  *
490 \*****************************************************************************/
491 
492 EXPORT(WORD) ipInsertedData (
493     IP_HANDLE hJob,         /* in: handle to conversion job */
494     DWORD     dwNumBytes);  /* in: # of bytes of additional data written */
495 
496 
497 
498 /*****************************************************************************\
499  *
500  * ipOverrideDPI - Force a different DPI to be reported in the output
501  *
502  *****************************************************************************
503  *
504  * The values supplied only change the DPI that's *reported* in the output
505  * traits and in the header (if any) of the output file.  These DPI values
506  * do *not* affect the transforms, and do *not* affect or change any scaling.
507  *
508  * The image processor code supplies these values in the input traits of
509  * the last transform in the list of transforms so that they'll make it
510  * in the output file header.
511  *
512  * The DPI values are in fixed-point with 16 bits of fraction.  A value of
513  * 0 means "no override; use the normal value".
514  *
515  * Return value: IP_DONE=success; IP_FATAL_ERROR=misc error.
516  *
517 \*****************************************************************************/
518 
519 EXPORT(WORD) ipOverrideDPI (
520     IP_HANDLE hJob,        /* in: handle to conversion job */
521     DWORD     dwHorizDPI,  /* in: horiz DPI as 16.16; 0 means no override */
522     DWORD     dwVertDPI);  /* in: vert  DPI as 16.16; 0 means no override */
523 
524 
525 
526 /*****************************************************************************\
527  *
528  * ipGetFuncPtrs - Loads jump-table with pointers to the ip entry points
529  *
530  *****************************************************************************
531  *
532  * This function loads a jump-table (typedef'ed below) for your convenience
533  * so you won't have to call GetProcAddress on every function.
534  *
535  * Return value: IP_DONE=success; IP_FATAL_ERROR=misc error.
536  *
537 \*****************************************************************************/
538 
539 /*****************************************************************************\
540  *
541  * ipGetXformTable - Returns ptr to IP_XFORM_TBL for transform.
542  *
543  *****************************************************************************
544  *
545  *
546  * Return value: IP_DONE=success; IP_FATAL_ERROR=misc error.
547  *
548 \*****************************************************************************/
549 
550 EXPORT(WORD) ipGetXformTable (LPIP_XFORM_TBL phXform);
551 
552 
553 
554 /*** Prototype for ipGetFuncPtrs function ***/
555 typedef WORD (WINAPI *IPOPEN)             (int, LPIP_XFORM_SPEC,
556                                            int, LPIP_HANDLE);
557 typedef WORD (WINAPI *IPCONVERT)          (IP_HANDLE, DWORD, LPBYTE,
558                                            LPDWORD, LPDWORD, DWORD,
559                                            LPBYTE, LPDWORD, LPDWORD);
560 typedef WORD (WINAPI *IPCLOSE)            (IP_HANDLE);
561 typedef WORD (WINAPI *IPGETCLIENTDATAPTR) (IP_HANDLE, LPVOID FAR *);
562 typedef WORD (WINAPI *IPRESULTMASK)       (IP_HANDLE, WORD);
563 typedef WORD (WINAPI *IPSETDEFAULTINPUTTRAITS) (IP_HANDLE,
564                                                 LPIP_IMAGE_TRAITS);
565 typedef WORD (WINAPI *IPGETIMAGETRAITS)   (IP_HANDLE,
566                                            LPIP_IMAGE_TRAITS,
567                                            LPIP_IMAGE_TRAITS);
568 typedef WORD (WINAPI *IPINSERTEDDATA)     (IP_HANDLE, DWORD);
569 typedef WORD (WINAPI *IPOVERRIDEDPI)      (IP_HANDLE, DWORD, DWORD);
570 
571 typedef WORD (WINAPI *IPGETXFORMTABLE)    (LPIP_XFORM_TBL);
572 
573 typedef WORD (WINAPI *IPGETOUTPUTTRAITS)  (IP_HANDLE,
574                                            LPIP_IMAGE_TRAITS);
575 
576 typedef struct {
577     WORD                    wStructSize;   /* # of bytes in this struct */
578     IPOPEN                  ipOpen;
579     IPCONVERT               ipConvert;
580     IPCLOSE                 ipClose;
581     IPGETCLIENTDATAPTR      ipGetClientDataPtr;
582     IPRESULTMASK            ipResultMask;
583     IPSETDEFAULTINPUTTRAITS ipSetDefaultInputTraits;
584     IPGETIMAGETRAITS        ipGetImageTraits;
585     IPINSERTEDDATA          ipInsertedData;
586     IPOVERRIDEDPI           ipOverrideDPI;
587     IPGETOUTPUTTRAITS       ipGetOutputTraits;
588 } IP_JUMP_TBL, * PIP_JUMP_TBL, FAR * LPIP_JUMP_TBL;
589 
590 /*** Prototype for ipGetFuncPtrs function ***/
591 typedef WORD (WINAPI *LPFNIPGETFUNCPTRS)  (LPIP_JUMP_TBL);
592 
593 EXPORT(WORD) ipGetFuncPtrs (LPIP_JUMP_TBL lpJumpTbl);
594 
595 /****************************************************************************\
596  ****************************************************************************
597  *
598  * OPTION DEFINITIONS for xform drivers
599  *
600  ****************************************************************************
601 \****************************************************************************/
602 
603 /* xbi2gray.h */
604 
605 /* This .h file contains symbols for the transform in the corresponding .c file.
606  * See that .c file for instructions on using this transform.
607  */
608 
609 #define IP_BI_2_GRAY_OUTPUT_BPP		0
610 #define IP_BI_2_GRAY_WHITE_PIXEL	1
611 #define IP_BI_2_GRAY_BLACK_PIXEL	2
612 
613 
614 #if 0
615 
616 /* xbmp.h */
617 
618 /* This .h file contains symbols for the transform in the corresponding .c file.
619  * See that .c file for instructions on using this transform.
620  */
621 
622 #define IP_BMP_NEGATIVE_HEIGHT		0
623 
624 #endif
625 
626 
627 /* xchgbpp.h */
628 
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.
631  */
632 
633 #define IP_CHANGE_BPP_OUTPUT_BPP	0
634 
635 
636 /* xcolrspc.h */
637 
638 /* This .h file contains symbols for the transform in the corresponding .c file.
639  * See that .c file for instructions on using this transform.
640  */
641 
642 #define IP_CNV_COLOR_SPACE_WHICH_CNV	0
643 #define IP_CNV_COLOR_SPACE_GAMMA	1
644 
645 /* The following conversions are possible: */
646 
647 typedef enum {
648     IP_CNV_YCC_TO_CIELAB = 0,
649     IP_CNV_CIELAB_TO_YCC = 1,
650     IP_CNV_YCC_TO_SRGB   = 2,
651     IP_CNV_SRGB_TO_YCC   = 3,
652     IP_CNV_LHS_TO_SRGB   = 4,
653     IP_CNV_SRGB_TO_LHS   = 5,
654     IP_CNV_BGR_SWAP      = 100
655 } IP_WHICH_CNV;
656 
657 
658 /* xconvolve.h */
659 
660 /* This .h file contains symbols for the transform in the corresponding .c file.
661  * See that .c file for instructions on using this transform.
662  */
663 
664 #define IP_CONVOLVE_NROWS    0
665 #define IP_CONVOLVE_NCOLS    1
666 #define IP_CONVOLVE_MATRIX   2
667 #define IP_CONVOLVE_DIVISOR  3
668 
669 #define IP_CONVOLVE_MAXSIZE  9  /* up to 9x9 matrix */
670 
671 
672 /* xcrop.h */
673 
674 /* This .h file contains symbols for the transform in the corresponding .c file.
675  * See that .c file for instructions on using this transform.
676  */
677 
678 #define IP_CROP_LEFT		0
679 #define IP_CROP_RIGHT		1
680 #define IP_CROP_TOP		2
681 #define IP_CROP_MAXOUTROWS	3
682 
683 
684 /* xfakemono.h */
685 
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.
688  */
689 
690 #define IP_FAKE_MONO_BPP	0
691 
692 
693 /* xfax.h */
694 
695 /* This .h file contains symbols for the transform in the corresponding .c file.
696  * See that .c file for instructions on using this transform.
697  */
698 
699 #define IP_FAX_FORMAT		0
700 #define IP_FAX_NO_EOLS		1
701 #define IP_FAX_MIN_ROW_LEN	2
702 
703 enum {IP_FAX_MH, IP_FAX_MR, IP_FAX_MMR};
704 
705 
706 /* xgray2bi.h */
707 
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.
710  */
711 
712 #define IP_GRAY_2_BI_THRESHOLD	0
713 
714 
715 /* xgrayout.h */
716 
717 /* This .h file contains symbols for the transform in the corresponding .c file.
718  * See that .c file for instructions on using this transform.
719  */
720 
721 #define IP_GRAYOUT_LEFT		0
722 #define IP_GRAYOUT_RIGHT	1
723 #define IP_GRAYOUT_TOP		2
724 #define IP_GRAYOUT_BOTTOM	3
725 
726 
727 #if 0
728 
729 /* xheader.h */
730 
731 /* xheader.h - aXformInfo[0] struct given to xheader.c, the header generator
732  *
733  * Mark Overton, March 1998
734  */
735 
736 #define IP_HEADER_SPEC  0
737 
738 /* aXformInfo[IP_HEADER_SPEC] shall be a pointer pointing to this: */
739 
740 typedef struct {
741     PSTR    pszLeftStr;    // ptr to left-justified string; 0 -> none
742     PSTR    pszCenterStr;  // ptr to centered string; 0 -> none
743     PSTR    pszRightStr;   // ptr to right-justified string; 0 -> none
744     WORD    wCharSet;      // character set (may be a two-byte set)
745     PSTR    pszTypeFace;   // ptr to name of typeface (required)
746     float   fHeightPoints; // point-size of font
747     float   fMarginPoints; // left and right margin, in points
748     BOOL    bOverlay;      // 0=append header, 1=overlay it on top of page
749     RGBQUAD rgbWhite;      // a white pixel
750     RGBQUAD rgbBlack;      // a black pixel
751 } __attribute__((packed)) XHEADER_SPEC, *PXHEADER_SPEC, FAR*LPXHEADER_SPEC;
752 
753 /* A header is one line of text appearing at the top of faxes.  This is known
754  * as a "TTI" in faxland.  We implement this as a left-justified portion, a
755  * centered portion, and a right-justified portion.  All three portions are
756  * optional.
757  *
758  * Note that xheader.c copies over the string fields in the struct. Therefore,
759  * those strings may go away after the call to cvtOpen.
760  *
761  * The bOverlay field controls whether the header is concatenated
762  * to the top of the page (0), or overlays the top of the page (1).
763  *
764  * xheader.c needs to know what values to use for white and black pixels,
765  * so rgbWhite and rgbBlack are a white pixel and black pixel repectively.
766  * If the page data is gray (8 bits/pixel), only the rgbRed field is used.
767  * If the page data is bilevel, then only the least significant bit of rgbRed
768  * is used.
769  */
770 #endif
771 
772 
773 /* xjpg.h */
774 
775 /* This .h file contains symbols xjpg_dec.c and xjpg_enc.c
776  * See those .c files for instructions on using these transforms.
777  */
778 
779 /* Specifications for decoder: */
780 
781 #define IP_JPG_DECODE_OUTPUT_SUBSAMPLED	0
782 #define IP_JPG_DECODE_FROM_DENALI	1
783 
784 /* Specifications for encoder: */
785 
786 #define IP_JPG_ENCODE_QUALITY_FACTORS		0
787 #define IP_JPG_ENCODE_SAMPLE_FACTORS		1
788 #define IP_JPG_ENCODE_ALREADY_SUBSAMPLED	2
789 #define IP_JPG_ENCODE_FOR_DENALI		3
790 #define IP_JPG_ENCODE_OUTPUT_DNL		4
791 #define IP_JPG_ENCODE_FOR_COLOR_FAX		5
792 #define IP_JPG_ENCODE_DUMMY_HEADER_LEN		6
793 
794 
795 /* xpad.h */
796 
797 /* This .h file contains symbols for the transform in the corresponding .c file.
798  * See that .c file for instructions on using this transform.
799  */
800 
801 #define IP_PAD_LEFT		0
802 #define IP_PAD_RIGHT		1
803 #define IP_PAD_TOP		2
804 #define IP_PAD_BOTTOM		3
805 #define IP_PAD_VALUE		4
806 #define IP_PAD_MIN_HEIGHT	5
807 
808 
809 /* xrotate.h */
810 
811 /* This .h file contains symbols for the transform in the corresponding .c file.
812  * See that .c file for instructions on using this transform.
813  */
814 
815 #define IP_ROTATE_UPPER_LEFT	0
816 #define IP_ROTATE_UPPER_RIGHT	1
817 #define IP_ROTATE_LOWER_LEFT	2
818 #define IP_ROTATE_OUTPUT_SIZE	3
819 #define IP_ROTATE_FAST		4
820 
821 
822 /* xsaturation.h */
823 
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.
826  */
827 
828 #define IP_SATURATION_FACTOR	0
829 
830 
831 /* xscale.h */
832 
833 /* This .h file contains symbols for the transform in the corresponding .c file.
834  * See that .c file for instructions on using this transform.
835  */
836 
837 #define IP_SCALE_HORIZ_FACTOR	0
838 #define IP_SCALE_VERT_FACTOR	1
839 #define IP_SCALE_FAST		2
840 
841 
842 /* xskel.h */
843 
844 /* This .h file contains symbols for the transform in the corresponding .c file.
845  * See that .c file for instructions on using this transform.
846  */
847 
848 #define IP_SKEL_SPEC_1		0
849 #define IP_SKEL_SPEC_2		1
850 
851 
852 /* xtable.h */
853 
854 /* This .h file contains symbols for the transform in the corresponding .c file.
855  * See that .c file for instructions on using this transform.
856  */
857 
858 #define IP_TABLE_WHICH	0
859 #define IP_TABLE_OPTION	1
860 
861 #define IP_TABLE_COLOR_1   1
862 #define IP_TABLE_COLOR_2   2
863 #define IP_TABLE_COLOR_3   3
864 
865 typedef enum {
866     IP_TABLE_USER,
867     IP_TABLE_PASS_THRU,
868     IP_TABLE_GAMMA,
869     IP_TABLE_THRESHOLD,
870     IP_TABLE_MIRROR,
871     IP_TABLE_USER_THREE,
872     IP_TABLE_BW_CLIP,
873     IP_TABLE_USER_WORD,
874     IP_TABLE_USER_THREE_WORD
875 } IP_TABLE_TYPE;
876 
877 
878 /* xthumb.h */
879 
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.
882  */
883 
884 #define IP_THUMB_SCALE_SPEC  0
885 
886 
887 /* xtiff.h */
888 
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.
891  */
892 
893 #define IP_TIFF_FILE_PATH	0
894 
895 
896 /* xtonemap.h */
897 
898 /* This .h file contains symbols for the transform in the corresponding .c file.
899  * See that .c file for instructions on using this transform.
900  */
901 
902 #define IP_TONEMAP_POINTER	0
903 #define IP_TONEMAP_LUM_SPACE	1
904 
905 
906 /* xyxtract.h */
907 
908 /* This .h file contains symbols for the transform in the corresponding .c file.
909  * See that .c file for instructions on using this transform.
910  */
911 
912 #define IP_Y_EXTRACT_COLOR_SPACE	0
913 
914 typedef enum {
915    IP_Y_EXTRACT_LUM_CHROME,
916    IP_Y_EXTRACT_RGB,
917    IP_Y_EXTRACT_BGR
918 } IP_Y_EXTRACT_WHICH_SPACE;
919 
920 #if defined(__cplusplus)
921 	}
922 #endif
923 
924 #endif
925 
926 
927 /* End of File */
928