1 /* Copyright (C) 1994, 1995, 1996, 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: gxpaint.h,v 1.5 2002/06/16 08:45:43 lpd Exp $ */ 18 /* Internal interface to fill/stroke */ 19 /* Requires gsropt.h, gxfixed.h, gxpath.h */ 20 21 #ifndef gxpaint_INCLUDED 22 # define gxpaint_INCLUDED 23 24 #ifndef gs_imager_state_DEFINED 25 # define gs_imager_state_DEFINED 26 typedef struct gs_imager_state_s gs_imager_state; 27 #endif 28 29 #ifndef gs_state_DEFINED 30 # define gs_state_DEFINED 31 typedef struct gs_state_s gs_state; 32 #endif 33 34 #ifndef gx_device_DEFINED 35 # define gx_device_DEFINED 36 typedef struct gx_device_s gx_device; 37 #endif 38 39 #ifndef gx_device_color_DEFINED 40 # define gx_device_color_DEFINED 41 typedef struct gx_device_color_s gx_device_color; 42 #endif 43 44 /* ------ Graphics-state-aware procedures ------ */ 45 46 /* 47 * The following procedures use information from the graphics state. 48 * They are implemented in gxpaint.c. 49 */ 50 51 int gx_fill_path(gx_path * ppath, gx_device_color * pdevc, gs_state * pgs, 52 int rule, fixed adjust_x, fixed adjust_y); 53 int gx_stroke_fill(gx_path * ppath, gs_state * pgs); 54 int gx_stroke_add(gx_path *ppath, gx_path *to_path, const gs_state * pgs); 55 /* 56 * gx_imager_stroke_add needs a device for the sake of absolute-length 57 * dots (and for no other reason). 58 */ 59 int gx_imager_stroke_add(gx_path *ppath, gx_path *to_path, 60 gx_device *dev, const gs_imager_state *pis); 61 62 /* ------ Imager procedures ------ */ 63 64 /* 65 * Tweak the fill adjustment if necessary so that (nearly) empty 66 * rectangles are guaranteed to produce some output. 67 */ 68 void gx_adjust_if_empty(const gs_fixed_rect *, gs_fixed_point *); 69 70 /* 71 * Compute the amount by which to expand a stroked bounding box to account 72 * for line width, caps and joins. If the amount is too large to fit in a 73 * gs_fixed_point, return gs_error_limitcheck. Return 0 if the result is 74 * exact, 1 if it is conservative. 75 * 76 * This procedure is fast, but the result may be conservative by a large 77 * amount if the miter limit is large. If this matters, use strokepath + 78 * pathbbox. 79 */ 80 int gx_stroke_path_expansion(const gs_imager_state *pis, 81 const gx_path *ppath, gs_fixed_point *ppt); 82 83 /* Backward compatibility */ 84 #define gx_stroke_expansion(pis, ppt)\ 85 gx_stroke_path_expansion(pis, (const gx_path *)0, ppt) 86 87 /* 88 * The following procedures do not need a graphics state. 89 * These procedures are implemented in gxfill.c and gxstroke.c. 90 */ 91 92 /* Define the parameters passed to the imager's filling routine. */ 93 #ifndef gx_fill_params_DEFINED 94 # define gx_fill_params_DEFINED 95 typedef struct gx_fill_params_s gx_fill_params; 96 #endif 97 struct gx_fill_params_s { 98 int rule; /* -1 = winding #, 1 = even/odd */ 99 gs_fixed_point adjust; 100 float flatness; 101 bool fill_zero_width; /* if true, make zero-width/height */ 102 /* rectangles one pixel wide/high */ 103 }; 104 105 #define gx_fill_path_only(ppath, dev, pis, params, pdevc, pcpath)\ 106 (*dev_proc(dev, fill_path))(dev, pis, ppath, params, pdevc, pcpath) 107 108 /* Define the parameters passed to the imager's stroke routine. */ 109 #ifndef gx_stroke_params_DEFINED 110 # define gx_stroke_params_DEFINED 111 typedef struct gx_stroke_params_s gx_stroke_params; 112 #endif 113 struct gx_stroke_params_s { 114 float flatness; 115 }; 116 117 int gx_stroke_path_only(gx_path * ppath, gx_path * to_path, gx_device * dev, 118 const gs_imager_state * pis, 119 const gx_stroke_params * params, 120 const gx_device_color * pdevc, 121 const gx_clip_path * pcpath); 122 123 #endif /* gxpaint_INCLUDED */ 124