home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / g / gs252src.zip / GS252 / GXPATH.H < prev    next >
C/C++ Source or Header  |  1992-07-18  |  5KB  |  109 lines

  1. /* Copyright (C) 1989, 1992 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.  */
  19.  
  20. /* gxpath.h */
  21. /* Lower-level path routines for Ghostscript library */
  22. /* Requires gxfixed.h */
  23.  
  24. /* The routines and types in this interface use */
  25. /* device, rather than user, coordinates, and fixed-point, */
  26. /* rather than floating, representation. */
  27.  
  28. /* Opaque type for a path */
  29. typedef struct gx_path_s gx_path;
  30. extern const uint gs_path_sizeof;
  31.  
  32. /* Opaque type for a path enumerator */
  33. typedef struct gx_path_enum_s gx_path_enum;
  34. extern const uint gx_path_enum_sizeof;
  35.  
  36. /* Define the two insideness rules */
  37. #define gx_rule_winding_number (-1)
  38. #define gx_rule_even_odd 1
  39.  
  40. /* Debugging routines */
  41. #ifdef DEBUG
  42. extern    void    gx_path_print(P1(const gx_path *));
  43. #endif
  44.  
  45. /* Path constructors. */
  46. extern    void    gx_path_init(P2(gx_path *, const gs_memory_procs *)),
  47.         gx_path_release(P1(gx_path *)),
  48.         gx_path_share(P1(gx_path *));
  49. extern    int    gx_path_add_point(P3(gx_path *, fixed, fixed)),
  50.         gx_path_add_relative_point(P3(gx_path *, fixed, fixed)),
  51.         gx_path_add_line(P3(gx_path *, fixed, fixed)),
  52.         gx_path_add_rectangle(P5(gx_path *, fixed, fixed, fixed, fixed)),
  53.         gx_path_add_pgram(P7(gx_path *, fixed, fixed, fixed, fixed, fixed, fixed)),
  54.         gx_path_add_curve(P7(gx_path *, fixed, fixed, fixed, fixed, fixed, fixed)),
  55.         gx_path_add_flattened_curve(P8(gx_path *, fixed, fixed, fixed, fixed, fixed, fixed, floatp)),
  56.         gx_path_add_arc(P8(gx_path *, fixed, fixed, fixed, fixed, fixed, fixed, floatp)),
  57.         gx_path_add_path(P2(gx_path *, gx_path *)),
  58.         gx_path_close_subpath(P1(gx_path *));
  59. /* The last argument to gx_path_add_arc is a fraction for computing */
  60. /* the curve parameters.  Here is the correct value for quarter-circles. */
  61. /* (stroke uses this to draw round caps and joins.) */
  62. #define quarter_arc_fraction 0.552285
  63.  
  64. /* Path accessors */
  65.  
  66. extern    int    gx_path_current_point(P2(const gx_path *, gs_fixed_point *)),
  67.         gx_path_bbox(P2(gx_path *, gs_fixed_rect *)),
  68.         gx_path_has_curves(P1(const gx_path *)),
  69.         gx_path_is_void(P1(const gx_path *)),
  70.         gx_path_is_rectangle(P2(const gx_path *, gs_fixed_rect *));
  71. /* Inline versions of the above */
  72. #define gx_path_is_void_inline(ppath) ((ppath)->first_subpath == 0)
  73. #define gx_path_has_curves_inline(ppath) ((ppath)->curve_count != 0)
  74.  
  75. /* Path transformers */
  76.  
  77. extern    int    gx_path_copy(P3(const gx_path * /*old*/, gx_path * /*new*/, int /*init*/)),
  78.         gx_path_flatten(P4(const gx_path * /*old*/, gx_path * /*new*/, floatp, int)),
  79.         gx_path_copy_reversed(P3(const gx_path * /*old*/, gx_path * /*new*/, int /*init*/)),
  80.         gx_path_translate(P3(gx_path *, fixed, fixed));
  81.  
  82. /* ------ Clipping paths ------ */
  83.  
  84. /* Opaque type for a path */
  85. typedef struct gx_clip_path_s gx_clip_path;
  86. extern const uint gs_clip_path_sizeof;
  87.  
  88. extern    int    gx_clip_to_rectangle(P2(gs_state *, gs_fixed_rect *)),
  89.         gx_clip_to_path(P1(gs_state *)),
  90.         gx_cpath_from_rectangle(P3(gx_clip_path *, gs_fixed_rect *, const gs_memory_procs *)),
  91.         gx_cpath_intersect(P4(gs_state *, gx_clip_path *, gx_path *, int));
  92. extern    void    gx_cpath_release(P1(gx_clip_path *)),
  93.         gx_cpath_share(P1(gx_clip_path *));
  94. extern    int    gx_cpath_path(P2(gx_clip_path *, gx_path *)),
  95.         gx_cpath_box_for_check(P2(const gx_clip_path *, gs_fixed_rect *)),
  96.         gx_cpath_includes_rectangle(P5(const gx_clip_path *, fixed, fixed, fixed, fixed));
  97.  
  98. /* Opaque type for a clip list. */
  99. typedef struct gx_clip_list_s gx_clip_list;
  100.  
  101. /* Initialize a clip list. */
  102. extern    void    gx_clip_list_init(P1(gx_clip_list *));
  103. /* Initialize a clip list to a rectangle. */
  104. extern    void    gx_clip_list_from_rectangle(P2(gx_clip_list *, gs_fixed_rect *));
  105. /* Add a clip list to a path. */
  106. extern    int    gx_clip_list_add_to_path(P2(gx_clip_list *, gx_path *));
  107. /* Free a clip list. */
  108. extern    void    gx_clip_list_free(P2(gx_clip_list *, const gs_memory_procs *));
  109.