1 /* Copyright (C) 2001-2006 Artifex Software, Inc.
2    All Rights Reserved.
3 
4    This software is provided AS-IS with no warranty, either express or
5    implied.
6 
7    This software is distributed under license and may not be copied, modified
8    or distributed except as expressly authorized under the terms of that
9    license.  Refer to licensing information at http://www.artifex.com/
10    or contact Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134,
11    San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
12 */
13 
14 /* $Id: gsht.h 8022 2007-06-05 22:23:38Z giles $ */
15 /* Public interface to halftone functionality */
16 
17 #ifndef gsht_INCLUDED
18 #  define gsht_INCLUDED
19 
20 /* Client definition of (Type 1) halftones */
21 typedef struct gs_screen_halftone_s {
22     float frequency;
23     float angle;
24     float (*spot_function) (floatp, floatp);
25     /* setscreen or sethalftone sets these: */
26     /* (a Level 2 feature, but we include them in Level 1) */
27     float actual_frequency;
28     float actual_angle;
29 } gs_screen_halftone;
30 
31 #define st_screen_halftone_max_ptrs 0
32 
33 /* Client definition of color (Type 2) halftones */
34 typedef struct gs_colorscreen_halftone_s {
35     union _css {
36 	gs_screen_halftone indexed[4];
37 	struct _csc {
38 	    gs_screen_halftone red, green, blue, gray;
39 	} colored;
40     } screens;
41 } gs_colorscreen_halftone;
42 
43 #define st_colorscreen_halftone_max_ptrs 0
44 
45 /* Procedural interface */
46 int gs_setscreen(gs_state *, gs_screen_halftone *);
47 int gs_currentscreen(const gs_state *, gs_screen_halftone *);
48 int gs_currentscreenlevels(const gs_state *);
49 
50 /*
51  * Enumeration-style definition of a single screen.  The client must:
52  *      - probably, call gs_screen_enum_alloc;
53  *      - call gs_screen_init;
54  *      - in a loop,
55  *              - call gs_screen_currentpoint; if it returns 1, exit;
56  *              - call gs_screen_next;
57  *      - if desired, call gs_screen_install to install the screen.
58  */
59 typedef struct gs_screen_enum_s gs_screen_enum;
60 gs_screen_enum *gs_screen_enum_alloc(gs_memory_t *, client_name_t);
61 int gs_screen_init(gs_screen_enum *, gs_state *, gs_screen_halftone *);
62 int gs_screen_currentpoint(gs_screen_enum *, gs_point *);
63 int gs_screen_next(gs_screen_enum *, floatp);
64 int gs_screen_install(gs_screen_enum *);
65 
66 #endif /* gsht_INCLUDED */
67