1/*
2 * "$Id: color.h,v 1.2 2005/10/18 02:08:16 rlk Exp $"
3 *
4 *   libgimpprint color functions.
5 *
6 *   Copyright 1997-2000 Michael Sweet (mike@easysw.com) and
7 *	Robert Krawitz (rlk@alum.mit.edu)
8 *
9 *   This program is free software; you can redistribute it and/or modify it
10 *   under the terms of the GNU General Public License as published by the Free
11 *   Software Foundation; either version 2 of the License, or (at your option)
12 *   any later version.
13 *
14 *   This program is distributed in the hope that it will be useful, but
15 *   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 *   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
17 *   for more details.
18 *
19 *   You should have received a copy of the GNU General Public License
20 *   along with this program; if not, write to the Free Software
21 *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24/**
25 * @file gutenprint/color.h
26 * @brief Color functions.
27 */
28
29#ifndef GUTENPRINT_COLOR_H
30#define GUTENPRINT_COLOR_H
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36/**
37 * The color data type is responsible for providing colour
38 * conversion features.  Color modules provide the actual
39 * functionality, so different colour management modules may provide
40 * the application with different services (for example, colour
41 * profiles).
42
43 * @defgroup color color
44 * @{
45 */
46
47typedef struct
48{
49  int (*init)(stp_vars_t *v, stp_image_t *image, size_t steps);
50  int (*get_row)(stp_vars_t *v, stp_image_t *image,
51		 int row, unsigned *zero_mask);
52  stp_parameter_list_t (*list_parameters)(const stp_vars_t *v);
53  void (*describe_parameter)(const stp_vars_t *v, const char *name,
54			     stp_parameter_t *description);
55} stp_colorfuncs_t;
56
57
58typedef struct stp_color
59{
60  const char *short_name;       /* Color module name */
61  const char *long_name;        /* Long name for UI */
62  const stp_colorfuncs_t *colorfuncs;
63} stp_color_t;
64
65/*
66 * Initialize the color machinery.  Return value is the number
67 * of columns of output
68 */
69extern int stp_color_init(stp_vars_t *v, stp_image_t *image, size_t steps);
70
71/*
72 * Acquire input and perform color conversion.  Return value
73 * is status; zero is success.
74 */
75extern int stp_color_get_row(stp_vars_t *v, stp_image_t *image,
76			     int row, unsigned *zero_mask);
77
78extern stp_parameter_list_t stp_color_list_parameters(const stp_vars_t *v);
79
80extern void stp_color_describe_parameter(const stp_vars_t *v, const char *name,
81					 stp_parameter_t *description);
82
83extern int
84stp_color_register(const stp_color_t *color);
85
86extern int
87stp_color_unregister(const stp_color_t *color);
88
89/**
90 * Get the number of available color modules.
91 * @returns the number of color modules.
92 */
93extern int
94stp_color_count(void);
95
96/**
97 * Get a color module by its name.
98 * @param name the short unique name.
99 * number of papers - 1).
100 * @returns a pointer to the color module, or NULL on failure.
101 */
102extern const stp_color_t *
103stp_get_color_by_name(const char *name);
104
105/**
106 * Get a color module by its index number.
107 * @param idx the index number.  This must not be greater than (total
108 * number of papers - 1).
109 * @returns a pointer to the color module, or NULL on failure.
110 */
111extern const stp_color_t *
112stp_get_color_by_index(int idx);
113
114extern const stp_color_t *
115stp_get_color_by_colorfuncs(stp_colorfuncs_t *colorfuncs);
116
117/**
118 * Get the short (untranslated) name of a color module.
119 * @param c the color module to use.
120 * @returns the short name.
121 */
122extern const char *
123stp_color_get_name(const stp_color_t *c);
124
125/**
126 * Get the long (translated) name of a color module.
127 * @param c the color module to use.
128 * @returns the long name.
129 */
130extern const char *
131stp_color_get_long_name(const stp_color_t *c);
132
133  /** @} */
134
135#ifdef __cplusplus
136  }
137#endif
138
139
140#endif /* GUTENPRINT_COLOR_H */
141/*
142 * End of "$Id: color.h,v 1.2 2005/10/18 02:08:16 rlk Exp $".
143 */
144