libgimpprint API Reference: dither-impl.h File Reference

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

# src/main/dither-impl.h File Reference

`#include <limits.h>`

Go to the source code of this file.

## Data Structures
struct | stpi_dither_algorithm_t
struct | ink_defn
struct | dither_segment
struct | dither_channel
struct | dither
## Defines
#define | D_FLOYD_HYBRID 0
#define | D_ADAPTIVE_BASE 4
#define | D_ADAPTIVE_HYBRID (D_ADAPTIVE_BASE | D_FLOYD_HYBRID)
#define | D_ORDERED_BASE 8
#define | D_ORDERED (D_ORDERED_BASE)
#define | D_FAST_BASE 16
#define | D_FAST (D_FAST_BASE)
#define | D_VERY_FAST (D_FAST_BASE + 1)
#define | D_EVENTONE 32
#define | D_UNITONE 64
#define | D_HYBRID_EVENTONE (D_ORDERED_BASE | D_EVENTONE)
#define | D_HYBRID_UNITONE (D_ORDERED_BASE | D_UNITONE)
#define | D_PREDITHERED 128
#define | DITHER_FAST_STEPS (6)
#define | ERROR_ROWS 2
#define | MAX_SPREAD 32
#define | CHANNEL(d, c) ((d)->channel[(c)])
#define | CHANNEL_COUNT(d) ((d)->total_channel_count)
#define | USMIN(a, b) ((a) < (b) ? (a) : (b))
#define | ADVANCE_UNIDIRECTIONAL(d, bit, input, width, xerror, xstep, xmod)
#define | ADVANCE_REVERSE(d, bit, input, width, xerror, xstep, xmod)
#define | ADVANCE_BIDIRECTIONAL(d, bit, in, dir, width, xer, xstep, xmod, err, S)
## Typedefs
typedef void | stpi_ditherfunc_t (stp_vars_t *, int, const unsigned short *, int, int, const unsigned char *)
typedef ink_defn | stpi_ink_defn_t
typedef dither_segment | stpi_dither_segment_t
typedef dither_channel | stpi_dither_channel_t
typedef dither | stpi_dither_t
## Functions
void | stpi_dither_reverse_row_ends (stpi_dither_t *d)
int | stpi_dither_translate_channel (stp_vars_t *v, unsigned channel, unsigned subchannel)
void | stpi_dither_channel_destroy (stpi_dither_channel_t *channel)
void | stpi_dither_finalize (stp_vars_t *v)
int * | stpi_dither_get_errline (stpi_dither_t *d, int row, int color)
## Variables
stpi_ditherfunc_t | stpi_dither_predithered
stpi_ditherfunc_t | stpi_dither_very_fast
stpi_ditherfunc_t | stpi_dither_ordered
stpi_ditherfunc_t | stpi_dither_ed
stpi_ditherfunc_t | stpi_dither_et
stpi_ditherfunc_t | stpi_dither_ut

## Define Documentation

#define ADVANCE_BIDIRECTIONAL | ( | d,
|  | bit,
|  | in,
|  | dir,
|  | width,
|  | xer,
|  | xstep,
|  | xmod,
|  | err,
|  | S |  | ) |

| Value:
    do                                                                      \
    {                                                                       \
      int ii;                                                               \
      int jj;                                                               \
      for (ii = 0; ii < width; ii++)                                        \
        for (jj = 0; jj < S; jj++)                                          \
          err[ii][jj] += dir;                                               \
      if (dir == 1)                                                         \
        ADVANCE_UNIDIRECTIONAL(d, bit, in, width, xer, xstep, xmod);        \
      else                                                                  \
        ADVANCE_REVERSE(d, bit, in, width, xer, xstep, xmod);               \
    } while (0)
Definition at line 239 of file dither-impl.h. Referenced by stpi_dither_ed().

#define ADVANCE_REVERSE | ( | d,
|  | bit,
|  | input,
|  | width,
|  | xerror,
|  | xstep,
|  | xmod |  | ) |

| Value:
    do                                                                      \
    {                                                                       \
      if (bit == 128)                                                       \
        {                                                                   \
          d->ptr_offset--;                                                  \
          bit = 1;                                                          \
        }                                                                   \
      else                                                                  \
        bit <<= 1;                                                          \
      input -= xstep;                                                       \
      if (xmod)                                                             \
        {                                                                   \
          xerror -= xmod;                                                   \
          if (xerror < 0)                                                   \
            {                                                               \
              xerror += d->dst_width;                                       \
              input -= (width);                                             \
            }                                                               \
        }                                                                   \
    } while (0)
Definition at line 217 of file dither-impl.h. Referenced by stpi_dither_et(), and stpi_dither_ut().

#define ADVANCE_UNIDIRECTIONAL | ( | d,
|  | bit,
|  | input,
|  | width,
|  | xerror,
|  | xstep,
|  | xmod |  | ) |

