libgimpprint API Reference: dither.h File Reference

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

# include/gimp-print/dither.h File Reference

Go to the source code of this file.

## Data Structures
struct | stp_dither_matrix_short
struct | stp_dither_matrix_normal
struct | stp_dither_matrix_generic
struct | dither_matrix_impl
struct | stp_dotsize
struct | stp_shade
## Defines
#define | STP_ECOLOR_K 0
#define | STP_ECOLOR_C 1
#define | STP_ECOLOR_M 2
#define | STP_ECOLOR_Y 3
#define | STP_NCOLORS (4)
## Typedefs
typedef stp_dither_matrix_short | stp_dither_matrix_short_t
typedef stp_dither_matrix_normal | stp_dither_matrix_normal_t
typedef stp_dither_matrix_generic | stp_dither_matrix_generic_t
typedef dither_matrix_impl | stp_dither_matrix_impl_t
typedef stp_dotsize | stp_dotsize_t
typedef stp_shade | stp_shade_t
## Functions
void | stp_dither_matrix_iterated_init (stp_dither_matrix_impl_t *mat, size_t size, size_t exponent, const unsigned *array)
void | stp_dither_matrix_shear (stp_dither_matrix_impl_t *mat, int x_shear, int y_shear)
void | stp_dither_matrix_init (stp_dither_matrix_impl_t *mat, int x_size, int y_size, const unsigned int *array, int transpose, int prescaled)
void | stp_dither_matrix_init_short (stp_dither_matrix_impl_t *mat, int x_size, int y_size, const unsigned short *array, int transpose, int prescaled)
int | stp_dither_matrix_validate_array (const stp_array_t *array)
void | stp_dither_matrix_init_from_dither_array (stp_dither_matrix_impl_t *mat, const stp_array_t *array, int transpose)
void | stp_dither_matrix_destroy (stp_dither_matrix_impl_t *mat)
void | stp_dither_matrix_clone (const stp_dither_matrix_impl_t *src, stp_dither_matrix_impl_t *dest, int x_offset, int y_offset)
void | stp_dither_matrix_copy (const stp_dither_matrix_impl_t *src, stp_dither_matrix_impl_t *dest)
void | stp_dither_matrix_scale_exponentially (stp_dither_matrix_impl_t *mat, double exponent)
void | stp_dither_matrix_set_row (stp_dither_matrix_impl_t *mat, int y)
stp_array_t * | stp_find_standard_dither_array (int x_aspect, int y_aspect)
stp_parameter_list_t | stp_dither_list_parameters (const stp_vars_t *v)
void | stp_dither_describe_parameter (const stp_vars_t *v, const char *name, stp_parameter_t *description)
void | stp_dither_init (stp_vars_t *v, stp_image_t *image, int out_width, int xdpi, int ydpi)
void | stp_dither_set_iterated_matrix (stp_vars_t *v, size_t edge, size_t iterations, const unsigned *data, int prescaled, int x_shear, int y_shear)
void | stp_dither_set_matrix (stp_vars_t *v, const stp_dither_matrix_generic_t *mat, int transpose, int x_shear, int y_shear)
void | stp_dither_set_matrix_from_dither_array (stp_vars_t *v, const stp_array_t *array, int transpose)
void | stp_dither_set_transition (stp_vars_t *v, double)
void | stp_dither_set_randomizer (stp_vars_t *v, int color, double)
void | stp_dither_set_ink_spread (stp_vars_t *v, int spread)
void | stp_dither_set_adaptive_limit (stp_vars_t *v, double limit)
int | stp_dither_get_first_position (stp_vars_t *v, int color, int subchan)
int | stp_dither_get_last_position (stp_vars_t *v, int color, int subchan)
void | stp_dither_set_inks_simple (stp_vars_t *v, int color, int nlevels, const double *levels, double density, double darkness)
void | stp_dither_set_inks_full (stp_vars_t *v, int color, int nshades, const stp_shade_t *shades, double density, double darkness)
void | stp_dither_set_inks (stp_vars_t *v, int color, double density, double darkness, int nshades, const double *svalues, int ndotsizes, const double *dvalues)
void | stp_dither_add_channel (stp_vars_t *v, unsigned char *data, unsigned channel, unsigned subchannel)
unsigned char * | stp_dither_get_channel (stp_vars_t *v, unsigned channel, unsigned subchannel)
void | stp_dither (stp_vars_t *v, int row, int duplicate_line, int zero_mask, const unsigned char *mask)
void | stp_dither_internal (stp_vars_t *v, int row, const unsigned short *input, int duplicate_line, int zero_mask, const unsigned char *mask)

