libgimpprint API Reference: dither-main.c File Reference

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

# src/main/dither-main.c File Reference

`#include <gimp-print/gimp-print.h>`
`#include "gimp-print-internal.h"`
`#include <gimp-print/gimp-print-intl-internal.h>`
`#include <math.h>`
`#include <string.h>`
`#include "dither-impl.h"`
`#include "generic-options.h"`

Go to the source code of this file.

## Defines
#define | RETURN_DITHERFUNC(func, v)
## Functions
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)
stpi_ditherfunc_t * | stpi_set_dither_function (stp_vars_t *v)
void | stp_dither_set_adaptive_limit (stp_vars_t *v, double limit)
void | stp_dither_set_ink_spread (stp_vars_t *v, int spread)
void | stp_dither_set_randomizer (stp_vars_t *v, int i, double val)
void | stpi_dither_free (void *vd)
void | stp_dither_init (stp_vars_t *v, stp_image_t *image, int out_width, int xdpi, int ydpi)
void | stpi_dither_reverse_row_ends (stpi_dither_t *d)
int | stp_dither_get_first_position (stp_vars_t *v, int color, int subchannel)
int | stp_dither_get_last_position (stp_vars_t *v, int color, int subchannel)
int * | stpi_dither_get_errline (stpi_dither_t *d, int row, int color)
void | stp_dither_internal (stp_vars_t *v, int row, const unsigned short *input, int duplicate_line, int zero_mask, const unsigned char *mask)
void | stp_dither (stp_vars_t *v, int row, int duplicate_line, int zero_mask, const unsigned char *mask)
## Variables
const stpi_dither_algorithm_t | dither_algos []
const int | num_dither_algos = sizeof(dither_algos)/sizeof(stpi_dither_algorithm_t)
const unsigned | sq2 []
const stp_parameter_t | dither_parameters []
const int | dither_parameter_count

## Define Documentation

#define RETURN_DITHERFUNC | ( | func,
|  | v |  | ) |

| Value:
    do                                                                      \
    {                                                                       \
      stp_dprintf(STP_DBG_COLORFUNC, v, "ditherfunc %s\n", #func);  \
      return (func);                                                        \
    } while (0)
Definition at line 156 of file dither-main.c. Referenced by stpi_set_dither_function().

## 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_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, stp_param_string_t::name, stpi_dither_algorithm_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().

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

| 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 | subchannel
| ) |

| 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, ERROR_ROWS, dither::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_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_randomizer | ( | stp_vars_t * | v,
|  | int | i,
|  | double | val
| ) |

| 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 stpi_dither_free | ( | void * | vd | ) | `[static]`

| Definition at line 321 of file dither-main.c. References dither::aux_freefunc, dither::channel, CHANNEL, CHANNEL_COUNT, dither::channel_index, dither::dither_matrix, dither::offset0_table, dither::offset1_table, stp_dither_matrix_destroy(), stp_free(), STP_SAFE_FREE, stpi_dither_channel_destroy(), stpi_dither_t, dither::subchannel_count, and dither::transition_matrix. Referenced by stp_dither_init().

int* stpi_dither_get_errline | ( | stpi_dither_t * | d,
|  | int | row,
|  | int | color
| ) |

| Definition at line 451 of file dither-main.c. References CHANNEL, CHANNEL_COUNT, dither::dst_width, dither_channel::error_rows, dither::error_rows, dither_channel::errs, MAX_SPREAD, stp_zalloc(), stpi_dither_channel_t, and stpi_dither_t. Referenced by shared_ed_initializer().

void stpi_dither_reverse_row_ends | ( | stpi_dither_t * | d | ) |

| Definition at line 418 of file dither-main.c. References CHANNEL, CHANNEL_COUNT, and stpi_dither_t. Referenced by stpi_dither_ed(), stpi_dither_et(), and stpi_dither_ut().

stpi_ditherfunc_t* stpi_set_dither_function | ( | stp_vars_t * | v | ) | `[static]`

