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_PREDITHERED
00048 } color_correction_enum_t;
00049
00050 typedef struct
00051 {
00052 const char *name;
00053 const char *text;
00054 color_correction_enum_t correction;
00055 int correct_hsl;
00056 } color_correction_t;
00057
00058 typedef enum
00059 {
00060 COLOR_WHITE,
00061 COLOR_BLACK,
00062 COLOR_UNKNOWN
00063 } color_model_t;
00064
00065 #define CHANNEL_K 0
00066 #define CHANNEL_C 1
00067 #define CHANNEL_M 2
00068 #define CHANNEL_Y 3
00069 #define CHANNEL_W 4
00070 #define CHANNEL_R 5
00071 #define CHANNEL_G 6
00072 #define CHANNEL_B 7
00073 #define CHANNEL_MAX 8
00074
00075 #define CMASK_K (1 << CHANNEL_K)
00076 #define CMASK_C (1 << CHANNEL_C)
00077 #define CMASK_M (1 << CHANNEL_M)
00078 #define CMASK_Y (1 << CHANNEL_Y)
00079 #define CMASK_W (1 << CHANNEL_W)
00080 #define CMASK_R (1 << CHANNEL_R)
00081 #define CMASK_G (1 << CHANNEL_G)
00082 #define CMASK_B (1 << CHANNEL_B)
00083 #define CMASK_RAW (1 << CHANNEL_MAX)
00084
00085 typedef struct
00086 {
00087 unsigned channel_id;
00088 const char *gamma_name;
00089 const char *curve_name;
00090 const char *rgb_gamma_name;
00091 const char *rgb_curve_name;
00092 } channel_param_t;
00093
00094
00095 typedef unsigned (*stp_convert_t)(const stp_vars_t *vars,
00096 const unsigned char *in,
00097 unsigned short *out);
00098
00099 #define CMASK_NONE (0)
00100 #define CMASK_RGB (CMASK_R | CMASK_G | CMASK_B)
00101 #define CMASK_CMY (CMASK_C | CMASK_M | CMASK_Y)
00102 #define CMASK_CMYK (CMASK_CMY | CMASK_K)
00103 #define CMASK_CMYKRB (CMASK_CMYK | CMASK_R | CMASK_B)
00104 #define CMASK_ALL (CMASK_CMYK | CMASK_RGB | CMASK_W)
00105 #define CMASK_EVERY (CMASK_ALL | CMASK_RAW)
00106
00107 typedef enum
00108 {
00109 COLOR_ID_GRAY,
00110 COLOR_ID_WHITE,
00111 COLOR_ID_RGB,
00112 COLOR_ID_CMY,
00113 COLOR_ID_CMYK,
00114 COLOR_ID_KCMY,
00115 COLOR_ID_CMYKRB,
00116 COLOR_ID_RAW
00117 } color_id_t;
00118
00119 typedef struct
00120 {
00121 const char *name;
00122 int input;
00123 int output;
00124 color_id_t color_id;
00125 color_model_t color_model;
00126 unsigned channels;
00127 int channel_count;
00128 color_correction_enum_t default_correction;
00129 stp_convert_t conversion_function;
00130 } color_description_t;
00131
00132 typedef struct
00133 {
00134 const char *name;
00135 size_t bits;
00136 } channel_depth_t;
00137
00138 typedef struct
00139 {
00140 unsigned steps;
00141 int channel_depth;
00142 int image_width;
00143 int in_channels;
00144 int out_channels;
00145 int channels_are_initialized;
00146 int invert_output;
00147 const color_description_t *input_color_description;
00148 const color_description_t *output_color_description;
00149 const color_correction_t *color_correction;
00150 stp_cached_curve_t brightness_correction;
00151 stp_cached_curve_t contrast_correction;
00152 stp_cached_curve_t user_color_correction;
00153 stp_cached_curve_t channel_curves[STP_CHANNEL_LIMIT];
00154 double gamma_values[STP_CHANNEL_LIMIT];
00155 double print_gamma;
00156 double app_gamma;
00157 double screen_gamma;
00158 double contrast;
00159 double brightness;
00160 int linear_contrast_adjustment;
00161 int printed_colorfunc;
00162 stp_cached_curve_t hue_map;
00163 stp_cached_curve_t lum_map;
00164 stp_cached_curve_t sat_map;
00165 stp_cached_curve_t gcr_curve;
00166 unsigned short *gray_tmp;
00167 unsigned short *cmy_tmp;
00168 unsigned short *cmyk_tmp;
00169 unsigned char *in_data;
00170 } lut_t;
00171
00172 extern unsigned stpi_color_convert_to_gray(const stp_vars_t *v,
00173 const unsigned char *,
00174 unsigned short *);
00175 extern unsigned stpi_color_convert_to_color(const stp_vars_t *v,
00176 const unsigned char *,
00177 unsigned short *);
00178 extern unsigned stpi_color_convert_to_kcmy(const stp_vars_t *v,
00179 const unsigned char *,
00180 unsigned short *);
00181 extern unsigned stpi_color_convert_to_cmykrb(const stp_vars_t *v,
00182 const unsigned char *,
00183 unsigned short *);
00184 extern unsigned stpi_color_convert_raw(const stp_vars_t *v,
00185 const unsigned char *,
00186 unsigned short *);
00187
00188 #ifdef __cplusplus
00189 }
00190 #endif
00191
00192 #endif