summaryrefslogtreecommitdiff
path: root/include/gutenprint/color.h
blob: 72108973a6370fa33c67e5e994c27e0733b6e887 (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
 * "$Id: color.h,v 1.1 2004/09/17 18:38:01 rleigh Exp $"
 *
 *   libgimpprint color functions.
 *
 *   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/color.h
 * @brief Color functions.
 */

#ifndef GUTENPRINT_COLOR_H
#define GUTENPRINT_COLOR_H

#ifdef __cplusplus
extern "C" {
#endif

/**
 * The color data type is responsible for providing colour
 * conversion features.  Color modules provide the actual
 * functionality, so different colour management modules may provide
 * the application with different services (for example, colour
 * profiles).

 * @defgroup color color
 * @{
 */

typedef struct
{
  int (*init)(stp_vars_t *v, stp_image_t *image, size_t steps);
  int (*get_row)(stp_vars_t *v, stp_image_t *image,
		 int row, unsigned *zero_mask);
  stp_parameter_list_t (*list_parameters)(const stp_vars_t *v);
  void (*describe_parameter)(const stp_vars_t *v, const char *name,
			     stp_parameter_t *description);
} stp_colorfuncs_t;


typedef struct stp_color
{
  const char *short_name;       /* Color module name */
  const char *long_name;        /* Long name for UI */
  const stp_colorfuncs_t *colorfuncs;
} stp_color_t;

/*
 * Initialize the color machinery.  Return value is the number
 * of columns of output
 */
extern int stp_color_init(stp_vars_t *v, stp_image_t *image, size_t steps);

/*
 * Acquire input and perform color conversion.  Return value
 * is status; zero is success.
 */
extern int stp_color_get_row(stp_vars_t *v, stp_image_t *image,
			     int row, unsigned *zero_mask);

extern stp_parameter_list_t stp_color_list_parameters(const stp_vars_t *v);

extern void stp_color_describe_parameter(const stp_vars_t *v, const char *name,
					 stp_parameter_t *description);

extern int
stp_color_register(const stp_color_t *color);

extern int
stp_color_unregister(const stp_color_t *color);

/**
 * Get the number of available color modules.
 * @returns the number of color modules.
 */
extern int
stp_color_count(void);

/**
 * Get a color module by its name.
 * @param name the short unique name.
 * number of papers - 1).
 * @returns a pointer to the color module, or NULL on failure.
 */
extern const stp_color_t *
stp_get_color_by_name(const char *name);

/**
 * Get a color module by its index number.
 * @param idx the index number.  This must not be greater than (total
 * number of papers - 1).
 * @returns a pointer to the color module, or NULL on failure.
 */
extern const stp_color_t *
stp_get_color_by_index(int idx);

extern const stp_color_t *
stp_get_color_by_colorfuncs(stp_colorfuncs_t *colorfuncs);

/**
 * Get the short (untranslated) name of a color module.
 * @param c the color module to use.
 * @returns the short name.
 */
extern const char *
stp_color_get_name(const stp_color_t *c);

/**
 * Get the long (translated) name of a color module.
 * @param c the color module to use.
 * @returns the long name.
 */
extern const char *
stp_color_get_long_name(const stp_color_t *c);



#endif /* GUTENPRINT_COLOR_H */
/*
 * End of "$Id: color.h,v 1.1 2004/09/17 18:38:01 rleigh Exp $".
 */