## Define Documentation

#define STP_ECOLOR_C 1

| Definition at line 48 of file dither.h. Referenced by escp2_parameters(), and pcl_describe_output().

#define STP_ECOLOR_K 0

| Definition at line 47 of file dither.h. Referenced by escp2_parameters(), pcl_describe_output(), and set_gray_transition_parameter().

#define STP_ECOLOR_M 2

| Definition at line 49 of file dither.h. Referenced by escp2_parameters(), and pcl_describe_output().

#define STP_ECOLOR_Y 3

| Definition at line 50 of file dither.h. Referenced by escp2_parameters(), and pcl_describe_output().

#define STP_NCOLORS (4)

| Definition at line 51 of file dither.h.

## Typedef Documentation

typedef struct stp_dither_matrix_generic stp_dither_matrix_generic_t

| Referenced by stp_dither_set_matrix().

typedef struct dither_matrix_impl stp_dither_matrix_impl_t

| Referenced by ditherpoint(), print_color(), stp_dither_matrix_clone(), stp_dither_matrix_copy(), stp_dither_matrix_destroy(), stp_dither_matrix_init(), stp_dither_matrix_init_from_dither_array(), stp_dither_matrix_init_short(), stp_dither_matrix_iterated_init(), stp_dither_matrix_scale_exponentially(), stp_dither_matrix_set_row(), and stp_dither_matrix_shear().

typedef struct stp_dither_matrix_normal stp_dither_matrix_normal_t

typedef struct stp_dither_matrix_short stp_dither_matrix_short_t

typedef struct stp_dotsize stp_dotsize_t

| Referenced by initialize_channel(), pcl_val_to_text(), stp_dither_set_inks(), stp_dither_set_inks_simple(), and stpi_dither_set_ranges().

typedef struct stp_shade stp_shade_t

| Referenced by initialize_channel(), stp_dither_set_inks(), stp_dither_set_inks_full(), stp_dither_set_inks_simple(), and stpi_dither_set_ranges().

## Function Documentation

void stp_dither | ( | stp_vars_t * | v,
|  | int | row,
|  | int | duplicate_line,
|  | int | zero_mask,
|  | const unsigned char * | mask
| ) |

| Definition at line 494 of file dither-main.c. References stp_channel_get_output(), stp_dither_internal(), and stp_vars_t. Referenced by escp2_print_data().

void stp_dither_add_channel | ( | stp_vars_t * | v,
|  | unsigned char * | data,
|  | unsigned | channel,
|  | unsigned | subchannel
| ) |

| Definition at line 188 of file dither-inks.c. References assert, dither::channel, dither::channel_count, insert_channel(), insert_subchannel(), dither_channel::ptr, stp_get_component_data(), stp_vars_t, stpi_dither_t, stpi_dither_translate_channel(), and dither::subchannel_count. Referenced by allocate_channels().

void stp_dither_describe_parameter | ( | const stp_vars_t * | v,
|  | const char * | name,
|  | stp_parameter_t * | description
| ) |

| Definition at line 111 of file dither-main.c. References stp_parameter_t::bounds, stp_parameter_t::deflt, dither_algos, dither_parameters, stp_parameter_t::is_active, stpi_dither_algorithm_t::name, stp_param_string_t::name, num_dither_algos, stp_parameter_t::p_level, stp_parameter_t::p_type, stp_check_string_parameter(), stp_fill_parameter_settings(), stp_get_string_parameter(), STP_PARAMETER_ACTIVE, STP_PARAMETER_LEVEL_BASIC, STP_PARAMETER_TYPE_INVALID, stp_string_list_add_string(), stp_string_list_create(), stp_string_list_param(), stp_vars_t, stpi_get_quality_by_name(), and stpi_dither_algorithm_t::text. Referenced by stp_describe_parameter().

