libgimpprint API Reference: include/gimp-print/dither.h Source File

Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

# include/gimp-print/dither.h

Go to the documentation of this file.

    00001 /*
    00002  * "$Id: dither_8h-source.html,v 1.1.1.2 2004/12/22 23:48:59 jlovell Exp $"
    00003  *
    00004  *   libgimpprint dither header.
    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  * Revision History:
    00024  *
    00025  *   See ChangeLog
    00026  */
    00027
    00028 /*
    00029  * This file must include only standard C header files.  The core code must
    00030  * compile on generic platforms that don't support glib, gimp, gtk, etc.
    00031  */
    00032
    00033 #ifndef GIMP_PRINT_DITHER_H
    00034 #define GIMP_PRINT_DITHER_H
    00035
    00036 #ifdef __cplusplus
    00037 extern "C" {
    00038 #endif
    00039
    00040 #ifdef HAVE_CONFIG_H
    00041 #include <config.h>
    00042 #endif
    00043
    00044 /*
    00045  * STP_ECOLOR_K must be 0
    00046  */
    00047 #define STP_ECOLOR_K  0
    00048 #define STP_ECOLOR_C  1
    00049 #define STP_ECOLOR_M  2
    00050 #define STP_ECOLOR_Y  3
    00051 #define STP_NCOLORS (4)
    00052
    00053 typedef struct stp_dither_matrix_short
    00054 {
    00055   int x;
    00056   int y;
    00057   int bytes;
    00058   int prescaled;
    00059   const unsigned short *data;
    00060 } stp_dither_matrix_short_t;
    00061
    00062 typedef struct stp_dither_matrix_normal
    00063 {
    00064   int x;
    00065   int y;
    00066   int bytes;
    00067   int prescaled;
    00068   const unsigned *data;
    00069 } stp_dither_matrix_normal_t;
    00070
    00071 typedef struct stp_dither_matrix_generic
    00072 {
    00073   int x;
    00074   int y;
    00075   int bytes;
    00076   int prescaled;
    00077   const void *data;
    00078 } stp_dither_matrix_generic_t;
    00079
    00080 typedef struct dither_matrix_impl
    00081 {
    00082   int base;
    00083   int exp;
    00084   int x_size;
    00085   int y_size;
    00086   int total_size;
    00087   int last_x;
    00088   int last_x_mod;
    00089   int last_y;
    00090   int last_y_mod;
    00091   int index;
    00092   int i_own;
    00093   int x_offset;
    00094   int y_offset;
    00095   unsigned fast_mask;
    00096   unsigned *matrix;
    00097 } stp_dither_matrix_impl_t;
    00098
    00099 extern void stp_dither_matrix_iterated_init(stp_dither_matrix_impl_t *mat, size_t size,
    00100                                             size_t exponent, const unsigned *array);
    00101 extern void stp_dither_matrix_shear(stp_dither_matrix_impl_t *mat,
    00102                                     int x_shear, int y_shear);
    00103 extern void stp_dither_matrix_init(stp_dither_matrix_impl_t *mat, int x_size,
    00104                                    int y_size, const unsigned int *array,
    00105                                    int transpose, int prescaled);
    00106 extern void stp_dither_matrix_init_short(stp_dither_matrix_impl_t *mat, int x_size,
    00107                                          int y_size,
    00108                                          const unsigned short *array,
    00109                                          int transpose, int prescaled);
    00110 extern int stp_dither_matrix_validate_array(const stp_array_t *array);
    00111 extern void stp_dither_matrix_init_from_dither_array(stp_dither_matrix_impl_t *mat,
    00112                                                      const stp_array_t *array,
    00113                                                      int transpose);
    00114 extern void stp_dither_matrix_destroy(stp_dither_matrix_impl_t *mat);
    00115 extern void stp_dither_matrix_clone(const stp_dither_matrix_impl_t *src,
    00116                                     stp_dither_matrix_impl_t *dest,
    00117                                     int x_offset, int y_offset);
    00118 extern void stp_dither_matrix_copy(const stp_dither_matrix_impl_t *src,
    00119                                    stp_dither_matrix_impl_t *dest);
    00120 extern void stp_dither_matrix_scale_exponentially(stp_dither_matrix_impl_t *mat,
    00121                                                   double exponent);
    00122 extern void stp_dither_matrix_set_row(stp_dither_matrix_impl_t *mat, int y);
    00123 extern stp_array_t *stp_find_standard_dither_array(int x_aspect, int y_aspect);
    00124
    00125
    00126 typedef struct stp_dotsize
    00127 {
    00128   unsigned bit_pattern;
    00129   double value;
    00130 } stp_dotsize_t;
    00131
    00132 typedef struct stp_shade
    00133 {
    00134   double value;
    00135   int numsizes;
    00136   const stp_dotsize_t *dot_sizes;
    00137 } stp_shade_t;
    00138
    00139 extern stp_parameter_list_t stp_dither_list_parameters(const stp_vars_t *v);
    00140
    00141 extern void
    00142 stp_dither_describe_parameter(const stp_vars_t *v, const char *name,
    00143                               stp_parameter_t *description);
    00144
    00145 extern void stp_dither_init(stp_vars_t *v, stp_image_t *image,
    00146                             int out_width, int xdpi, int ydpi);
    00147 extern void stp_dither_set_iterated_matrix(stp_vars_t *v, size_t edge,
    00148                                            size_t iterations,
    00149                                            const unsigned *data,
    00150                                            int prescaled,
    00151                                            int x_shear, int y_shear);
    00152 extern void stp_dither_set_matrix(stp_vars_t *v, const stp_dither_matrix_generic_t *mat,
    00153                                   int transpose, int x_shear, int y_shear);
    00154 extern void stp_dither_set_matrix_from_dither_array(stp_vars_t *v,
    00155                                                     const stp_array_t *array,
    00156                                                     int transpose);
    00157 extern void stp_dither_set_transition(stp_vars_t *v, double);
    00158 extern void stp_dither_set_randomizer(stp_vars_t *v, int color, double);
    00159 extern void stp_dither_set_ink_spread(stp_vars_t *v, int spread);
    00160 extern void stp_dither_set_adaptive_limit(stp_vars_t *v, double limit);
    00161 extern int stp_dither_get_first_position(stp_vars_t *v, int color, int subchan);
    00162 extern int stp_dither_get_last_position(stp_vars_t *v, int color, int subchan);
    00163 extern void stp_dither_set_inks_simple(stp_vars_t *v, int color, int nlevels,
    00164                                        const double *levels, double density,
    00165                                        double darkness);
    00166 extern void stp_dither_set_inks_full(stp_vars_t *v, int color, int nshades,
    00167                                      const stp_shade_t *shades,
    00168                                      double density, double darkness);
    00169 extern void stp_dither_set_inks(stp_vars_t *v, int color,
    00170                                 double density, double darkness,
    00171                                 int nshades, const double *svalues,
    00172                                 int ndotsizes, const double *dvalues);
    00173
    00174
    00175 extern void stp_dither_add_channel(stp_vars_t *v, unsigned char *data,
    00176                                    unsigned channel, unsigned subchannel);
    00177
    00178 extern unsigned char *stp_dither_get_channel(stp_vars_t *v,
    00179                                              unsigned channel,
    00180                                              unsigned subchannel);
    00181
    00182 extern void stp_dither(stp_vars_t *v, int row, int duplicate_line,
    00183                        int zero_mask, const unsigned char *mask);
    00184
    00185 /* #ifdef STP_TESTDITHER */
    00186 extern void stp_dither_internal(stp_vars_t *v, int row,
    00187                                 const unsigned short *input,
    00188                                 int duplicate_line, int zero_mask,
    00189                                 const unsigned char *mask);
    00190 /* #endif */
    00191
    00192 #ifdef __cplusplus
    00193   }
    00194 #endif
    00195
    00196 #endif /* GIMP_PRINT_DITHER_H */
    00197 /*
    00198  * End of "$Id: dither_8h-source.html,v 1.1.1.2 2004/12/22 23:48:59 jlovell Exp $".
    00199  */