gxctable.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* Copyright (C) 1995, 1999 Aladdin Enterprises. 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: gxctable.h,v 1.5 2002/06/16 08:45:43 lpd Exp $ */
  14. /* Interface to color table lookup and interpolation */
  15. #ifndef gxctable_INCLUDED
  16. # define gxctable_INCLUDED
  17. #include "gxfixed.h"
  18. #include "gxfrac.h"
  19. /*
  20. * Define a 3- or 4-D color lookup table.
  21. * n is the number of dimensions (input indices), 3 or 4.
  22. * dims[0..n-1] are the table dimensions.
  23. * m is the number of output values, typically 3 (RGB) or 4 (CMYK).
  24. * For n = 3:
  25. * table[i], 0 <= i < dims[0], point to strings of length
  26. * dims[1] x dims[2] x m.
  27. * For n = 4:
  28. * table[i], 0 <= i < dims[0] x dims[1], points to strings of length
  29. * dims[2] x dims[3] x m.
  30. * It isn't really necessary to store the size of each string, since
  31. * they're all the same size, but it makes things a lot easier for the GC.
  32. */
  33. typedef struct gx_color_lookup_table_s {
  34. int n;
  35. int dims[4]; /* [ndims] */
  36. int m;
  37. const gs_const_string *table;
  38. } gx_color_lookup_table;
  39. /*
  40. * Interpolate in a 3- or 4-D color lookup table.
  41. * pi[0..n-1] are the table indices, guaranteed to be in the ranges
  42. * [0..dims[n]-1] respectively.
  43. * Return interpolated values in pv[0..m-1].
  44. */
  45. /* Return the nearest value without interpolation. */
  46. void gx_color_interpolate_nearest(const fixed * pi,
  47. const gx_color_lookup_table * pclt, frac * pv);
  48. /* Use trilinear interpolation. */
  49. void gx_color_interpolate_linear(const fixed * pi,
  50. const gx_color_lookup_table * pclt, frac * pv);
  51. #endif /* gxctable_INCLUDED */