unsigned char* stp_dither_get_channel | ( | stp_vars_t * | v,
|  | unsigned | channel,
|  | unsigned | subchannel
| ) |

| Definition at line 59 of file dither-inks.c. References dither::channel, dither_channel::ptr, stp_get_component_data(), stp_vars_t, stpi_dither_t, and stpi_dither_translate_channel(). Referenced by pcl_describe_output().

int stp_dither_get_first_position | ( | stp_vars_t * | v,
|  | int | color,
|  | int | subchan
| ) |

| Definition at line 431 of file dither-main.c. References CHANNEL, stp_get_component_data(), stp_vars_t, stpi_dither_t, and stpi_dither_translate_channel().

int stp_dither_get_last_position | ( | stp_vars_t * | v,
|  | int | color,
|  | int | subchan
| ) |

| Definition at line 441 of file dither-main.c. References CHANNEL, stp_get_component_data(), stp_vars_t, stpi_dither_t, and stpi_dither_translate_channel(). Referenced by pcl_describe_output().

void stp_dither_init | ( | stp_vars_t * | v,
|  | stp_image_t * | image,
|  | int | out_width,
|  | int | xdpi,
|  | int | ydpi
| ) |

| Definition at line 340 of file dither-main.c. References dither::adaptive_limit, dither::channel_count, dither::d_cutoff, D_EVENTONE, D_FAST, D_PREDITHERED, D_VERY_FAST, DITHER_FAST_STEPS, dither::ditherfunc, dither::dst_width, dither::error_rows, ERROR_ROWS, dither::finalized, dither::offset0_table, dither::offset1_table, sq2, dither::src_width, stp_abort(), stp_allocate_component_data(), stp_array_destroy(), stp_array_t, stp_check_array_parameter(), stp_check_int_parameter(), stp_dither_matrix_validate_array(), stp_dither_set_ink_spread(), stp_dither_set_iterated_matrix(), stp_dither_set_matrix_from_dither_array(), stp_dither_set_transition(), stp_eprintf(), stp_find_standard_dither_array(), stp_get_array_parameter(), stp_get_int_parameter(), stp_image_t, stp_image_width(), STP_PARAMETER_ACTIVE, stp_vars_t, stp_zalloc(), stpi_dither_free(), stpi_dither_t, dither::stpi_dither_type, stpi_set_dither_function(), dither::transition, dither::x_aspect, and dither::y_aspect. Referenced by escp2_print_page().

void stp_dither_internal | ( | stp_vars_t * | v,
|  | int | row,
|  | const unsigned short * | input,
|  | int | duplicate_line,
|  | int | zero_mask,
|  | const unsigned char * | mask
| ) |

| Definition at line 468 of file dither-main.c. References CHANNEL, CHANNEL_COUNT, dither::dither_matrix, dither::ditherfunc, dither::dst_width, dither::ptr_offset, stp_dither_matrix_set_row(), stp_get_component_data(), stp_vars_t, stpi_dither_finalize(), stpi_dither_t, and dither::transition_matrix. Referenced by stp_dither().

stp_parameter_list_t stp_dither_list_parameters | ( | const stp_vars_t * | v | ) |

| Definition at line 101 of file dither-main.c. References dither_parameter_count, dither_parameters, stp_parameter_list_add_param(), stp_parameter_list_create(), stp_parameter_list_t, and stp_vars_t. Referenced by stp_get_parameter_list().

void stp_dither_matrix_clone | ( | const stp_dither_matrix_impl_t * | src,
|  | stp_dither_matrix_impl_t * | dest,
|  | int | x_offset,
|  | int | y_offset
| ) |

| Definition at line 281 of file print-dither-matrices.c. References dither_matrix_impl::base, dither_matrix_impl::exp, dither_matrix_impl::fast_mask, dither_matrix_impl::i_own, dither_matrix_impl::index, dither_matrix_impl::last_x, dither_matrix_impl::last_x_mod, dither_matrix_impl::last_y, dither_matrix_impl::last_y_mod, dither_matrix_impl::matrix, stp_dither_matrix_impl_t, dither_matrix_impl::total_size, dither_matrix_impl::x_offset, dither_matrix_impl::x_size, dither_matrix_impl::y_offset, and dither_matrix_impl::y_size. Referenced by et_setup(), initialize_channel(), postinit_matrix(), stp_dither_set_transition(), and stpi_dither_finalize().

