gxstate.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* Copyright (C) 1996 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: gxstate.h,v 1.11 2004/08/31 13:23:16 igor Exp $ */
  14. /* Internal graphics state API */
  15. #ifndef gxstate_INCLUDED
  16. # define gxstate_INCLUDED
  17. /* Opaque type for a graphics state */
  18. #ifndef gs_state_DEFINED
  19. # define gs_state_DEFINED
  20. typedef struct gs_state_s gs_state;
  21. #endif
  22. #include "gscspace.h"
  23. /*
  24. * The interfaces in this file are for internal use only, primarily by the
  25. * interpreter. They are not guaranteed to remain stable from one release
  26. * to another.
  27. */
  28. /* Memory and save/restore management */
  29. gs_memory_t *gs_state_memory(const gs_state *);
  30. gs_state *gs_state_saved(const gs_state *);
  31. gs_state *gs_state_swap_saved(gs_state *, gs_state *);
  32. gs_memory_t *gs_state_swap_memory(gs_state *, gs_memory_t *);
  33. /*
  34. * "Client data" interface for graphics states.
  35. *
  36. * As of release 4.36, the copy procedure is superseded by copy_for
  37. * (although it will still be called if there is no copy_for procedure).
  38. */
  39. typedef void *(*gs_state_alloc_proc_t) (gs_memory_t * mem);
  40. typedef int (*gs_state_copy_proc_t) (void *to, const void *from);
  41. typedef void (*gs_state_free_proc_t) (void *old, gs_memory_t * mem);
  42. typedef enum {
  43. copy_for_gsave, /* from = current, to = new(saved) */
  44. copy_for_grestore, /* from = saved, to = current */
  45. copy_for_gstate, /* from = current, to = new(copy) */
  46. copy_for_setgstate, /* from = stored, to = current */
  47. copy_for_copygstate, /* from & to are specified explicitly */
  48. copy_for_currentgstate /* from = current, to = stored */
  49. } gs_state_copy_reason_t;
  50. /* Note that the 'from' argument of copy_for is not const. */
  51. /* This is deliberate -- some clients need this. */
  52. typedef int (*gs_state_copy_for_proc_t) (void *to, void *from,
  53. gs_state_copy_reason_t reason);
  54. typedef struct gs_state_client_procs_s {
  55. gs_state_alloc_proc_t alloc;
  56. gs_state_copy_proc_t copy;
  57. gs_state_free_proc_t free;
  58. gs_state_copy_for_proc_t copy_for;
  59. } gs_state_client_procs;
  60. void gs_state_set_client(gs_state *, void *, const gs_state_client_procs *,
  61. bool client_has_pattern_streams);
  62. /* gzstate.h redefines the following: */
  63. #ifndef gs_state_client_data
  64. void *gs_state_client_data(const gs_state *);
  65. #endif
  66. /* Accessories. */
  67. gs_id gx_get_clip_path_id(gs_state *);
  68. #endif /* gxstate_INCLUDED */