xref: /plan9/sys/src/cmd/gs/src/gsht.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1993, 1994, 1997 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: gsht.h,v 1.5 2002/06/16 08:45:42 lpd Exp $ */
18 /* Public interface to halftone functionality */
19 
20 #ifndef gsht_INCLUDED
21 #  define gsht_INCLUDED
22 
23 /* Client definition of (Type 1) halftones */
24 typedef struct gs_screen_halftone_s {
25     float frequency;
26     float angle;
27     float (*spot_function) (floatp, floatp);
28     /* setscreen or sethalftone sets these: */
29     /* (a Level 2 feature, but we include them in Level 1) */
30     float actual_frequency;
31     float actual_angle;
32 } gs_screen_halftone;
33 
34 #define st_screen_halftone_max_ptrs 0
35 
36 /* Client definition of color (Type 2) halftones */
37 typedef struct gs_colorscreen_halftone_s {
38     union _css {
39 	gs_screen_halftone indexed[4];
40 	struct _csc {
41 	    gs_screen_halftone red, green, blue, gray;
42 	} colored;
43     } screens;
44 } gs_colorscreen_halftone;
45 
46 #define st_colorscreen_halftone_max_ptrs 0
47 
48 /* Procedural interface */
49 int gs_setscreen(gs_state *, gs_screen_halftone *);
50 int gs_currentscreen(const gs_state *, gs_screen_halftone *);
51 int gs_currentscreenlevels(const gs_state *);
52 
53 /*
54  * Enumeration-style definition of a single screen.  The client must:
55  *      - probably, call gs_screen_enum_alloc;
56  *      - call gs_screen_init;
57  *      - in a loop,
58  *              - call gs_screen_currentpoint; if it returns 1, exit;
59  *              - call gs_screen_next;
60  *      - if desired, call gs_screen_install to install the screen.
61  */
62 typedef struct gs_screen_enum_s gs_screen_enum;
63 gs_screen_enum *gs_screen_enum_alloc(gs_memory_t *, client_name_t);
64 int gs_screen_init(gs_screen_enum *, gs_state *, gs_screen_halftone *);
65 int gs_screen_currentpoint(gs_screen_enum *, gs_point *);
66 int gs_screen_next(gs_screen_enum *, floatp);
67 int gs_screen_install(gs_screen_enum *);
68 
69 #endif /* gsht_INCLUDED */
70