void stp_dither_matrix_copy | ( | const stp_dither_matrix_impl_t * | src,
|  | stp_dither_matrix_impl_t * | dest
| ) |

| Definition at line 302 of file print-dither-matrices.c. References dither_matrix_impl::base, dither_matrix_impl::exp, dither_matrix_impl::fast_mask, dither_matrix_impl::i_own, dither_matrix_impl::index, dither_matrix_impl::last_x, dither_matrix_impl::last_x_mod, dither_matrix_impl::last_y, dither_matrix_impl::last_y_mod, dither_matrix_impl::matrix, stp_dither_matrix_impl_t, stp_malloc(), dither_matrix_impl::total_size, dither_matrix_impl::x_offset, dither_matrix_impl::x_size, dither_matrix_impl::y_offset, and dither_matrix_impl::y_size. Referenced by stp_dither_set_transition().

void stp_dither_matrix_destroy | ( | stp_dither_matrix_impl_t * | mat | ) |

| Definition at line 267 of file print-dither-matrices.c. References dither_matrix_impl::base, dither_matrix_impl::exp, dither_matrix_impl::i_own, dither_matrix_impl::matrix, stp_dither_matrix_impl_t, stp_free(), dither_matrix_impl::total_size, dither_matrix_impl::x_size, and dither_matrix_impl::y_size. Referenced by preinit_matrix(), stp_dither_set_transition(), stpi_dither_channel_destroy(), and stpi_dither_free().

void stp_dither_matrix_init | ( | stp_dither_matrix_impl_t * | mat,
|  | int | x_size,
|  | int | y_size,
|  | const unsigned int * | array,
|  | int | transpose,
|  | int | prescaled
| ) |

| Definition at line 200 of file print-dither-matrices.c. References dither_matrix_impl::base, dither_matrix_impl::exp, dither_matrix_impl::fast_mask, dither_matrix_impl::i_own, dither_matrix_impl::index, is_po2(), dither_matrix_impl::last_x, dither_matrix_impl::last_x_mod, dither_matrix_impl::last_y, dither_matrix_impl::last_y_mod, dither_matrix_impl::matrix, stp_dither_matrix_impl_t, stp_malloc(), dither_matrix_impl::total_size, dither_matrix_impl::x_size, and dither_matrix_impl::y_size. Referenced by stp_dither_set_matrix().

void stp_dither_matrix_init_from_dither_array | ( | stp_dither_matrix_impl_t * | mat,
|  | const stp_array_t * | array,
|  | int | transpose
| ) |

| Definition at line 162 of file print-dither-matrices.c. References dither_matrix_impl::base, dither_matrix_impl::exp, dither_matrix_impl::fast_mask, dither_matrix_impl::i_own, dither_matrix_impl::index, is_po2(), dither_matrix_impl::last_x, dither_matrix_impl::last_x_mod, dither_matrix_impl::last_y, dither_matrix_impl::last_y_mod, dither_matrix_impl::matrix, stp_array_get_sequence(), stp_array_get_size(), stp_array_t, stp_dither_matrix_impl_t, stp_malloc(), stp_sequence_get_ushort_data(), stp_sequence_t, dither_matrix_impl::total_size, dither_matrix_impl::x_size, and dither_matrix_impl::y_size. Referenced by stp_dither_set_matrix_from_dither_array().

void stp_dither_matrix_init_short | ( | stp_dither_matrix_impl_t * | mat,
|  | int | x_size,
|  | int | y_size,
|  | const unsigned short * | array,
|  | int | transpose,
|  | int | prescaled
| ) |

