1 /* Copyright (C) 2001-2012 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, 8 modified or distributed except as expressly authorized under the terms 9 of the license contained in the file LICENSE in this distribution. 10 11 Refer to licensing information at http://www.artifex.com or contact 12 Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael, 13 CA 94903, U.S.A., +1(415)492-9861, for further information. 14 */ 15 16 17 /* Private line parameter definitions */ 18 19 #ifndef gxline_INCLUDED 20 # define gxline_INCLUDED 21 22 #include "math_.h" 23 #include "gslparam.h" 24 #include "gsmatrix.h" 25 26 /* Line parameter structures */ 27 /* gx_dash_params are never instantiated by themselves. */ 28 typedef struct gx_dash_params_s { 29 float *pattern; 30 uint pattern_size; 31 float offset; 32 bool adapt; 33 /* The rest of the parameters are computed from the above */ 34 float pattern_length; /* total of all pattern elements */ 35 bool init_ink_on; /* true if ink is initially on */ 36 int init_index; /* initial index in pattern */ 37 float init_dist_left; 38 } gx_dash_params; 39 40 #define gx_dash_params_initial\ 41 NULL, 0, 0.0, 0/*false*/, 0.0, 1/*true*/, 0, 0.0 42 typedef struct gx_line_params_s { 43 float half_width; /* one-half line width */ 44 gs_line_cap start_cap; /* Cap to use on start of line */ 45 gs_line_cap end_cap; /* Cap to use on end of line */ 46 gs_line_cap dash_cap; /* Cap to use on start/end of dash segment */ 47 gs_line_join join; 48 int curve_join; /* <0 means use join between segments of */ 49 /* flattened curves, >=0 means use this join */ 50 float miter_limit; 51 float miter_check; /* computed from miter limit, */ 52 /* see gx_set_miter_limit and gs_stroke */ 53 float dot_length; 54 bool dot_length_absolute; /* if true, dot_length is 1/72" units */ 55 gs_matrix dot_orientation; /* dot length is aligned with (1,0); */ 56 /* must be xxyy or xyyx */ 57 gx_dash_params dash; 58 } gx_line_params; 59 60 #define gx_set_line_width(plp, wid)\ 61 ((plp)->half_width = fabs(wid) / 2) 62 #define gx_current_line_width(plp)\ 63 ((plp)->half_width * 2) 64 int gx_set_miter_limit(gx_line_params *, floatp); 65 66 #define gx_current_miter_limit(plp)\ 67 ((plp)->miter_limit) 68 int gx_set_dash(gx_dash_params *, const float *, uint, floatp, gs_memory_t *); 69 70 #define gx_set_dash_adapt(pdp, adpt) ((pdp)->adapt = (adpt)) 71 int gx_set_dot_length(gx_line_params *, floatp, bool); 72 73 /* See gsline.c for the computation of miter_check. */ 74 #define gx_line_params_initial\ 75 0.0, gs_cap_butt, gs_cap_butt, gs_cap_butt, gs_join_miter, -1,\ 76 10.0, (float)0.20305866, 0.0, 0/*false*/,\ 77 { identity_matrix_body }, { gx_dash_params_initial } 78 79 #endif /* gxline_INCLUDED */ 80