Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals  

src/main/lut.h

Go to the documentation of this file.
00001 /*
00002  * "$Id: print-color.c,v 1.106.2.16 2004/03/21 22:34:11 rlk Exp $"
00003  *
00004  *   Gimp-Print color management module - traditional Gimp-Print algorithm.
00005  *
00006  *   Copyright 1997-2000 Michael Sweet (mike@easysw.com) and
00007  *      Robert Krawitz (rlk@alum.mit.edu)
00008  *
00009  *   This program is free software; you can redistribute it and/or modify it
00010  *   under the terms of the GNU General Public License as published by the Free
00011  *   Software Foundation; either version 2 of the License, or (at your option)
00012  *   any later version.
00013  *
00014  *   This program is distributed in the hope that it will be useful, but
00015  *   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00016  *   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00017  *   for more details.
00018  *
00019  *   You should have received a copy of the GNU General Public License
00020  *   along with this program; if not, write to the Free Software
00021  *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00022  */
00023 
00024 #ifndef GIMP_PRINT_INTERNAL_LUT_H
00025 #define GIMP_PRINT_INTERNAL_LUT_H
00026 
00027 #ifdef HAVE_CONFIG_H
00028 #include <config.h>
00029 #endif
00030 #include <gimp-print/gimp-print.h>
00031 #include "gimp-print-internal.h"
00032 #include <gimp-print/gimp-print-intl-internal.h>
00033 #include <math.h>
00034 #ifdef HAVE_LIMITS_H
00035 #include <limits.h>
00036 #endif
00037 
00038 /* Color conversion function */
00039 typedef unsigned (*stp_convert_t)(stp_const_vars_t vars,
00040                                   const unsigned char *in,
00041                                   unsigned short *out);
00042 
00043 typedef enum
00044 {
00045   COLOR_CORRECTION_DEFAULT,
00046   COLOR_CORRECTION_UNCORRECTED,
00047   COLOR_CORRECTION_BRIGHT,
00048   COLOR_CORRECTION_ACCURATE,
00049   COLOR_CORRECTION_THRESHOLD,
00050   COLOR_CORRECTION_DENSITY,
00051   COLOR_CORRECTION_RAW
00052 } color_correction_enum_t;
00053 
00054 typedef struct
00055 {
00056   const char *name;
00057   const char *text;
00058   color_correction_enum_t correction;
00059   int correct_hsl;
00060 } color_correction_t;
00061 
00062 typedef enum
00063 {
00064   COLOR_WHITE,                  /* RGB */
00065   COLOR_BLACK,                  /* CMY */
00066   COLOR_UNKNOWN                 /* Printer-specific uninterpreted */
00067 } color_model_t;
00068 
00069 #define CHANNEL_K       0
00070 #define CHANNEL_C       1
00071 #define CHANNEL_M       2
00072 #define CHANNEL_Y       3
00073 #define CHANNEL_W       4
00074 #define CHANNEL_R       5
00075 #define CHANNEL_G       6
00076 #define CHANNEL_B       7
00077 #define CHANNEL_MAX     8
00078 #define CHANNEL_RGB_OFFSET (CHANNEL_W - CHANNEL_K)
00079 
00080 #define CMASK_K         (1 << CHANNEL_K)
00081 #define CMASK_C         (1 << CHANNEL_C)
00082 #define CMASK_M         (1 << CHANNEL_M)
00083 #define CMASK_Y         (1 << CHANNEL_Y)
00084 #define CMASK_W         (1 << CHANNEL_W)
00085 #define CMASK_R         (1 << CHANNEL_R)
00086 #define CMASK_G         (1 << CHANNEL_G)
00087 #define CMASK_B         (1 << CHANNEL_B)
00088 #define CMASK_RAW       (1 << CHANNEL_MAX)
00089 
00090 typedef struct
00091 {
00092   unsigned channel_id;
00093   const char *gamma_name;
00094   const char *curve_name;
00095 } channel_param_t;
00096 
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 } color_description_t;
00129 
00130 typedef struct
00131 {
00132   const char *name;
00133   size_t bits;
00134 } channel_depth_t;
00135 
00136 typedef struct
00137 {
00138   stp_curve_t curve;
00139   const double *d_cache;
00140   const unsigned short *s_cache;
00141   size_t count;
00142 } cached_curve_t;
00143 
00144 typedef struct
00145 {
00146   unsigned steps;
00147   int channel_depth;
00148   int image_width;
00149   int in_channels;
00150   int out_channels;
00151   int channels_are_initialized;
00152   int invert_output;
00153   const color_description_t *input_color_description;
00154   const color_description_t *output_color_description;
00155   const color_correction_t *color_correction;
00156   cached_curve_t channel_curves[STP_CHANNEL_LIMIT];
00157   double gamma_values[STP_CHANNEL_LIMIT];
00158   double print_gamma;
00159   double app_gamma;
00160   double screen_gamma;
00161   double contrast;
00162   double brightness;
00163   int linear_contrast_adjustment;
00164   cached_curve_t hue_map;
00165   cached_curve_t lum_map;
00166   cached_curve_t sat_map;
00167   cached_curve_t gcr_curve;
00168   unsigned short *cmy_tmp;      /* CMY -> CMYK */
00169   unsigned short *cmyk_tmp;     /* CMYK -> CMYKRB */
00170   unsigned char *in_data;
00171 } lut_t;
00172 
00173 /* Color conversion function */
00174 typedef unsigned (*stp_convert_t)(stp_const_vars_t vars,
00175                                   const unsigned char *in,
00176                                   unsigned short *out);
00177 
00178 #endif GIMP_PRINT_INTERNAL_LUT_H

Generated on Wed May 12 20:21:29 2004 for libgimpprint API Reference by doxygen1.2.17