1
0

gxpaint.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /* Copyright (C) 1994, 1995, 1996, 1997, 1999 Aladdin Enterprises. All rights reserved.
  2. This software is provided AS-IS with no warranty, either express or
  3. implied.
  4. This software is distributed under license and may not be copied,
  5. modified or distributed except as expressly authorized under the terms
  6. of the license contained in the file LICENSE in this distribution.
  7. For more information about licensing, please refer to
  8. http://www.ghostscript.com/licensing/. For information on
  9. commercial licensing, go to http://www.artifex.com/licensing/ or
  10. contact Artifex Software, Inc., 101 Lucas Valley Road #110,
  11. San Rafael, CA 94903, U.S.A., +1(415)492-9861.
  12. */
  13. /* $Id: gxpaint.h,v 1.5 2002/06/16 08:45:43 lpd Exp $ */
  14. /* Internal interface to fill/stroke */
  15. /* Requires gsropt.h, gxfixed.h, gxpath.h */
  16. #ifndef gxpaint_INCLUDED
  17. # define gxpaint_INCLUDED
  18. #ifndef gs_imager_state_DEFINED
  19. # define gs_imager_state_DEFINED
  20. typedef struct gs_imager_state_s gs_imager_state;
  21. #endif
  22. #ifndef gs_state_DEFINED
  23. # define gs_state_DEFINED
  24. typedef struct gs_state_s gs_state;
  25. #endif
  26. #ifndef gx_device_DEFINED
  27. # define gx_device_DEFINED
  28. typedef struct gx_device_s gx_device;
  29. #endif
  30. #ifndef gx_device_color_DEFINED
  31. # define gx_device_color_DEFINED
  32. typedef struct gx_device_color_s gx_device_color;
  33. #endif
  34. /* ------ Graphics-state-aware procedures ------ */
  35. /*
  36. * The following procedures use information from the graphics state.
  37. * They are implemented in gxpaint.c.
  38. */
  39. int gx_fill_path(gx_path * ppath, gx_device_color * pdevc, gs_state * pgs,
  40. int rule, fixed adjust_x, fixed adjust_y);
  41. int gx_stroke_fill(gx_path * ppath, gs_state * pgs);
  42. int gx_stroke_add(gx_path *ppath, gx_path *to_path, const gs_state * pgs);
  43. /*
  44. * gx_imager_stroke_add needs a device for the sake of absolute-length
  45. * dots (and for no other reason).
  46. */
  47. int gx_imager_stroke_add(gx_path *ppath, gx_path *to_path,
  48. gx_device *dev, const gs_imager_state *pis);
  49. /* ------ Imager procedures ------ */
  50. /*
  51. * Tweak the fill adjustment if necessary so that (nearly) empty
  52. * rectangles are guaranteed to produce some output.
  53. */
  54. void gx_adjust_if_empty(const gs_fixed_rect *, gs_fixed_point *);
  55. /*
  56. * Compute the amount by which to expand a stroked bounding box to account
  57. * for line width, caps and joins. If the amount is too large to fit in a
  58. * gs_fixed_point, return gs_error_limitcheck. Return 0 if the result is
  59. * exact, 1 if it is conservative.
  60. *
  61. * This procedure is fast, but the result may be conservative by a large
  62. * amount if the miter limit is large. If this matters, use strokepath +
  63. * pathbbox.
  64. */
  65. int gx_stroke_path_expansion(const gs_imager_state *pis,
  66. const gx_path *ppath, gs_fixed_point *ppt);
  67. /* Backward compatibility */
  68. #define gx_stroke_expansion(pis, ppt)\
  69. gx_stroke_path_expansion(pis, (const gx_path *)0, ppt)
  70. /*
  71. * The following procedures do not need a graphics state.
  72. * These procedures are implemented in gxfill.c and gxstroke.c.
  73. */
  74. /* Define the parameters passed to the imager's filling routine. */
  75. #ifndef gx_fill_params_DEFINED
  76. # define gx_fill_params_DEFINED
  77. typedef struct gx_fill_params_s gx_fill_params;
  78. #endif
  79. struct gx_fill_params_s {
  80. int rule; /* -1 = winding #, 1 = even/odd */
  81. gs_fixed_point adjust;
  82. float flatness;
  83. bool fill_zero_width; /* if true, make zero-width/height */
  84. /* rectangles one pixel wide/high */
  85. };
  86. #define gx_fill_path_only(ppath, dev, pis, params, pdevc, pcpath)\
  87. (*dev_proc(dev, fill_path))(dev, pis, ppath, params, pdevc, pcpath)
  88. /* Define the parameters passed to the imager's stroke routine. */
  89. #ifndef gx_stroke_params_DEFINED
  90. # define gx_stroke_params_DEFINED
  91. typedef struct gx_stroke_params_s gx_stroke_params;
  92. #endif
  93. struct gx_stroke_params_s {
  94. float flatness;
  95. };
  96. int gx_stroke_path_only(gx_path * ppath, gx_path * to_path, gx_device * dev,
  97. const gs_imager_state * pis,
  98. const gx_stroke_params * params,
  99. const gx_device_color * pdevc,
  100. const gx_clip_path * pcpath);
  101. #endif /* gxpaint_INCLUDED */