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

src/main/print-dither-matrices.c File Reference

#include <gimp-print/gimp-print.h>
#include "gimp-print-internal.h"
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "dither-impl.h"

Go to the source code of this file.

Data Structures

struct  stp_xml_dither_cache_t

Defines

#define MATRIX_POINT(m, x, y, x_size, y_size)   ((m)[(((x) + (x_size)) % (x_size)) + ((x_size) * (((y) + (y_size)) % (y_size)))])

Functions

unsigned gcd (unsigned a, unsigned b)
int calc_ordered_point (unsigned x, unsigned y, int steps, int multiplier, int size, const unsigned *map)
int is_po2 (size_t i)
void stp_dither_matrix_iterated_init (stp_dither_matrix_impl_t *mat, size_t size, size_t expt, const unsigned *array)
void stp_dither_matrix_shear (stp_dither_matrix_impl_t *mat, int x_shear, int y_shear)
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_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)
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)
void preinit_matrix (stp_vars_t *v)
void postinit_matrix (stp_vars_t *v, int x_shear, int y_shear)
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 *matrix, int transposed, 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 exponent)
stp_xml_dither_cache_tstp_xml_dither_cache_get (int x, int y)
void stp_xml_dither_cache_set (int x, int y, const char *filename)
int stp_xml_process_dither_matrix (stp_mxml_node_t *dm, const char *file)
stp_array_tstpi_dither_array_create_from_xmltree (stp_mxml_node_t *dm)
stp_array_txml_doc_get_dither_array (stp_mxml_node_t *doc)
stp_array_tstpi_dither_array_create_from_file (const char *file)
stp_array_tstp_xml_get_dither_array (int x, int y)
void stpi_init_dither (void)
stp_array_tstp_find_standard_dither_array (int x_aspect, int y_aspect)

Variables

stp_list_tdither_matrix_cache = NULL


Define Documentation

#define MATRIX_POINT m,
x,
y,
x_size,
y_size   )     ((m)[(((x) + (x_size)) % (x_size)) + ((x_size) * (((y) + (y_size)) % (y_size)))])
 

Definition at line 128 of file print-dither-matrices.c.

Referenced by stp_dither_matrix_shear().


Function Documentation

int calc_ordered_point unsigned  x,
unsigned  y,
int  steps,
int  multiplier,
int  size,
const unsigned *  map
[inline, static]
 

Definition at line 65 of file print-dither-matrices.c.

Referenced by stp_dither_matrix_iterated_init().

unsigned gcd unsigned  a,
unsigned  b
[static]
 

Definition at line 45 of file print-dither-matrices.c.

int is_po2 size_t  i  )  [static]
 

Definition at line 88 of file print-dither-matrices.c.

Referenced by stp_dither_matrix_init(), stp_dither_matrix_init_from_dither_array(), stp_dither_matrix_init_short(), and stp_dither_matrix_iterated_init().

void postinit_matrix stp_vars_t v,
int  x_shear,
int  y_shear
[static]
 

Definition at line 356 of file print-dither-matrices.c.

References CHANNEL, CHANNEL_COUNT, dither::dither_matrix, stp_dither_matrix_clone(), stp_dither_matrix_shear(), stp_dither_set_transition(), stp_get_component_data(), stp_vars_t, stpi_dither_t, dither::transition, dither_matrix_impl::x_size, and dither_matrix_impl::y_size.

Referenced by stp_dither_set_iterated_matrix(), stp_dither_set_matrix(), and stp_dither_set_matrix_from_dither_array().

void preinit_matrix stp_vars_t v  )  [static]
 

Definition at line 346 of file print-dither-matrices.c.

References CHANNEL, CHANNEL_COUNT, dither::dither_matrix, stp_dither_matrix_destroy(), stp_get_component_data(), stp_vars_t, and stpi_dither_t.

Referenced by stp_dither_set_iterated_matrix(), stp_dither_set_matrix(), and stp_dither_set_matrix_from_dither_array().

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  expt,
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_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 matrix,
int  transposed,
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_transition stp_vars_t v,
double  exponent
 

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().

stp_xml_dither_cache_t* stp_xml_dither_cache_get int  x,
int  y
[static]
 

Definition at line 457 of file print-dither-matrices.c.

References dither_matrix_cache, STP_DBG_XML, stp_deprintf(), stp_list_get_start(), stp_list_item_get_data(), stp_list_item_next(), and stp_list_item_t.

Referenced by stp_xml_dither_cache_set(), and stp_xml_get_dither_array().

void stp_xml_dither_cache_set int  x,
int  y,
const char *  filename
[static]
 

Definition at line 489 of file print-dither-matrices.c.

References assert, stp_xml_dither_cache_t::dither_array, dither_matrix_cache, stp_xml_dither_cache_t::filename, STP_DBG_XML, stp_deprintf(), stp_list_create(), stp_list_item_create(), stp_malloc(), stp_strdup(), stp_xml_dither_cache_get(), stp_xml_exit(), stp_xml_init(), stp_xml_dither_cache_t::x, and stp_xml_dither_cache_t::y.

Referenced by stp_xml_process_dither_matrix().

stp_array_t* stp_xml_get_dither_array int  x,
int  y
[static]
 

Definition at line 648 of file print-dither-matrices.c.

References stp_xml_dither_cache_t::dither_array, stp_xml_dither_cache_t::filename, stp_array_create_copy(), stp_array_t, stp_xml_dither_cache_get(), stp_xml_parse_file_named(), and stpi_dither_array_create_from_file().

Referenced by stp_find_standard_dither_array().

int stp_xml_process_dither_matrix stp_mxml_node_t dm,
const char *  file
[static]
 

Definition at line 523 of file print-dither-matrices.c.

References STP_DBG_XML, stp_deprintf(), stp_mxml_node_t, stp_mxmlElementGetAttr(), stp_xml_dither_cache_set(), and stp_xmlstrtol().

Referenced by stpi_init_dither().

stp_array_t* stpi_dither_array_create_from_file const char *  file  )  [static]
 

Definition at line 615 of file print-dither-matrices.c.

References stp_array_t, STP_DBG_XML, stp_deprintf(), stp_erprintf(), STP_MXML_NO_CALLBACK, stp_mxml_node_t, stp_mxmlDelete(), stp_mxmlLoadFile(), stp_xml_exit(), stp_xml_init(), and xml_doc_get_dither_array().

Referenced by stp_xml_get_dither_array().

stp_array_t* stpi_dither_array_create_from_xmltree stp_mxml_node_t dm  )  [static]
 

Definition at line 545 of file print-dither-matrices.c.

References stp_array_create_from_xmltree(), stp_erprintf(), STP_MXML_DESCEND, stp_mxml_node_t, stp_mxmlElementGetAttr(), stp_mxmlFindElement(), and stp_xmlstrtoul().

Referenced by xml_doc_get_dither_array().

stp_array_t* xml_doc_get_dither_array stp_mxml_node_t doc  )  [static]
 

Definition at line 585 of file print-dither-matrices.c.

References stp_mxml_node_s::child, stp_mxml_node_t, stp_xml_get_node(), and stpi_dither_array_create_from_xmltree().

Referenced by stpi_dither_array_create_from_file().


Variable Documentation

stp_list_t* dither_matrix_cache = NULL [static]
 

Definition at line 446 of file print-dither-matrices.c.

Referenced by stp_xml_dither_cache_get(), and stp_xml_dither_cache_set().


Generated on Wed Aug 25 07:56:15 2004 for libgimpprint API Reference by doxygen 1.3.6