| Value:
    do                                                                        \
    {                                                                         \
      bit >>= 1;                                                              \
      if (bit == 0)                                                           \
        {                                                                     \
          d->ptr_offset++;                                                    \
          bit = 128;                                                          \
        }                                                                     \
      input += xstep;                                                         \
      if (xmod)                                                               \
        {                                                                     \
          xerror += xmod;                                                     \
          if (xerror >= d->dst_width)                                         \
            {                                                                 \
              xerror -= d->dst_width;                                         \
              input += (width);                                               \
            }                                                                 \
        }                                                                     \
    } while (0)
Definition at line 196 of file dither-impl.h. Referenced by stpi_dither_et(), stpi_dither_ordered(), stpi_dither_predithered(), stpi_dither_ut(), and stpi_dither_very_fast().

#define CHANNEL | ( | d,
|  | c |  | ) | ((d)->channel[(c)])

| Definition at line 175 of file dither-impl.h. Referenced by et_initializer(), et_setup(), free_eventone_data(), initialize_channel(), postinit_matrix(), preinit_matrix(), shared_ed_initializer(), stp_dither_get_first_position(), stp_dither_get_last_position(), stp_dither_internal(), stp_dither_set_inks_full(), stp_dither_set_randomizer(), stp_dither_set_transition(), stpi_dither_ed(), stpi_dither_et(), stpi_dither_finalize(), stpi_dither_free(), stpi_dither_get_errline(), stpi_dither_ordered(), stpi_dither_predithered(), stpi_dither_reverse_row_ends(), stpi_dither_set_ranges(), stpi_dither_ut(), stpi_dither_very_fast(), and update_dither().

#define CHANNEL_COUNT | ( | d |  | ) | ((d)->total_channel_count)

| Definition at line 176 of file dither-impl.h. Referenced by et_initializer(), et_setup(), free_eventone_data(), postinit_matrix(), preinit_matrix(), shared_ed_deinitializer(), shared_ed_initializer(), stp_dither_internal(), stp_dither_set_randomizer(), stp_dither_set_transition(), stpi_dither_ed(), stpi_dither_et(), stpi_dither_finalize(), stpi_dither_free(), stpi_dither_get_errline(), stpi_dither_ordered(), stpi_dither_predithered(), stpi_dither_reverse_row_ends(), stpi_dither_ut(), and stpi_dither_very_fast().

#define D_ADAPTIVE_BASE 4

| Definition at line 47 of file dither-impl.h. Referenced by print_color(), and stpi_dither_ed().

#define D_ADAPTIVE_HYBRID (D_ADAPTIVE_BASE | D_FLOYD_HYBRID)

| Definition at line 48 of file dither-impl.h. Referenced by stpi_set_dither_function().

#define D_EVENTONE 32

| Definition at line 54 of file dither-impl.h. Referenced by stp_dither_init(), and stpi_set_dither_function().

#define D_FAST (D_FAST_BASE)

| Definition at line 52 of file dither-impl.h. Referenced by stp_dither_init(), and stpi_set_dither_function().

#define D_FAST_BASE 16

| Definition at line 51 of file dither-impl.h.

#define D_FLOYD_HYBRID 0

| Definition at line 46 of file dither-impl.h.

#define D_HYBRID_EVENTONE (D_ORDERED_BASE | D_EVENTONE)

| Definition at line 56 of file dither-impl.h. Referenced by stpi_set_dither_function().

#define D_HYBRID_UNITONE (D_ORDERED_BASE | D_UNITONE)

| Definition at line 57 of file dither-impl.h. Referenced by stpi_set_dither_function().

#define D_ORDERED (D_ORDERED_BASE)

| Definition at line 50 of file dither-impl.h. Referenced by print_color(), and stpi_set_dither_function().

#define D_ORDERED_BASE 8

| Definition at line 49 of file dither-impl.h. Referenced by print_color(), stpi_dither_et(), and stpi_dither_ut().

#define D_PREDITHERED 128

| Definition at line 58 of file dither-impl.h. Referenced by stp_dither_init(), and stpi_set_dither_function().

#define D_UNITONE 64

| Definition at line 55 of file dither-impl.h. Referenced by et_setup(), and stpi_set_dither_function().

#define D_VERY_FAST (D_FAST_BASE + 1)

| Definition at line 53 of file dither-impl.h. Referenced by stp_dither_init(), and stpi_set_dither_function().

#define DITHER_FAST_STEPS (6)

| Definition at line 60 of file dither-impl.h. Referenced by stp_dither_init().

#define ERROR_ROWS 2

| Definition at line 69 of file dither-impl.h. Referenced by stp_dither_init().

#define MAX_SPREAD 32

| Definition at line 71 of file dither-impl.h. Referenced by diffuse_error(), et_setup(), stpi_dither_et(), stpi_dither_get_errline(), and stpi_dither_ut().

#define USMIN | ( | a,
|  | b |  | ) | ((a) < (b) ? (a) : (b))

| Definition at line 178 of file dither-impl.h.

## Typedef Documentation

typedef struct dither_channel stpi_dither_channel_t

