1 /* Copyright (C) 2001-2006 Artifex Software, Inc. 2 All Rights Reserved. 3 4 This software is provided AS-IS with no warranty, either express or 5 implied. 6 7 This software is distributed under license and may not be copied, modified 8 or distributed except as expressly authorized under the terms of that 9 license. Refer to licensing information at http://www.artifex.com/ 10 or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, 11 San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. 12 */ 13 14 /* $Id: gxgetbit.h 8022 2007-06-05 22:23:38Z giles $ */ 15 /* Interface for get_bits_rectangle driver procedure */ 16 17 #ifndef gxgetbit_INCLUDED 18 # define gxgetbit_INCLUDED 19 20 #include "gxbitfmt.h" 21 22 /* The parameter record typedef is also in gxdevcli.h. */ 23 #ifndef gs_get_bits_params_DEFINED 24 # define gs_get_bits_params_DEFINED 25 typedef struct gs_get_bits_params_s gs_get_bits_params_t; 26 #endif 27 28 /* 29 * We define the options for get_bits_rectangle here in a separate file 30 * so that the great majority of driver implementors and clients, which 31 * don't care about the details, don't need to be recompiled if the set 32 * of options changes. 33 */ 34 typedef gx_bitmap_format_t gs_get_bits_options_t; 35 36 /* 37 * Define the parameter record passed to get_bits_rectangle. 38 * get_bits_rectangle may update members of this structure if 39 * the options allow it to choose their values, and always updates options 40 * to indicate what options were actually used (1 option per group). 41 */ 42 struct gs_get_bits_params_s { 43 gs_get_bits_options_t options; 44 byte *data[32]; 45 int x_offset; /* in returned data */ 46 int original_y; 47 uint raster; 48 }; 49 50 /* 51 * gx_bitmap_format_t defines the options passed to get_bits_rectangle, 52 * which indicate which formats are acceptable for the returned data. If 53 * successful, get_bits_rectangle sets the options member of the parameter 54 * record to indicate what options were chosen -- 1 per group, and never the 55 * _ANY option. Note that the chosen option is not necessarily one that 56 * appeared in the original options: for example, if GB_RASTER_ANY is the 57 * only raster option originally set, the chosen option will be 58 * GB_RASTER_STANDARD or GB_RASTER_SPECIFIED. 59 * 60 * If the options mask is 0, get_bits_rectangle must set it to the 61 * complete set of supported options and return an error. This allows 62 * clients to determine what options are supported without actually doing 63 * a transfer. 64 * 65 * All devices must support at least one option in each group, and must 66 * support GB_COLORS_NATIVE. 67 * 68 * NOTE: the current default implementation supports only the following 69 * options in their respective groups (i.e., any other options must be 70 * supported directly by the device): 71 * GB_DEPTH_8 72 * GB_PACKING_CHUNKY 73 * GB_RETURN_COPY 74 * The current default implementation also requires that all devices 75 * support GB_PACKING_CHUNKY. */ 76 77 /* ---------------- Procedures ---------------- */ 78 79 /* Try to implement get_bits_rectangle by returning a pointer. */ 80 int gx_get_bits_return_pointer(gx_device * dev, int x, int h, 81 gs_get_bits_params_t * params, 82 const gs_get_bits_params_t *stored, 83 byte * stored_base); 84 85 /* Implement get_bits_rectangle by copying. */ 86 int gx_get_bits_copy(gx_device * dev, int x, int w, int h, 87 gs_get_bits_params_t * params, 88 const gs_get_bits_params_t *stored, 89 const byte * src_base, uint dev_raster); 90 91 #endif /* gxgetbit_INCLUDED */ 92