1 /* Copyright (C) 1997, 1999 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: gsptype2.h,v 1.13 2005/05/23 18:24:59 igor Exp $ */ 18 /* Client interface to PatternType 2 Patterns */ 19 20 #ifndef gsptype2_INCLUDED 21 # define gsptype2_INCLUDED 22 23 #include "gspcolor.h" 24 #include "gsdcolor.h" 25 #include "gxfixed.h" 26 27 /* ---------------- Types and structures ---------------- */ 28 29 /* PatternType 2 template */ 30 31 #ifndef gs_shading_t_DEFINED 32 # define gs_shading_t_DEFINED 33 typedef struct gs_shading_s gs_shading_t; 34 #endif 35 36 typedef struct gs_pattern2_template_s { 37 gs_pattern_template_common; 38 const gs_shading_t *Shading; 39 } gs_pattern2_template_t; 40 41 #define private_st_pattern2_template() /* in gsptype2.c */\ 42 gs_private_st_suffix_add1(st_pattern2_template,\ 43 gs_pattern2_template_t, "gs_pattern2_template_t",\ 44 pattern2_template_enum_ptrs, pattern2_template_reloc_ptrs,\ 45 st_pattern_template, Shading) 46 #define st_pattern2_template_max_ptrs (st_pattern_template_max_ptrs + 1) 47 48 /* PatternType 2 instance */ 49 50 #ifndef gx_device_color_DEFINED 51 # define gx_device_color_DEFINED 52 typedef struct gx_device_color_s gx_device_color; 53 #endif 54 55 typedef struct gs_pattern2_instance_s { 56 gs_pattern_instance_common; 57 gs_pattern2_template_t template; 58 bool shfill; 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 extern const gx_device_color_type_t gx_dc_pattern2; 77 78 #define gx_dc_type_pattern2 (&gx_dc_pattern2) 79 80 /* ---------------- Procedures ---------------- */ 81 82 /* 83 * We should provide a gs_cspace_build_Pattern2 procedure to construct 84 * the color space, but we don't. 85 */ 86 87 /* Initialize a PatternType 2 pattern. */ 88 void gs_pattern2_init(gs_pattern2_template_t *); 89 90 /* Check device color for Pattern Type 2. */ 91 bool gx_dc_is_pattern2_color(const gx_device_color *pdevc); 92 93 /* Fill path or rect, and with a PatternType 2 color. */ 94 int gx_dc_pattern2_fill_path(const gx_device_color * pdevc, 95 gx_path * ppath, gs_fixed_rect * rect, 96 gx_device * dev); 97 98 /* Set the 'shfill' flag to a PatternType 2 pattern instance. */ 99 int gs_pattern2_set_shfill(gs_client_color * pcc); 100 101 /* Transform a shading bounding box into device space. */ 102 int gx_dc_pattern2_shade_bbox_transform2fixed(const gs_rect * rect, 103 const gs_imager_state * pis, gs_fixed_rect * rfixed); 104 105 /* Get a shading bbox. Returns 1 on success. */ 106 int gx_dc_pattern2_get_bbox(const gx_device_color * pdevc, gs_fixed_rect *bbox); 107 108 /* Check device color for a possibly self-overlapping shading. */ 109 bool gx_dc_pattern2_can_overlap(const gx_device_color *pdevc); 110 111 /* Check whether a pattern color has a background. */ 112 bool gx_dc_pattern2_has_background(const gx_device_color *pdevc); 113 #endif /* gsptype2_INCLUDED */ 114