1 /* Copyright (C) 1994, 2000 Aladdin Enterprises. All rights reserved. 2 3 This software is provided AS-IS with no warranty, either express or 4 implied. 5 6 This software is distributed under license and may not be copied, 7 modified or distributed except as expressly authorized under the terms 8 of the license contained in the file LICENSE in this distribution. 9 10 For more information about licensing, please refer to 11 http://www.ghostscript.com/licensing/. For information on 12 commercial licensing, go to http://www.artifex.com/licensing/ or 13 contact Artifex Software, Inc., 101 Lucas Valley Road #110, 14 San Rafael, CA 94903, U.S.A., +1(415)492-9861. 15 */ 16 17 /* $Id: gsdevice.h,v 1.6 2002/06/16 08:45:42 lpd Exp $ */ 18 /* Device and page control API */ 19 20 #ifndef gsdevice_INCLUDED 21 # define gsdevice_INCLUDED 22 23 #ifndef gx_device_DEFINED 24 # define gx_device_DEFINED 25 typedef struct gx_device_s gx_device; 26 #endif 27 28 #ifndef gx_device_memory_DEFINED 29 # define gx_device_memory_DEFINED 30 typedef struct gx_device_memory_s gx_device_memory; 31 #endif 32 33 #ifndef gs_matrix_DEFINED 34 # define gs_matrix_DEFINED 35 typedef struct gs_matrix_s gs_matrix; 36 #endif 37 38 #ifndef gs_param_list_DEFINED 39 # define gs_param_list_DEFINED 40 typedef struct gs_param_list_s gs_param_list; 41 #endif 42 43 /* Device procedures not involving a graphics state. */ 44 45 int gs_opendevice(gx_device *); 46 int gs_copyscanlines(gx_device *, int, byte *, uint, int *, uint *); 47 const gx_device *gs_getdevice(int); 48 int gs_copydevice(gx_device **, const gx_device *, gs_memory_t *); 49 /* 50 * If keep_open is true and dev->is_open is true, the copy *may* have 51 * is_open = true; otherwise, the copy will have is_open = false. 52 * copydevice is equivalent to copydevice2 with keep_open = false. 53 */ 54 int gs_copydevice2(gx_device **pnew_dev, const gx_device *dev, 55 bool keep_open, gs_memory_t *mem); 56 57 #define gs_makeimagedevice(pdev, pmat, w, h, colors, colors_size, mem)\ 58 gs_makewordimagedevice(pdev, pmat, w, h, colors, colors_size, false, true, mem) 59 int gs_makewordimagedevice(gx_device ** pnew_dev, const gs_matrix * pmat, 60 uint width, uint height, 61 const byte * colors, int num_colors, 62 bool word_oriented, bool page_device, 63 gs_memory_t * mem); 64 65 #define gs_initialize_imagedevice(mdev, pmat, w, h, colors, colors_size, mem)\ 66 gs_initialize_wordimagedevice(mdev, pmat, w, h, colors, color_size, false, true, mem) 67 int gs_initialize_wordimagedevice(gx_device_memory * new_dev, 68 const gs_matrix * pmat, 69 uint width, uint height, 70 const byte * colors, int colors_size, 71 bool word_oriented, bool page_device, 72 gs_memory_t * mem); 73 const char *gs_devicename(const gx_device *); 74 void gs_deviceinitialmatrix(gx_device *, gs_matrix *); 75 76 /* VMS limits identifiers to 31 characters. */ 77 int gs_get_device_or_hw_params(gx_device *, gs_param_list *, bool); 78 #define gs_getdeviceparams(dev, plist)\ 79 gs_get_device_or_hw_params(dev, plist, false) 80 #define gs_gethardwareparams(dev, plist)\ 81 gs_get_device_or_hw_params(dev, plist, true) 82 /* BACKWARD COMPATIBILITY */ 83 #define gs_get_device_or_hardware_params gs_get_device_or_hw_params 84 85 int gs_putdeviceparams(gx_device *, gs_param_list *); 86 int gs_closedevice(gx_device *); 87 88 /* Device procedures involving an imager state. */ 89 90 #ifndef gs_imager_state_DEFINED 91 # define gs_imager_state_DEFINED 92 typedef struct gs_imager_state_s gs_imager_state; 93 #endif 94 95 int gs_imager_putdeviceparams(gs_imager_state *pis, gx_device *dev, 96 gs_param_list *plist); 97 98 /* Device procedures involving a graphics state. */ 99 100 #ifndef gs_state_DEFINED 101 # define gs_state_DEFINED 102 typedef struct gs_state_s gs_state; 103 #endif 104 105 int gs_flushpage(gs_state *); 106 int gs_copypage(gs_state *); 107 int gs_output_page(gs_state *, int, int); 108 int gs_nulldevice(gs_state *); 109 int gs_setdevice(gs_state *, gx_device *); 110 int gs_setdevice_no_erase(gs_state *, gx_device *); /* returns 1 */ 111 /* if erasepage required */ 112 int gs_setdevice_no_init(gs_state *, gx_device *); 113 gx_device *gs_currentdevice(const gs_state *); 114 115 /* gzstate.h redefines the following: */ 116 #ifndef gs_currentdevice_inline 117 # define gs_currentdevice_inline(pgs) gs_currentdevice(pgs) 118 #endif 119 120 int gs_state_putdeviceparams(gs_state *pgs, gs_param_list *plist); 121 122 #endif /* gsdevice_INCLUDED */ 123