| Referenced by diffuse_error(), et_setup(), eventone_adjust(), eventone_update(), find_segment(), find_segment_and_ditherpoint(), free_eventone_data(), initialize_channel(), insert_subchannel(), print_color(), print_color_ordered(), print_color_very_fast(), set_row_ends(), stp_dither_set_inks_full(), stpi_dither_channel_destroy(), stpi_dither_et(), stpi_dither_finalize(), stpi_dither_finalize_ranges(), stpi_dither_get_errline(), stpi_dither_ordered(), stpi_dither_predithered(), stpi_dither_set_ranges(), stpi_dither_ut(), stpi_dither_very_fast(), and unitone_adjust().

typedef struct dither_segment stpi_dither_segment_t

| Referenced by print_color(), print_color_ordered(), and stpi_dither_set_ranges().

typedef struct dither stpi_dither_t

| Referenced by ditherpoint(), et_initializer(), et_setup(), free_eventone_data(), initialize_channel(), insert_channel(), insert_subchannel(), postinit_matrix(), preinit_matrix(), print_color(), print_color_ordered(), print_color_very_fast(), print_ink(), shared_ed_deinitializer(), shared_ed_initializer(), stp_dither_add_channel(), stp_dither_get_channel(), stp_dither_get_first_position(), stp_dither_get_last_position(), stp_dither_init(), stp_dither_internal(), stp_dither_set_adaptive_limit(), stp_dither_set_ink_spread(), stp_dither_set_inks_full(), stp_dither_set_iterated_matrix(), stp_dither_set_matrix(), stp_dither_set_matrix_from_dither_array(), stp_dither_set_randomizer(), stp_dither_set_transition(), stpi_dither_ed(), stpi_dither_et(), stpi_dither_finalize(), stpi_dither_finalize_ranges(), stpi_dither_free(), stpi_dither_get_errline(), stpi_dither_ordered(), stpi_dither_predithered(), stpi_dither_reverse_row_ends(), stpi_dither_set_ranges(), stpi_dither_translate_channel(), stpi_dither_ut(), stpi_dither_very_fast(), stpi_set_dither_function(), and update_dither().

typedef void stpi_ditherfunc_t(stp_vars_t *, int, const unsigned short *, int, int, const unsigned char *)

| Definition at line 73 of file dither-impl.h.

typedef struct ink_defn stpi_ink_defn_t

| Referenced by find_segment(), find_segment_and_ditherpoint(), print_color(), print_ink(), stpi_dither_et(), stpi_dither_set_ranges(), and stpi_dither_ut().

## Function Documentation

void stpi_dither_channel_destroy | ( | stpi_dither_channel_t * | channel | ) |

| Definition at line 91 of file dither-inks.c. References dither_channel::dithermat, dither_channel::error_rows, dither_channel::errs, dither_channel::ink_list, dither_channel::pick, dither_channel::ranges, stp_dither_matrix_destroy(), STP_SAFE_FREE, and stpi_dither_channel_t. Referenced by free_eventone_data(), and stpi_dither_free().

void stpi_dither_finalize | ( | stp_vars_t * | v | ) |

| Definition at line 166 of file dither-inks.c. References CHANNEL, CHANNEL_COUNT, dither::dither_matrix, dither_channel::dithermat, dither::finalized, dither_channel::pick, stp_dither_matrix_clone(), stp_get_component_data(), stp_vars_t, stpi_dither_channel_t, stpi_dither_t, dither_matrix_impl::x_size, and dither_matrix_impl::y_size. Referenced by stp_dither_internal().

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::error_rows, dither_channel::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().

int stpi_dither_translate_channel | ( | stp_vars_t * | v,
|  | unsigned | channel,
|  | unsigned | subchannel
| ) |

| Definition at line 43 of file dither-inks.c. References dither::channel_count, dither::channel_index, stp_get_component_data(), stp_vars_t, stpi_dither_t, and dither::subchannel_count. Referenced by initialize_channel(), stp_dither_add_channel(), stp_dither_get_channel(), stp_dither_get_first_position(), stp_dither_get_last_position(), and stp_dither_set_inks_full().

## Variable Documentation

stpi_ditherfunc_t stpi_dither_ed

| Definition at line 184 of file dither-impl.h. Referenced by stpi_set_dither_function().

stpi_ditherfunc_t stpi_dither_et

| Definition at line 185 of file dither-impl.h. Referenced by stpi_set_dither_function().

stpi_ditherfunc_t stpi_dither_ordered

| Definition at line 183 of file dither-impl.h. Referenced by stpi_set_dither_function().

stpi_ditherfunc_t stpi_dither_predithered

| Definition at line 181 of file dither-impl.h. Referenced by stpi_set_dither_function().

stpi_ditherfunc_t stpi_dither_ut

| Definition at line 186 of file dither-impl.h. Referenced by stpi_set_dither_function().

stpi_ditherfunc_t stpi_dither_very_fast

| Definition at line 182 of file dither-impl.h. Referenced by stpi_set_dither_function().