gxdhtserial.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* Copyright (C) 2002 artofcode LLC. All rights reserved.
  2. This software is provided AS-IS with no warranty, either express or
  3. implied.
  4. This software is distributed under license and may not be copied,
  5. modified or distributed except as expressly authorized under the terms
  6. of the license contained in the file LICENSE in this distribution.
  7. For more information about licensing, please refer to
  8. http://www.ghostscript.com/licensing/. For information on
  9. commercial licensing, go to http://www.artifex.com/licensing/ or
  10. contact Artifex Software, Inc., 101 Lucas Valley Road #110,
  11. San Rafael, CA 94903, U.S.A., +1(415)492-9861.
  12. */
  13. /* $Id: gxdhtserial.h,v 1.2 2002/08/26 23:00:07 dan Exp $ */
  14. /* Interface to [de-]serialization for (traditional) halftones */
  15. #ifndef gxdhtserial_INCLUDED
  16. # define gxdhtserial_INCLUDED
  17. #ifndef gs_memory_DEFINED
  18. # define gs_memory_DEFINED
  19. typedef struct gs_memory_s gs_memory_t;
  20. #endif
  21. #ifndef gx_device_DEFINED
  22. # define gx_device_DEFINED
  23. typedef struct gx_device_s gx_device;
  24. #endif
  25. #ifndef gx_device_halftone_DEFINED
  26. # define gx_device_halftone_DEFINED
  27. typedef struct gx_device_halftone_s gx_device_halftone;
  28. #endif
  29. #ifndef gs_imager_state_DEFINED
  30. # define gs_imager_state_DEFINED
  31. typedef struct gs_imager_state_s gs_imager_state;
  32. #endif
  33. /*
  34. * Serialize a halftone.
  35. *
  36. * Returns:
  37. *
  38. * 0, with *psize set the the amount of space required, if successful
  39. *
  40. * gs_error_rangecheck, with *psize set to the size required, if the
  41. * original *psize was not large enough
  42. *
  43. * some other error code, with *psize unchange, in the event of an
  44. * error other than lack of space
  45. */
  46. extern int gx_ht_write( const gx_device_halftone * pdht,
  47. const gx_device * dev,
  48. byte * data,
  49. uint * psize );
  50. /*
  51. * Reconstruct a halftone from its serial representation, and install it
  52. * as the current halftone. The buffer provided is expected to be large
  53. * enough to hold the entire halftone.
  54. *
  55. * The reading and installation phases are combined in this routine so as
  56. * to avoid unnecessarily allocating a device halftone and its component
  57. * array, just to release them immediately after installation is complete.
  58. * There is also not much reason to reconstuct a halftone except to make
  59. * it the current halftone.
  60. *
  61. * Returns the number of bytes read, or < 0 in the event of an error.
  62. */
  63. extern int gx_ht_read_and_install( gs_imager_state * pis,
  64. const gx_device * dev,
  65. const byte * data,
  66. uint size,
  67. gs_memory_t * mem );
  68. #endif /* gxdhtserail_INCLUDED */