| Definition at line 233 of file print-dither-matrices.c. References dither_matrix_impl::base, dither_matrix_impl::exp, dither_matrix_impl::fast_mask, dither_matrix_impl::i_own, dither_matrix_impl::index, is_po2(), dither_matrix_impl::last_x, dither_matrix_impl::last_x_mod, dither_matrix_impl::last_y, dither_matrix_impl::last_y_mod, dither_matrix_impl::matrix, stp_dither_matrix_impl_t, stp_malloc(), dither_matrix_impl::total_size, dither_matrix_impl::x_size, and dither_matrix_impl::y_size. Referenced by stp_dither_set_matrix().

void stp_dither_matrix_iterated_init | ( | stp_dither_matrix_impl_t * | mat,
|  | size_t | size,
|  | size_t | exponent,
|  | const unsigned * | array
| ) |

| Definition at line 96 of file print-dither-matrices.c. References dither_matrix_impl::base, calc_ordered_point(), dither_matrix_impl::exp, dither_matrix_impl::fast_mask, dither_matrix_impl::i_own, dither_matrix_impl::index, is_po2(), dither_matrix_impl::last_x, dither_matrix_impl::last_x_mod, dither_matrix_impl::last_y, dither_matrix_impl::last_y_mod, dither_matrix_impl::matrix, stp_dither_matrix_impl_t, stp_malloc(), dither_matrix_impl::total_size, dither_matrix_impl::x_size, and dither_matrix_impl::y_size. Referenced by stp_dither_set_iterated_matrix().

void stp_dither_matrix_scale_exponentially | ( | stp_dither_matrix_impl_t * | mat,
|  | double | exponent
| ) |

| Definition at line 325 of file print-dither-matrices.c. References dither_matrix_impl::matrix, stp_dither_matrix_impl_t, dither_matrix_impl::x_size, and dither_matrix_impl::y_size. Referenced by stp_dither_set_transition().

void stp_dither_matrix_set_row | ( | stp_dither_matrix_impl_t * | mat,
|  | int | y
| ) |

| Definition at line 338 of file print-dither-matrices.c. References dither_matrix_impl::index, dither_matrix_impl::last_x_mod, dither_matrix_impl::last_y, dither_matrix_impl::last_y_mod, stp_dither_matrix_impl_t, dither_matrix_impl::x_size, dither_matrix_impl::y_offset, and dither_matrix_impl::y_size. Referenced by stp_dither_internal().

void stp_dither_matrix_shear | ( | stp_dither_matrix_impl_t * | mat,
|  | int | x_shear,
|  | int | y_shear
| ) |

| Definition at line 132 of file print-dither-matrices.c. References dither_matrix_impl::matrix, MATRIX_POINT, stp_dither_matrix_impl_t, stp_free(), stp_malloc(), dither_matrix_impl::x_size, and dither_matrix_impl::y_size. Referenced by postinit_matrix().

int stp_dither_matrix_validate_array | ( | const stp_array_t * | array | ) |

| Definition at line 150 of file print-dither-matrices.c. References stp_array_get_sequence(), stp_array_t, stp_sequence_get_bounds(), and stp_sequence_t. Referenced by stp_dither_init().

void stp_dither_set_adaptive_limit | ( | stp_vars_t * | v,
|  | double | limit
| ) |

| Definition at line 278 of file dither-main.c. References dither::adaptive_limit, stp_get_component_data(), stp_vars_t, and stpi_dither_t.

void stp_dither_set_ink_spread | ( | stp_vars_t * | v,
|  | int | spread
| ) |

| Definition at line 285 of file dither-main.c. References dither::offset0_table, dither::offset1_table, dither::spread, dither::spread_mask, stp_get_component_data(), stp_malloc(), STP_SAFE_FREE, stp_vars_t, and stpi_dither_t. Referenced by stp_dither_init().

void stp_dither_set_inks | ( | stp_vars_t * | v,
|  | int | color,
|  | double | density,
|  | double | darkness,
|  | int | nshades,
|  | const double * | svalues,
|  | int | ndotsizes,
|  | const double * | dvalues
| ) |

| Definition at line 396 of file dither-inks.c. References stp_dotsize::bit_pattern, stp_shade::dot_sizes, stp_shade::numsizes, stp_dither_set_inks_full(), stp_dotsize_t, stp_free(), stp_malloc(), stp_shade_t, stp_vars_t, stp_dotsize::value, and stp_shade::value. Referenced by setup_inks().

