1 /* Copyright (C) 2001-2012 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, 8 modified or distributed except as expressly authorized under the terms 9 of the license contained in the file LICENSE in this distribution. 10 11 Refer to licensing information at http://www.artifex.com or contact 12 Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael, 13 CA 94903, U.S.A., +1(415)492-9861, for further information. 14 */ 15 16 17 /* Interface to [de-]serialization for (traditional) halftones */ 18 19 #ifndef gxdhtserial_INCLUDED 20 # define gxdhtserial_INCLUDED 21 22 #ifndef gs_memory_DEFINED 23 # define gs_memory_DEFINED 24 typedef struct gs_memory_s gs_memory_t; 25 #endif 26 27 #ifndef gx_device_DEFINED 28 # define gx_device_DEFINED 29 typedef struct gx_device_s gx_device; 30 #endif 31 32 #ifndef gx_device_halftone_DEFINED 33 # define gx_device_halftone_DEFINED 34 typedef struct gx_device_halftone_s gx_device_halftone; 35 #endif 36 37 #ifndef gs_imager_state_DEFINED 38 # define gs_imager_state_DEFINED 39 typedef struct gs_imager_state_s gs_imager_state; 40 #endif 41 42 /* 43 * Serialize a halftone. 44 * 45 * Returns: 46 * 47 * 0, with *psize set the the amount of space required, if successful 48 * 49 * gs_error_rangecheck, with *psize set to the size required, if the 50 * original *psize was not large enough 51 * 52 * some other error code, with *psize unchange, in the event of an 53 * error other than lack of space 54 */ 55 extern int gx_ht_write( const gx_device_halftone * pdht, 56 const gx_device * dev, 57 byte * data, 58 uint * psize ); 59 60 /* 61 * Reconstruct a halftone from its serial representation, and install it 62 * as the current halftone. The buffer provided is expected to be large 63 * enough to hold the entire halftone. 64 * 65 * The reading and installation phases are combined in this routine so as 66 * to avoid unnecessarily allocating a device halftone and its component 67 * array, just to release them immediately after installation is complete. 68 * There is also not much reason to reconstuct a halftone except to make 69 * it the current halftone. 70 * 71 * Returns the number of bytes read, or < 0 in the event of an error. 72 */ 73 extern int gx_ht_read_and_install( gs_imager_state * pis, 74 const gx_device * dev, 75 const byte * data, 76 uint size, 77 gs_memory_t * mem ); 78 79 #endif /* gxdhtserail_INCLUDED */ 80