home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 February / PCWK0296.iso / sharewar / dos / program / gs300sr1 / gs300sr1.exe / GXPATH.H < prev    next >
C/C++ Source or Header  |  1994-07-27  |  4KB  |  98 lines

  1. /* Copyright (C) 1989, 1992, 1993, 1994 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of Aladdin Ghostscript.
  4.   
  5.   Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  6.   or distributor accepts any responsibility for the consequences of using it,
  7.   or for whether it serves any particular purpose or works at all, unless he
  8.   or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  9.   License (the "License") for full details.
  10.   
  11.   Every copy of Aladdin Ghostscript must include a copy of the License,
  12.   normally in a plain ASCII text file named PUBLIC.  The License grants you
  13.   the right to copy, modify and redistribute Aladdin Ghostscript, but only
  14.   under certain conditions described in the License.  Among other things, the
  15.   License requires that the copyright notice and this notice be preserved on
  16.   all copies.
  17. */
  18.  
  19. /* gxpath.h */
  20. /* Lower-level path routines for Ghostscript library */
  21. /* Requires gxfixed.h */
  22. #include "gspath.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.  
  31. /* Define the two insideness rules */
  32. #define gx_rule_winding_number (-1)
  33. #define gx_rule_even_odd 1
  34.  
  35. /* Debugging routines */
  36. #ifdef DEBUG
  37. void gx_dump_path(P2(const gx_path *, const char *));
  38. void gx_path_print(P1(const gx_path *));
  39. #endif
  40.  
  41. /* Path constructors. */
  42. void    gx_path_init(P2(gx_path *, gs_memory_t *)),
  43.     gx_path_reset(P1(gx_path *)),
  44.     gx_path_release(P1(gx_path *)),
  45.     gx_path_share(P1(gx_path *));
  46. int    gx_path_add_point(P3(gx_path *, fixed, fixed)),
  47.     gx_path_add_relative_point(P3(gx_path *, fixed, fixed)),
  48.     gx_path_add_line(P3(gx_path *, fixed, fixed)),
  49.     gx_path_add_rectangle(P5(gx_path *, fixed, fixed, fixed, fixed)),
  50.     gx_path_add_pgram(P7(gx_path *, fixed, fixed, fixed, fixed, fixed, fixed)),
  51.     gx_path_add_curve(P7(gx_path *, fixed, fixed, fixed, fixed, fixed, fixed)),
  52.     gx_path_add_flattened_curve(P8(gx_path *, fixed, fixed, fixed, fixed, fixed, fixed, floatp)),
  53.     gx_path_add_arc(P8(gx_path *, fixed, fixed, fixed, fixed, fixed, fixed, floatp)),
  54.     gx_path_add_path(P2(gx_path *, gx_path *)),
  55.     gx_path_close_subpath(P1(gx_path *));
  56. /* The last argument to gx_path_add_arc is a fraction for computing */
  57. /* the curve parameters.  Here is the correct value for quarter-circles. */
  58. /* (stroke uses this to draw round caps and joins.) */
  59. #define quarter_arc_fraction 0.552285
  60.  
  61. /* Path accessors */
  62.  
  63. int    gx_path_current_point(P2(const gx_path *, gs_fixed_point *)),
  64.     gx_path_bbox(P2(gx_path *, gs_fixed_rect *)),
  65.     gx_path_has_curves(P1(const gx_path *)),
  66.     gx_path_is_void(P1(const gx_path *)),
  67.     gx_path_is_rectangle(P2(const gx_path *, gs_fixed_rect *));
  68. /* Inline versions of the above */
  69. #define gx_path_is_void_inline(ppath) ((ppath)->first_subpath == 0)
  70. #define gx_path_has_curves_inline(ppath) ((ppath)->curve_count != 0)
  71.  
  72. /* Path transformers */
  73.  
  74. int    gx_path_copy(P3(const gx_path *    /*old*/, gx_path * /*new*/, bool /*init*/)),
  75.     gx_path_flatten(P4(const gx_path * /*old*/, gx_path * /*new*/, floatp, bool /*in_BuildCharGlyph*/)),
  76.     gx_path_expand_dashes(P3(const gx_path * /*old*/, gx_path * /*new*/, gs_state *)),
  77.     gx_path_copy_reversed(P3(const gx_path * /*old*/, gx_path * /*new*/, bool /*init*/)),
  78.     gx_path_translate(P3(gx_path *, fixed, fixed));
  79.  
  80. /* ------ Clipping paths ------ */
  81.  
  82. /* Opaque type for a path */
  83. typedef struct gx_clip_path_s gx_clip_path;
  84.  
  85. int    gx_clip_to_rectangle(P2(gs_state *, gs_fixed_rect *)),
  86.     gx_clip_to_path(P1(gs_state *)),
  87.     gx_cpath_init(P2(gx_clip_path *, gs_memory_t *)),
  88.     gx_cpath_from_rectangle(P3(gx_clip_path *, gs_fixed_rect *, gs_memory_t *)),
  89.     gx_cpath_intersect(P4(gs_state *, gx_clip_path *, gx_path *, int));
  90. void    gx_cpath_release(P1(gx_clip_path *)),
  91.     gx_cpath_share(P1(gx_clip_path *));
  92. int    gx_cpath_path(P2(gx_clip_path *, gx_path *)),
  93.     gx_cpath_box_for_check(P2(const gx_clip_path *, gs_fixed_rect *)),
  94.     gx_cpath_includes_rectangle(P5(const gx_clip_path *, fixed, fixed, fixed, fixed));
  95.  
  96. /* Opaque type for a clip list. */
  97. typedef struct gx_clip_list_s gx_clip_list;
  98.