1 /* Copyright (C) 1997, 1999 artofcode LLC.  All rights reserved.
2 
3   This program is free software; you can redistribute it and/or modify it
4   under the terms of the GNU General Public License as published by the
5   Free Software Foundation; either version 2 of the License, or (at your
6   option) any later version.
7 
8   This program is distributed in the hope that it will be useful, but
9   WITHOUT ANY WARRANTY; without even the implied warranty of
10   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11   General Public License for more details.
12 
13   You should have received a copy of the GNU General Public License along
14   with this program; if not, write to the Free Software Foundation, Inc.,
15   59 Temple Place, Suite 330, Boston, MA, 02111-1307.
16 
17 */
18 
19 /*$Id: gsptype2.h,v 1.4.2.1.2.1 2003/01/17 00:49:03 giles Exp $ */
20 /* Client interface to PatternType 2 Patterns */
21 
22 #ifndef gsptype2_INCLUDED
23 #  define gsptype2_INCLUDED
24 
25 #include "gspcolor.h"
26 #include "gxfixed.h"
27 
28 /* ---------------- Types and structures ---------------- */
29 
30 /* PatternType 2 template */
31 
32 #ifndef gs_shading_t_DEFINED
33 #  define gs_shading_t_DEFINED
34 typedef struct gs_shading_s gs_shading_t;
35 #endif
36 
37 typedef struct gs_pattern2_template_s {
38     gs_pattern_template_common;
39     const gs_shading_t *Shading;
40 } gs_pattern2_template_t;
41 
42 #define private_st_pattern2_template() /* in gsptype2.c */\
43   gs_private_st_suffix_add1(st_pattern2_template,\
44     gs_pattern2_template_t, "gs_pattern2_template_t",\
45     pattern2_template_enum_ptrs, pattern2_template_reloc_ptrs,\
46     st_pattern_template, Shading)
47 #define st_pattern2_template_max_ptrs (st_pattern_template_max_ptrs + 1)
48 
49 /* PatternType 2 instance */
50 
51 #ifndef gx_device_color_DEFINED
52 #  define gx_device_color_DEFINED
53 typedef struct gx_device_color_s gx_device_color;
54 #endif
55 
56 typedef struct gs_pattern2_instance_s {
57     gs_pattern_instance_common;
58     gs_pattern2_template_t template;
59 } gs_pattern2_instance_t;
60 
61 #define private_st_pattern2_instance() /* in gsptype2.c */\
62   gs_private_st_composite(st_pattern2_instance, gs_pattern2_instance_t,\
63     "gs_pattern2_instance_t", pattern2_instance_enum_ptrs,\
64     pattern2_instance_reloc_ptrs)
65 
66 #ifndef gx_path_DEFINED
67 #define gx_path_DEFINED
68 typedef struct gx_path_s gx_path;
69 #endif
70 
71 #ifndef gx_device_DEFINED
72 #define gx_device_DEFINED
73 typedef struct gx_device_s gx_device;
74 #endif
75 
76 /* ---------------- Procedures ---------------- */
77 
78 /*
79  * We should provide a gs_cspace_build_Pattern2 procedure to construct
80  * the color space, but we don't.
81  */
82 
83 /* Initialize a PatternType 2 pattern. */
84 void gs_pattern2_init(P1(gs_pattern2_template_t *));
85 
86 /* Check device color for Pattern Type 2. */
87 bool gx_dc_is_pattern2_color(const gx_device_color *pdevc);
88 
89 /* Fill path or rect, with adjustment, and with a PatternType 2 color. */
90 int gx_dc_pattern2_fill_path_adjusted(const gx_device_color * pdevc,
91 			      gx_path * ppath, gs_fixed_rect * rect,
92 			      gx_device * dev);
93 
94 
95 #endif /* gsptype2_INCLUDED */
96