| Definition at line 164 of file dither-main.c. References _, D_ADAPTIVE_HYBRID, D_EVENTONE, D_FAST, D_HYBRID_EVENTONE, D_HYBRID_UNITONE, D_ORDERED, D_PREDITHERED, D_UNITONE, D_VERY_FAST, dither_algos, stpi_dither_algorithm_t::id, num_dither_algos, stpi_quality_t::quality_level, RETURN_DITHERFUNC, stp_check_string_parameter(), stp_get_component_data(), stp_get_string_parameter(), STP_PARAMETER_ACTIVE, stp_vars_t, stpi_dither_ed, stpi_dither_et, stpi_dither_ordered, stpi_dither_predithered, stpi_dither_t, dither::stpi_dither_type, stpi_dither_ut, stpi_dither_very_fast, stpi_get_quality_by_name(), dither::x_aspect, and dither::y_aspect. Referenced by stp_dither_init().

## Variable Documentation

const stpi_dither_algorithm_t dither_algos[]`[static]`

| Initial value:
    {

      { "None",           N_ ("Default"),                -1 },
      { "EvenTone",       N_ ("EvenTone"),               D_EVENTONE },
      { "HybridEvenTone", N_ ("Hybrid EvenTone"),        D_HYBRID_EVENTONE },
      { "UniTone",        N_ ("UniTone"),                D_UNITONE },
      { "HybridUniTone",  N_ ("Hybrid UniTone"),         D_HYBRID_UNITONE },
      { "Adaptive",       N_ ("Adaptive Hybrid"),        D_ADAPTIVE_HYBRID },
      { "Ordered",        N_ ("Ordered"),                D_ORDERED },
      { "Fast",           N_ ("Fast"),                   D_FAST },
      { "VeryFast",       N_ ("Very Fast"),              D_VERY_FAST },
      { "Floyd",          N_ ("Hybrid Floyd-Steinberg"), D_FLOYD_HYBRID },
      { "Predithered",    N_ ("Predithered Input"),      D_PREDITHERED }
    }
Definition at line 42 of file dither-main.c. Referenced by stp_dither_describe_parameter(), and stpi_set_dither_function().

const int dither_parameter_count`[static]`

| Initial value:
    sizeof(dither_parameters) / sizeof(const stp_parameter_t)
Definition at line 97 of file dither-main.c. Referenced by stp_dither_list_parameters().

const stp_parameter_t dither_parameters[]`[static]`

| Initial value:
    {
      {
        "Density", N_("Density"), N_("Output Level Adjustment"),
        N_("Adjust the density (amount of ink) of the print. "
           "Reduce the density if the ink bleeds through the "
           "paper or smears; increase the density if black "
           "regions are not solid."),
        STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
        STP_PARAMETER_LEVEL_ADVANCED, 0, 1, -1, 1, 0
      },
      {
        "DitherAlgorithm", N_("Dither Algorithm"), N_("Screening Adjustment"),
        N_("Choose the dither algorithm to be used.\n"
           "Adaptive Hybrid usually produces the best all-around quality.\n"
           "EvenTone is a new, experimental algorithm that often produces excellent results.\n"
           "Ordered is faster and produces almost as good quality on photographs.\n"
           "Fast and Very Fast are considerably faster, and work well for text and line art.\n"
           "Hybrid Floyd-Steinberg generally produces inferior output."),
        STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_OUTPUT,
        STP_PARAMETER_LEVEL_ADVANCED, 1, 1, -1, 1, 0
      },
    }
Definition at line 73 of file dither-main.c. Referenced by stp_dither_describe_parameter(), and stp_dither_list_parameters().

const int num_dither_algos = sizeof(dither_algos)/sizeof(stpi_dither_algorithm_t)`[static]`

| Definition at line 59 of file dither-main.c. Referenced by stp_dither_describe_parameter(), and stpi_set_dither_function().

const unsigned sq2[]`[static]`

| Initial value:
    {
      0, 2,
      3, 1
    }
Definition at line 67 of file dither-main.c. Referenced by stp_dither_init().