1 /* Copyright (C) 2002 artofcode LLC. 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: gxdhtserial.h,v 1.2 2002/08/26 23:00:07 dan Exp $ */ 18 /* Interface to [de-]serialization for (traditional) halftones */ 19 20 #ifndef gxdhtserial_INCLUDED 21 # define gxdhtserial_INCLUDED 22 23 #ifndef gs_memory_DEFINED 24 # define gs_memory_DEFINED 25 typedef struct gs_memory_s gs_memory_t; 26 #endif 27 28 #ifndef gx_device_DEFINED 29 # define gx_device_DEFINED 30 typedef struct gx_device_s gx_device; 31 #endif 32 33 #ifndef gx_device_halftone_DEFINED 34 # define gx_device_halftone_DEFINED 35 typedef struct gx_device_halftone_s gx_device_halftone; 36 #endif 37 38 #ifndef gs_imager_state_DEFINED 39 # define gs_imager_state_DEFINED 40 typedef struct gs_imager_state_s gs_imager_state; 41 #endif 42 43 44 /* 45 * Serialize a halftone. 46 * 47 * Returns: 48 * 49 * 0, with *psize set the the amount of space required, if successful 50 * 51 * gs_error_rangecheck, with *psize set to the size required, if the 52 * original *psize was not large enough 53 * 54 * some other error code, with *psize unchange, in the event of an 55 * error other than lack of space 56 */ 57 extern int gx_ht_write( const gx_device_halftone * pdht, 58 const gx_device * dev, 59 byte * data, 60 uint * psize ); 61 62 /* 63 * Reconstruct a halftone from its serial representation, and install it 64 * as the current halftone. The buffer provided is expected to be large 65 * enough to hold the entire halftone. 66 * 67 * The reading and installation phases are combined in this routine so as 68 * to avoid unnecessarily allocating a device halftone and its component 69 * array, just to release them immediately after installation is complete. 70 * There is also not much reason to reconstuct a halftone except to make 71 * it the current halftone. 72 * 73 * Returns the number of bytes read, or < 0 in the event of an error. 74 */ 75 extern int gx_ht_read_and_install( gs_imager_state * pis, 76 const gx_device * dev, 77 const byte * data, 78 uint size, 79 gs_memory_t * mem ); 80 81 #endif /* gxdhtserail_INCLUDED */ 82