1 /* Copyright (C) 1997, 1998 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: gxgetbit.h,v 1.5 2002/06/16 08:45:43 lpd Exp $ */ 18 /* Interface for get_bits_rectangle driver procedure */ 19 20 #ifndef gxgetbit_INCLUDED 21 # define gxgetbit_INCLUDED 22 23 #include "gxbitfmt.h" 24 25 /* The parameter record typedef is also in gxdevcli.h. */ 26 #ifndef gs_get_bits_params_DEFINED 27 # define gs_get_bits_params_DEFINED 28 typedef struct gs_get_bits_params_s gs_get_bits_params_t; 29 #endif 30 31 /* 32 * We define the options for get_bits_rectangle here in a separate file 33 * so that the great majority of driver implementors and clients, which 34 * don't care about the details, don't need to be recompiled if the set 35 * of options changes. 36 */ 37 typedef gx_bitmap_format_t gs_get_bits_options_t; 38 39 /* 40 * Define the parameter record passed to get_bits_rectangle. 41 * get_bits_rectangle may update members of this structure if 42 * the options allow it to choose their values, and always updates options 43 * to indicate what options were actually used (1 option per group). 44 */ 45 struct gs_get_bits_params_s { 46 gs_get_bits_options_t options; 47 byte *data[32]; 48 int x_offset; /* in returned data */ 49 uint raster; 50 }; 51 52 /* 53 * gx_bitmap_format_t defines the options passed to get_bits_rectangle, 54 * which indicate which formats are acceptable for the returned data. If 55 * successful, get_bits_rectangle sets the options member of the parameter 56 * record to indicate what options were chosen -- 1 per group, and never the 57 * _ANY option. Note that the chosen option is not necessarily one that 58 * appeared in the original options: for example, if GB_RASTER_ANY is the 59 * only raster option originally set, the chosen option will be 60 * GB_RASTER_STANDARD or GB_RASTER_SPECIFIED. 61 * 62 * If the options mask is 0, get_bits_rectangle must set it to the 63 * complete set of supported options and return an error. This allows 64 * clients to determine what options are supported without actually doing 65 * a transfer. 66 * 67 * All devices must support at least one option in each group, and must 68 * support GB_COLORS_NATIVE. 69 * 70 * NOTE: the current default implementation supports only the following 71 * options in their respective groups (i.e., any other options must be 72 * supported directly by the device): 73 * GB_DEPTH_8 74 * GB_PACKING_CHUNKY 75 * GB_RETURN_COPY 76 * The current default implementation also requires that all devices 77 * support GB_PACKING_CHUNKY. */ 78 79 /* ---------------- Procedures ---------------- */ 80 81 /* Try to implement get_bits_rectangle by returning a pointer. */ 82 int gx_get_bits_return_pointer(gx_device * dev, int x, int h, 83 gs_get_bits_params_t * params, 84 const gs_get_bits_params_t *stored, 85 byte * stored_base); 86 87 /* Implement get_bits_rectangle by copying. */ 88 int gx_get_bits_copy(gx_device * dev, int x, int w, int h, 89 gs_get_bits_params_t * params, 90 const gs_get_bits_params_t *stored, 91 const byte * src_base, uint dev_raster); 92 93 #endif /* gxgetbit_INCLUDED */ 94