void stp_dither_set_inks_full | ( | stp_vars_t * | v,
|  | int | color,
|  | int | nshades,
|  | const stp_shade_t * | shades,
|  | double | density,
|  | double | darkness
| ) |

| Definition at line 366 of file dither-inks.c. References assert, CHANNEL, stp_channel_add(), stp_channel_reset_channel(), STP_DBG_INK, stp_dprintf(), stp_get_component_data(), stp_shade_t, stp_vars_t, stpi_dither_channel_t, stpi_dither_set_ranges(), stpi_dither_t, and stpi_dither_translate_channel(). Referenced by initialize_channel(), stp_dither_set_inks(), and stp_dither_set_inks_simple().

void stp_dither_set_inks_simple | ( | stp_vars_t * | v,
|  | int | color,
|  | int | nlevels,
|  | const double * | levels,
|  | double | density,
|  | double | darkness
| ) |

| Definition at line 345 of file dither-inks.c. References stp_dotsize::bit_pattern, stp_shade::dot_sizes, stp_shade::numsizes, stp_dither_set_inks_full(), stp_dotsize_t, stp_free(), stp_malloc(), stp_shade_t, stp_vars_t, stp_shade::value, and stp_dotsize::value.

void stp_dither_set_iterated_matrix | ( | stp_vars_t * | v,
|  | size_t | edge,
|  | size_t | iterations,
|  | const unsigned * | data,
|  | int | prescaled,
|  | int | x_shear,
|  | int | y_shear
| ) |

| Definition at line 379 of file print-dither-matrices.c. References dither::dither_matrix, postinit_matrix(), preinit_matrix(), stp_dither_matrix_iterated_init(), stp_get_component_data(), stp_vars_t, and stpi_dither_t. Referenced by stp_dither_init().

void stp_dither_set_matrix | ( | stp_vars_t * | v,
|  | const stp_dither_matrix_generic_t * | mat,
|  | int | transpose,
|  | int | x_shear,
|  | int | y_shear
| ) |

| Definition at line 390 of file print-dither-matrices.c. References stp_dither_matrix_generic::bytes, stp_dither_matrix_generic::data, dither::dither_matrix, postinit_matrix(), preinit_matrix(), stp_dither_matrix_generic::prescaled, stp_dither_matrix_generic_t, stp_dither_matrix_init(), stp_dither_matrix_init_short(), stp_get_component_data(), stp_vars_t, stpi_dither_t, stp_dither_matrix_generic::x, and stp_dither_matrix_generic::y.

void stp_dither_set_matrix_from_dither_array | ( | stp_vars_t * | v,
|  | const stp_array_t * | array,
|  | int | transpose
| ) |

| Definition at line 409 of file print-dither-matrices.c. References dither::dither_matrix, postinit_matrix(), preinit_matrix(), stp_array_t, stp_dither_matrix_init_from_dither_array(), stp_get_component_data(), stp_vars_t, and stpi_dither_t. Referenced by stp_dither_init().

void stp_dither_set_randomizer | ( | stp_vars_t * | v,
|  | int | color,
|  | double |
| ) |

| Definition at line 312 of file dither-main.c. References CHANNEL, CHANNEL_COUNT, stp_get_component_data(), stp_vars_t, and stpi_dither_t.

void stp_dither_set_transition | ( | stp_vars_t * | v,
|  | double |
| ) |

| Definition at line 420 of file print-dither-matrices.c. References CHANNEL, CHANNEL_COUNT, dither::dither_matrix, stp_dither_matrix_clone(), stp_dither_matrix_copy(), stp_dither_matrix_destroy(), stp_dither_matrix_scale_exponentially(), stp_get_component_data(), stp_vars_t, stpi_dither_t, dither::transition, dither::transition_matrix, dither_matrix_impl::x_size, and dither_matrix_impl::y_size. Referenced by postinit_matrix(), and stp_dither_init().

stp_array_t* stp_find_standard_dither_array | ( | int | x_aspect,
|  | int | y_aspect
| ) |

| Definition at line 683 of file print-dither-matrices.c. References gcd(), stp_array_t, and stp_xml_get_dither_array(). Referenced by stp_dither_init().