gxcomp.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* Copyright (C) 1997 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: gxcomp.h,v 1.2 2000/09/19 19:00:35 lpd Exp $ */
  16. /* Definitions for implementing compositing functions */
  17. #ifndef gxcomp_INCLUDED
  18. # define gxcomp_INCLUDED
  19. #include "gscompt.h"
  20. #include "gsrefct.h"
  21. #include "gxbitfmt.h"
  22. /*
  23. * Define the abstract superclass for all compositing function types.
  24. */
  25. /*typedef struct gs_composite_s gs_composite_t; *//* in gscompt.h */
  26. #ifndef gs_imager_state_DEFINED
  27. # define gs_imager_state_DEFINED
  28. typedef struct gs_imager_state_s gs_imager_state;
  29. #endif
  30. #ifndef gx_device_DEFINED
  31. # define gx_device_DEFINED
  32. typedef struct gx_device_s gx_device;
  33. #endif
  34. typedef struct gs_composite_type_procs_s {
  35. /*
  36. * Create the default compositor for a compositing function.
  37. */
  38. #define composite_create_default_compositor_proc(proc)\
  39. int proc(P5(const gs_composite_t *pcte, gx_device **pcdev,\
  40. gx_device *dev, const gs_imager_state *pis, gs_memory_t *mem))
  41. composite_create_default_compositor_proc((*create_default_compositor));
  42. /*
  43. * Test whether this function is equal to another one.
  44. */
  45. #define composite_equal_proc(proc)\
  46. bool proc(P2(const gs_composite_t *pcte, const gs_composite_t *pcte2))
  47. composite_equal_proc((*equal));
  48. /*
  49. * Convert the representation of this function to a string
  50. * for writing in a command list. *psize is the amount of space
  51. * available. If it is large enough, the procedure sets *psize
  52. * to the amount used and returns 0; if it is not large enough,
  53. * the procedure sets *psize to the amount needed and returns a
  54. * rangecheck error; in the case of any other error, *psize is
  55. * not changed.
  56. */
  57. #define composite_write_proc(proc)\
  58. int proc(P3(const gs_composite_t *pcte, byte *data, uint *psize))
  59. composite_write_proc((*write));
  60. /*
  61. * Convert the string representation of a function back to
  62. * a structure, allocating the structure.
  63. */
  64. #define composite_read_proc(proc)\
  65. int proc(P4(gs_composite_t **ppcte, const byte *data, uint size,\
  66. gs_memory_t *mem))
  67. composite_read_proc((*read));
  68. } gs_composite_type_procs_t;
  69. typedef struct gs_composite_type_s {
  70. gs_composite_type_procs_t procs;
  71. } gs_composite_type_t;
  72. /*
  73. * Compositing objects are reference-counted, because graphics states will
  74. * eventually reference them. Note that the common part has no
  75. * garbage-collectible pointers and is never actually instantiated, so no
  76. * structure type is needed for it.
  77. */
  78. #define gs_composite_common\
  79. const gs_composite_type_t *type;\
  80. gs_id id; /* see gscompt.h */\
  81. rc_header rc
  82. struct gs_composite_s {
  83. gs_composite_common;
  84. };
  85. /* Replace a procedure with a macro. */
  86. #define gs_composite_id(pcte) ((pcte)->id)
  87. #endif /* gxcomp_INCLUDED */