gxline.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* Copyright (C) 1995, 1996, 1998, 1999 Aladdin Enterprises. All rights reserved.
  2. This file is part of AFPL Ghostscript.
  3. AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author or
  4. distributor accepts any responsibility for the consequences of using it, or
  5. for whether it serves any particular purpose or works at all, unless he or
  6. she says so in writing. Refer to the Aladdin Free Public License (the
  7. "License") for full details.
  8. Every copy of AFPL Ghostscript must include a copy of the License, normally
  9. in a plain ASCII text file named PUBLIC. The License grants you the right
  10. to copy, modify and redistribute AFPL Ghostscript, but only under certain
  11. conditions described in the License. Among other things, the License
  12. requires that the copyright notice and this notice be preserved on all
  13. copies.
  14. */
  15. /*$Id: gxline.h,v 1.2 2000/09/19 19:00:38 lpd Exp $ */
  16. /* Private line parameter definitions */
  17. #ifndef gxline_INCLUDED
  18. # define gxline_INCLUDED
  19. #include "gslparam.h"
  20. #include "gsmatrix.h"
  21. /* Line parameter structures */
  22. /* gx_dash_params are never instantiated by themselves. */
  23. typedef struct gx_dash_params_s {
  24. float *pattern;
  25. uint pattern_size;
  26. float offset;
  27. bool adapt;
  28. /* The rest of the parameters are computed from the above */
  29. float pattern_length; /* total of all pattern elements */
  30. bool init_ink_on; /* true if ink is initially on */
  31. int init_index; /* initial index in pattern */
  32. float init_dist_left;
  33. } gx_dash_params;
  34. #define gx_dash_params_initial\
  35. NULL, 0, 0.0, 0/*false*/, 0.0, 1/*true*/, 0, 0.0
  36. typedef struct gx_line_params_s {
  37. float half_width; /* one-half line width */
  38. gs_line_cap cap;
  39. gs_line_join join;
  40. int curve_join; /* <0 means use join between segments of */
  41. /* flattened curves, >=0 means use this join */
  42. float miter_limit;
  43. float miter_check; /* computed from miter limit, */
  44. /* see gx_set_miter_limit and gs_stroke */
  45. float dot_length;
  46. bool dot_length_absolute; /* if true, dot_length is 1/72" units */
  47. gs_matrix dot_orientation; /* dot length is aligned with (1,0); */
  48. /* must be xxyy or xyyx */
  49. gx_dash_params dash;
  50. } gx_line_params;
  51. #define gx_set_line_width(plp, wid)\
  52. ((plp)->half_width = (wid) / 2)
  53. #define gx_current_line_width(plp)\
  54. ((plp)->half_width * 2)
  55. int gx_set_miter_limit(P2(gx_line_params *, floatp));
  56. #define gx_current_miter_limit(plp)\
  57. ((plp)->miter_limit)
  58. int gx_set_dash(P5(gx_dash_params *, const float *, uint, floatp,
  59. gs_memory_t *));
  60. #define gx_set_dash_adapt(pdp, adpt) ((pdp)->adapt = (adpt))
  61. int gx_set_dot_length(P3(gx_line_params *, floatp, bool));
  62. /* See gsline.c for the computation of miter_check. */
  63. #define gx_line_params_initial\
  64. 0.0, gs_cap_butt, gs_join_miter, gs_join_bevel /* for Adobe compatibility */,\
  65. 10.0, 0.20305866, 0.0, 0/*false*/,\
  66. { identity_matrix_body }, { gx_dash_params_initial }
  67. #endif /* gxline_INCLUDED */