xref: /plan9/sys/src/cmd/gs/src/gsfunc3.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1997, 1998 Aladdin Enterprises.  All rights reserved.
2 
3   This software is provided AS-IS with no warranty, either express or
4   implied.
5 
6   This software is distributed under license and may not be copied,
7   modified or distributed except as expressly authorized under the terms
8   of the license contained in the file LICENSE in this distribution.
9 
10   For more information about licensing, please refer to
11   http://www.ghostscript.com/licensing/. For information on
12   commercial licensing, go to http://www.artifex.com/licensing/ or
13   contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14   San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15 */
16 
17 /* $Id: gsfunc3.h,v 1.5 2002/06/16 08:45:42 lpd Exp $ */
18 /* Definitions for LL3 Functions */
19 
20 #ifndef gsfunc3_INCLUDED
21 #  define gsfunc3_INCLUDED
22 
23 #include "gsfunc.h"
24 #include "gsdsrc.h"
25 
26 /* ---------------- Types and structures ---------------- */
27 
28 /*
29  * Define the Function types.
30  * See gsfunc.h for why gs_function_type_t can't be an enum type.
31  */
32 enum {
33     function_type_ExponentialInterpolation = 2,
34     function_type_1InputStitching = 3,
35     /* For internal use only */
36     function_type_ArrayedOutput = -1
37 };
38 
39 /* Define Exponential Interpolation functions. */
40 typedef struct gs_function_ElIn_params_s {
41     gs_function_params_common;
42     const float *C0;		/* n, optional */
43     const float *C1;		/* n, optional */
44     float N;
45 } gs_function_ElIn_params_t;
46 
47 #define private_st_function_ElIn()	/* in gsfunc.c */\
48   gs_private_st_suffix_add2(st_function_ElIn, gs_function_ElIn_t,\
49     "gs_function_ElIn_t", function_ElIn_enum_ptrs, function_ElIn_reloc_ptrs,\
50     st_function, params.C0, params.C1)
51 
52 /* Define 1-Input Stitching functions. */
53 typedef struct gs_function_1ItSg_params_s {
54     gs_function_params_common;
55     int k;
56     const gs_function_t *const *Functions;	/* k */
57     const float *Bounds;	/* k - 1 */
58     const float *Encode;	/* 2 x k */
59 } gs_function_1ItSg_params_t;
60 
61 #define private_st_function_1ItSg()	/* in gsfunc.c */\
62   gs_private_st_suffix_add3(st_function_1ItSg, gs_function_1ItSg_t,\
63     "gs_function_1ItSg_t", function_1ItSg_enum_ptrs, function_1ItSg_reloc_ptrs,\
64     st_function, params.Functions, params.Bounds, params.Encode)
65 
66 /*
67  * Define Arrayed Output functions.  These consist of n m x 1 functions
68  * whose outputs are assembled into the output of the arrayed function.
69  * We use them to handle certain PostScript constructs that can accept
70  * either a single n-output function or n 1-output functions.
71  *
72  * Note that for this type, and only this type, both Domain and Range
73  * are ignored (0).
74  */
75 typedef struct gs_function_AdOt_params_s {
76     gs_function_params_common;
77     const gs_function_t *const *Functions;	/* n */
78 } gs_function_AdOt_params_t;
79 
80 #define private_st_function_AdOt()	/* in gsfunc.c */\
81   gs_private_st_suffix_add1(st_function_AdOt, gs_function_AdOt_t,\
82     "gs_function_AdOt_t", function_AdOt_enum_ptrs, function_AdOt_reloc_ptrs,\
83     st_function, params.Functions)
84 
85 /* ---------------- Procedures ---------------- */
86 
87 /* Allocate and initialize functions of specific types. */
88 int gs_function_ElIn_init(gs_function_t ** ppfn,
89 			  const gs_function_ElIn_params_t * params,
90 			  gs_memory_t * mem);
91 int gs_function_1ItSg_init(gs_function_t ** ppfn,
92 			   const gs_function_1ItSg_params_t * params,
93 			   gs_memory_t * mem);
94 int gs_function_AdOt_init(gs_function_t ** ppfn,
95 			  const gs_function_AdOt_params_t * params,
96 			  gs_memory_t * mem);
97 
98 /* Free parameters of specific types. */
99 void gs_function_ElIn_free_params(gs_function_ElIn_params_t * params,
100 				  gs_memory_t * mem);
101 void gs_function_1ItSg_free_params(gs_function_1ItSg_params_t * params,
102 				   gs_memory_t * mem);
103 void gs_function_AdOt_free_params(gs_function_AdOt_params_t * params,
104 				  gs_memory_t * mem);
105 
106 #endif /* gsfunc3_INCLUDED */
107