gsdevice.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /* Copyright (C) 1994, 2000 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: gsdevice.h,v 1.6 2002/06/16 08:45:42 lpd Exp $ */
  14. /* Device and page control API */
  15. #ifndef gsdevice_INCLUDED
  16. # define gsdevice_INCLUDED
  17. #ifndef gx_device_DEFINED
  18. # define gx_device_DEFINED
  19. typedef struct gx_device_s gx_device;
  20. #endif
  21. #ifndef gx_device_memory_DEFINED
  22. # define gx_device_memory_DEFINED
  23. typedef struct gx_device_memory_s gx_device_memory;
  24. #endif
  25. #ifndef gs_matrix_DEFINED
  26. # define gs_matrix_DEFINED
  27. typedef struct gs_matrix_s gs_matrix;
  28. #endif
  29. #ifndef gs_param_list_DEFINED
  30. # define gs_param_list_DEFINED
  31. typedef struct gs_param_list_s gs_param_list;
  32. #endif
  33. /* Device procedures not involving a graphics state. */
  34. int gs_opendevice(gx_device *);
  35. int gs_copyscanlines(gx_device *, int, byte *, uint, int *, uint *);
  36. const gx_device *gs_getdevice(int);
  37. int gs_copydevice(gx_device **, const gx_device *, gs_memory_t *);
  38. /*
  39. * If keep_open is true and dev->is_open is true, the copy *may* have
  40. * is_open = true; otherwise, the copy will have is_open = false.
  41. * copydevice is equivalent to copydevice2 with keep_open = false.
  42. */
  43. int gs_copydevice2(gx_device **pnew_dev, const gx_device *dev,
  44. bool keep_open, gs_memory_t *mem);
  45. #define gs_makeimagedevice(pdev, pmat, w, h, colors, colors_size, mem)\
  46. gs_makewordimagedevice(pdev, pmat, w, h, colors, colors_size, false, true, mem)
  47. int gs_makewordimagedevice(gx_device ** pnew_dev, const gs_matrix * pmat,
  48. uint width, uint height,
  49. const byte * colors, int num_colors,
  50. bool word_oriented, bool page_device,
  51. gs_memory_t * mem);
  52. #define gs_initialize_imagedevice(mdev, pmat, w, h, colors, colors_size, mem)\
  53. gs_initialize_wordimagedevice(mdev, pmat, w, h, colors, color_size, false, true, mem)
  54. int gs_initialize_wordimagedevice(gx_device_memory * new_dev,
  55. const gs_matrix * pmat,
  56. uint width, uint height,
  57. const byte * colors, int colors_size,
  58. bool word_oriented, bool page_device,
  59. gs_memory_t * mem);
  60. const char *gs_devicename(const gx_device *);
  61. void gs_deviceinitialmatrix(gx_device *, gs_matrix *);
  62. /* VMS limits identifiers to 31 characters. */
  63. int gs_get_device_or_hw_params(gx_device *, gs_param_list *, bool);
  64. #define gs_getdeviceparams(dev, plist)\
  65. gs_get_device_or_hw_params(dev, plist, false)
  66. #define gs_gethardwareparams(dev, plist)\
  67. gs_get_device_or_hw_params(dev, plist, true)
  68. /* BACKWARD COMPATIBILITY */
  69. #define gs_get_device_or_hardware_params gs_get_device_or_hw_params
  70. int gs_putdeviceparams(gx_device *, gs_param_list *);
  71. int gs_closedevice(gx_device *);
  72. /* Device procedures involving an imager state. */
  73. #ifndef gs_imager_state_DEFINED
  74. # define gs_imager_state_DEFINED
  75. typedef struct gs_imager_state_s gs_imager_state;
  76. #endif
  77. int gs_imager_putdeviceparams(gs_imager_state *pis, gx_device *dev,
  78. gs_param_list *plist);
  79. /* Device procedures involving a graphics state. */
  80. #ifndef gs_state_DEFINED
  81. # define gs_state_DEFINED
  82. typedef struct gs_state_s gs_state;
  83. #endif
  84. int gs_flushpage(gs_state *);
  85. int gs_copypage(gs_state *);
  86. int gs_output_page(gs_state *, int, int);
  87. int gs_nulldevice(gs_state *);
  88. int gs_setdevice(gs_state *, gx_device *);
  89. int gs_setdevice_no_erase(gs_state *, gx_device *); /* returns 1 */
  90. /* if erasepage required */
  91. int gs_setdevice_no_init(gs_state *, gx_device *);
  92. gx_device *gs_currentdevice(const gs_state *);
  93. /* gzstate.h redefines the following: */
  94. #ifndef gs_currentdevice_inline
  95. # define gs_currentdevice_inline(pgs) gs_currentdevice(pgs)
  96. #endif
  97. int gs_state_putdeviceparams(gs_state *pgs, gs_param_list *plist);
  98. #endif /* gsdevice_INCLUDED */