1/* 2 * "$Id: weave.h,v 1.2 2005/06/29 01:42:34 rlk Exp $" 3 * 4 * libgimpprint header. 5 * 6 * Copyright 1997-2000 Michael Sweet (mike@easysw.com) and 7 * Robert Krawitz (rlk@alum.mit.edu) 8 * 9 * This program is free software; you can redistribute it and/or modify it 10 * under the terms of the GNU General Public License as published by the Free 11 * Software Foundation; either version 2 of the License, or (at your option) 12 * any later version. 13 * 14 * This program is distributed in the hope that it will be useful, but 15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 16 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 17 * for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 * 23 * Revision History: 24 * 25 * See ChangeLog 26 */ 27 28/** 29 * @file gutenprint/weave.h 30 * @brief Softweave functions. 31 */ 32 33/* 34 * This file must include only standard C header files. The core code must 35 * compile on generic platforms that don't support glib, gimp, gtk, etc. 36 */ 37 38#ifndef GUTENPRINT_WEAVE_H 39#define GUTENPRINT_WEAVE_H 40 41#ifdef __cplusplus 42extern "C" { 43#endif 44 45#ifdef HAVE_CONFIG_H 46#include <config.h> 47#endif 48 49#define STP_MAX_WEAVE (16) 50 51 52typedef struct /* Weave parameters for a specific row */ 53{ 54 int row; /* Absolute row # */ 55 int pass; /* Computed pass # */ 56 int jet; /* Which physical nozzle we're using */ 57 int missingstartrows; /* Phantom rows (nonexistent rows that */ 58 /* would be printed by nozzles lower than */ 59 /* the first nozzle we're using this pass; */ 60 /* with the current algorithm, always zero */ 61 int logicalpassstart; /* Offset in rows (from start of image) */ 62 /* that the printer must be for this row */ 63 /* to print correctly with the specified jet */ 64 int physpassstart; /* Offset in rows to the first row printed */ 65 /* in this pass. Currently always equal to */ 66 /* logicalpassstart */ 67 int physpassend; /* Offset in rows (from start of image) to */ 68 /* the last row that will be printed this */ 69 /* pass (assuming that we're printing a full */ 70 /* pass). */ 71} stp_weave_t; 72 73typedef struct /* Weave parameters for a specific pass */ 74{ 75 int pass; /* Absolute pass number */ 76 int missingstartrows; /* All other values the same as weave_t */ 77 int logicalpassstart; 78 int physpassstart; 79 int physpassend; 80 int subpass; 81} stp_pass_t; 82 83typedef struct { /* Offsets from the start of each line */ 84 int ncolors; 85 unsigned long *v; /* (really pass) */ 86} stp_lineoff_t; 87 88typedef struct { /* Is this line (really pass) active? */ 89 int ncolors; 90 char *v; 91} stp_lineactive_t; 92 93typedef struct { /* number of rows for a pass */ 94 int ncolors; 95 int *v; 96} stp_linecount_t; 97 98typedef struct { /* Base pointers for each pass */ 99 int ncolors; 100 unsigned char **v; 101} stp_linebufs_t; 102 103typedef struct { /* Width of data actually printed */ 104 int ncolors; 105 int *start_pos; 106 int *end_pos; 107} stp_linebounds_t; 108 109typedef enum { 110 STP_WEAVE_ZIGZAG, 111 STP_WEAVE_ASCENDING, 112 STP_WEAVE_DESCENDING, 113 STP_WEAVE_ASCENDING_2X, 114 STP_WEAVE_STAGGERED, 115 STP_WEAVE_ASCENDING_3X 116} stp_weave_strategy_t; 117 118typedef int stp_packfunc(stp_vars_t *v, 119 const unsigned char *line, int height, 120 unsigned char *comp_buf, 121 unsigned char **comp_ptr, 122 int *first, int *last); 123typedef void stp_fillfunc(stp_vars_t *v, int row, int subpass, 124 int width, int missingstartrows, int color); 125typedef void stp_flushfunc(stp_vars_t *v, int passno, int vertical_subpass); 126typedef int stp_compute_linewidth_func(stp_vars_t *v, int n); 127 128extern void stp_initialize_weave(stp_vars_t *v, int jets, int separation, 129 int oversample, int horizontal, 130 int vertical, int ncolors, int bitwidth, 131 int linewidth, int line_count, 132 int first_line, int page_height, 133 const int *head_offset, 134 stp_weave_strategy_t, 135 stp_flushfunc, 136 stp_fillfunc, 137 stp_packfunc, 138 stp_compute_linewidth_func); 139 140extern stp_packfunc stp_pack_tiff; 141extern stp_packfunc stp_pack_uncompressed; 142 143extern stp_fillfunc stp_fill_tiff; 144extern stp_fillfunc stp_fill_uncompressed; 145 146extern stp_compute_linewidth_func stp_compute_tiff_linewidth; 147extern stp_compute_linewidth_func stp_compute_uncompressed_linewidth; 148 149extern void stp_flush_all(stp_vars_t *v); 150 151extern void 152stp_write_weave(stp_vars_t *v, unsigned char *const cols[]); 153 154extern stp_lineoff_t * 155stp_get_lineoffsets_by_pass(const stp_vars_t *v, int pass); 156 157extern stp_lineactive_t * 158stp_get_lineactive_by_pass(const stp_vars_t *v, int pass); 159 160extern stp_linecount_t * 161stp_get_linecount_by_pass(const stp_vars_t *v, int pass); 162 163extern const stp_linebufs_t * 164stp_get_linebases_by_pass(const stp_vars_t *v, int pass); 165 166extern stp_pass_t * 167stp_get_pass_by_pass(const stp_vars_t *v, int pass); 168 169extern void 170stp_weave_parameters_by_row(const stp_vars_t *v, int row, 171 int vertical_subpass, stp_weave_t *w); 172 173#ifdef __cplusplus 174 } 175#endif 176 177#endif /* GUTENPRINT_WEAVE_H */ 178/* 179 * End of "$Id: weave.h,v 1.2 2005/06/29 01:42:34 rlk Exp $". 180 */ 181