00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef GIMP_PRINT_INTERNAL_COLOR_CONVERSION_H
00025 #define GIMP_PRINT_INTERNAL_COLOR_CONVERSION_H
00026
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030
00031 #ifdef HAVE_CONFIG_H
00032 #include <config.h>
00033 #endif
00034 #include <gimp-print/gimp-print.h>
00035 #include <gimp-print/curve-cache.h>
00036
00037 typedef enum
00038 {
00039 COLOR_CORRECTION_DEFAULT,
00040 COLOR_CORRECTION_UNCORRECTED,
00041 COLOR_CORRECTION_BRIGHT,
00042 COLOR_CORRECTION_ACCURATE,
00043 COLOR_CORRECTION_THRESHOLD,
00044 COLOR_CORRECTION_DESATURATED,
00045 COLOR_CORRECTION_DENSITY,
00046 COLOR_CORRECTION_RAW
00047 } color_correction_enum_t;
00048
00049 typedef struct
00050 {
00051 const char *name;
00052 const char *text;
00053 color_correction_enum_t correction;
00054 int correct_hsl;
00055 } color_correction_t;
00056
00057 typedef enum
00058 {
00059 COLOR_WHITE,
00060 COLOR_BLACK,
00061 COLOR_UNKNOWN
00062 } color_model_t;
00063
00064 #define CHANNEL_K 0
00065 #define CHANNEL_C 1
00066 #define CHANNEL_M 2
00067 #define CHANNEL_Y 3
00068 #define CHANNEL_W 4
00069 #define CHANNEL_R 5
00070 #define CHANNEL_G 6
00071 #define CHANNEL_B 7
00072 #define CHANNEL_MAX 8
00073
00074 #define CMASK_K (1 << CHANNEL_K)
00075 #define CMASK_C (1 << CHANNEL_C)
00076 #define CMASK_M (1 << CHANNEL_M)
00077 #define CMASK_Y (1 << CHANNEL_Y)
00078 #define CMASK_W (1 << CHANNEL_W)
00079 #define CMASK_R (1 << CHANNEL_R)
00080 #define CMASK_G (1 << CHANNEL_G)
00081 #define CMASK_B (1 << CHANNEL_B)
00082 #define CMASK_RAW (1 << CHANNEL_MAX)
00083
00084 typedef struct
00085 {
00086 unsigned channel_id;
00087 const char *gamma_name;
00088 const char *curve_name;
00089 const char *rgb_gamma_name;
00090 const char *rgb_curve_name;
00091 } channel_param_t;
00092
00093
00094 typedef unsigned (*stp_convert_t)(const stp_vars_t *vars,
00095 const unsigned char *in,
00096 unsigned short *out);
00097
00098 #define CMASK_NONE (0)
00099 #define CMASK_RGB (CMASK_R | CMASK_G | CMASK_B)
00100 #define CMASK_CMY (CMASK_C | CMASK_M | CMASK_Y)
00101 #define CMASK_CMYK (CMASK_CMY | CMASK_K)
00102 #define CMASK_CMYKRB (CMASK_CMYK | CMASK_R | CMASK_B)
00103 #define CMASK_ALL (CMASK_CMYK | CMASK_RGB | CMASK_W)
00104 #define CMASK_EVERY (CMASK_ALL | CMASK_RAW)
00105
00106 typedef enum
00107 {
00108 COLOR_ID_GRAY,
00109 COLOR_ID_WHITE,
00110 COLOR_ID_RGB,
00111 COLOR_ID_CMY,
00112 COLOR_ID_CMYK,
00113 COLOR_ID_KCMY,
00114 COLOR_ID_CMYKRB,
00115 COLOR_ID_RAW
00116 } color_id_t;
00117
00118 typedef struct
00119 {
00120 const char *name;
00121 int input;
00122 int output;
00123 color_id_t color_id;
00124 color_model_t color_model;
00125 unsigned channels;
00126 int channel_count;
00127 color_correction_enum_t default_correction;
00128 stp_convert_t conversion_function;
00129 } color_description_t;
00130
00131 typedef struct
00132 {
00133 const char *name;
00134 size_t bits;
00135 } channel_depth_t;
00136
00137 typedef struct
00138 {
00139 unsigned steps;
00140 int channel_depth;
00141 int image_width;
00142 int in_channels;
00143 int out_channels;
00144 int channels_are_initialized;
00145 int invert_output;
00146 const color_description_t *input_color_description;
00147 const color_description_t *output_color_description;
00148 const color_correction_t *color_correction;
00149 stp_cached_curve_t channel_curves[STP_CHANNEL_LIMIT];
00150 double gamma_values[STP_CHANNEL_LIMIT];
00151 double print_gamma;
00152 double app_gamma;
00153 double screen_gamma;
00154 double contrast;
00155 double brightness;
00156 int linear_contrast_adjustment;
00157 int printed_colorfunc;
00158 stp_cached_curve_t hue_map;
00159 stp_cached_curve_t lum_map;
00160 stp_cached_curve_t sat_map;
00161 stp_cached_curve_t gcr_curve;
00162 unsigned short *gray_tmp;
00163 unsigned short *cmy_tmp;
00164 unsigned short *cmyk_tmp;
00165 unsigned char *in_data;
00166 } lut_t;
00167
00168 extern unsigned stpi_color_convert_to_gray(const stp_vars_t *v,
00169 const unsigned char *,
00170 unsigned short *);
00171 extern unsigned stpi_color_convert_to_color(const stp_vars_t *v,
00172 const unsigned char *,
00173 unsigned short *);
00174 extern unsigned stpi_color_convert_to_kcmy(const stp_vars_t *v,
00175 const unsigned char *,
00176 unsigned short *);
00177 extern unsigned stpi_color_convert_to_cmykrb(const stp_vars_t *v,
00178 const unsigned char *,
00179 unsigned short *);
00180 extern unsigned stpi_color_convert_raw(const stp_vars_t *v,
00181 const unsigned char *,
00182 unsigned short *);
00183
00184 #ifdef __cplusplus
00185 }
00186 #endif
00187
00188 #endif