summaryrefslogtreecommitdiff
path: root/include/gutenprint/curve-cache.h
blob: d63cb7a22fcd6516e7a9774eff4995c9927eaab6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
 * "$Id: curve-cache.h,v 1.1 2004/09/17 18:38:01 rleigh Exp $"
 *
 *   Gimp-Print color management module - traditional Gimp-Print algorithm.
 *
 *   Copyright 1997-2000 Michael Sweet (mike@easysw.com) and
 *	Robert Krawitz (rlk@alum.mit.edu)
 *
 *   This program is free software; you can redistribute it and/or modify it
 *   under the terms of the GNU General Public License as published by the Free
 *   Software Foundation; either version 2 of the License, or (at your option)
 *   any later version.
 *
 *   This program is distributed in the hope that it will be useful, but
 *   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 *   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 *   for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

/**
 * @file gutenprint/curve-cache.h
 * @brief Curve caching functions.
 */

/*
 * This file must include only standard C header files.  The core code must
 * compile on generic platforms that don't support glib, gimp, gtk, etc.
 */

#ifndef GUTENPRINT_CURVE_CACHE_H
#define GUTENPRINT_CURVE_CACHE_H

#ifdef __cplusplus
extern "C" {
#endif

#include <gutenprint/curve.h>

typedef struct
{
  stp_curve_t *curve;
  const double *d_cache;
  const unsigned short *s_cache;
  size_t count;
} stp_cached_curve_t;

extern void stp_curve_free_curve_cache(stp_cached_curve_t *cache);

extern void stp_curve_cache_curve_data(stp_cached_curve_t *cache);

extern stp_curve_t *stp_curve_cache_get_curve(stp_cached_curve_t *cache);

extern void stp_curve_cache_curve_invalidate(stp_cached_curve_t *cache);

extern void stp_curve_cache_set_curve(stp_cached_curve_t *cache,
				      stp_curve_t *curve);

extern void stp_curve_cache_set_curve_copy(stp_cached_curve_t *cache,
					   const stp_curve_t *curve);

extern const size_t stp_curve_cache_get_count(stp_cached_curve_t *cache);

extern const unsigned short *stp_curve_cache_get_ushort_data(stp_cached_curve_t *cache);

extern const double *stp_curve_cache_get_double_data(stp_cached_curve_t *cache);

extern void stp_curve_cache_copy(stp_cached_curve_t *dest,
				 const stp_cached_curve_t *src);

#define CURVE_CACHE_FAST_USHORT(cache) ((cache)->s_cache)
#define CURVE_CACHE_FAST_DOUBLE(cache) ((cache)->d_cache)
#define CURVE_CACHE_FAST_COUNT(cache) ((cache)->count)

#ifdef __cplusplus
  }
#endif

#endif /* GUTENPRINT_CURVE_CACHE_H */