gxiclass.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
  2. This file is part of AFPL Ghostscript.
  3. AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author or
  4. distributor accepts any responsibility for the consequences of using it, or
  5. for whether it serves any particular purpose or works at all, unless he or
  6. she says so in writing. Refer to the Aladdin Free Public License (the
  7. "License") for full details.
  8. Every copy of AFPL Ghostscript must include a copy of the License, normally
  9. in a plain ASCII text file named PUBLIC. The License grants you the right
  10. to copy, modify and redistribute AFPL Ghostscript, but only under certain
  11. conditions described in the License. Among other things, the License
  12. requires that the copyright notice and this notice be preserved on all
  13. copies.
  14. */
  15. /*$Id: gxiclass.h,v 1.2 2000/09/19 19:00:37 lpd Exp $ */
  16. /* Define image rendering algorithm classes */
  17. #ifndef gxiclass_INCLUDED
  18. # define gxiclass_INCLUDED
  19. /* Define the abstract type for the image enumerator state. */
  20. typedef struct gx_image_enum_s gx_image_enum;
  21. #ifndef gx_device_DEFINED
  22. # define gx_device_DEFINED
  23. typedef struct gx_device_s gx_device;
  24. #endif
  25. /*
  26. * Define the interface for routines used to render a (source) scan line.
  27. * If the buffer is the original client's input data, it may be unaligned;
  28. * otherwise, it will always be aligned.
  29. *
  30. * The image_render procedures work on fully expanded, complete rows. These
  31. * take a height argument, which is an integer >= 0; they return a negative
  32. * code, or the number of rows actually processed (which may be less than
  33. * the height). height = 0 is a special call to indicate that there is no
  34. * more input data; this is necessary because the last scan lines of the
  35. * source data may not produce any output.
  36. *
  37. * Note that the 'w' argument of the image_render procedure is the number
  38. * of samples, i.e., the number of pixels * the number of samples per pixel.
  39. * This is neither the width in pixels nor the width in bytes (in the case
  40. * of 12-bit samples, which expand to 2 bytes apiece).
  41. */
  42. #define irender_proc(proc)\
  43. int proc(P6(gx_image_enum *penum, const byte *buffer, int data_x,\
  44. uint w, int h, gx_device *dev))
  45. typedef irender_proc((*irender_proc_t));
  46. /*
  47. * Define procedures for selecting imaging methods according to the class of
  48. * the image. Image class procedures are called in alphabetical order, so
  49. * their names begin with a digit that indicates their priority
  50. * (0_interpolate, etc.): each one may assume that all the previous ones
  51. * failed. If a class procedure succeeds, it may update the enumerator
  52. * structure as well as returning the rendering procedure.
  53. */
  54. #define iclass_proc(proc)\
  55. irender_proc_t proc(P1(gx_image_enum *penum))
  56. typedef iclass_proc((*gx_image_class_t));
  57. #endif /* gxiclass_INCLUDED */