Moved g4 encoding functions from pdf library to bitblt library.

Mon, 10 Mar 2003 09:49:50 +0000

author
eric
date
Mon, 10 Mar 2003 09:49:50 +0000
changeset 91
e63762afae80
parent 90
4830f4d7ba7a
child 92
e3254135cf76

Moved g4 encoding functions from pdf library to bitblt library.

Makefile file | annotate | diff | revisions
bitblt.h file | annotate | diff | revisions
bitblt_g4.c file | annotate | diff | revisions
pdf_g4.c file | annotate | diff | revisions
pdf_g4_table_gen.c file | annotate | diff | revisions
pdf_prim.c file | annotate | diff | revisions
pdf_prim.h file | annotate | diff | revisions
     1.1 diff -r 4830f4d7ba7a -r e63762afae80 Makefile
     1.2 --- a/Makefile	Sat Mar 08 10:02:13 2003 +0000
     1.3 +++ b/Makefile	Mon Mar 10 09:49:50 2003 +0000
     1.4 @@ -1,6 +1,6 @@
     1.5  # t2p: build a PDF file out of one or more TIFF Class F Group 4 files
     1.6  # Makefile
     1.7 -# $Id: Makefile,v 1.20 2003/03/08 02:02:13 eric Exp $
     1.8 +# $Id: Makefile,v 1.21 2003/03/10 01:49:49 eric Exp $
     1.9  # Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
    1.10  #
    1.11  # This program is free software; you can redistribute it and/or modify
    1.12 @@ -62,9 +62,8 @@
    1.13  TARGETS = t2p
    1.14  
    1.15  CSRCS = t2p.c semantics.c \
    1.16 -	bitblt.c bitblt_table_gen.c \
    1.17 -	pdf_g4.c pdf_g4_table_gen.c \
    1.18 -	pdf.c pdf_util.c pdf_prim.c pdf_bookmark.c pdf_name_tree.c
    1.19 +	bitblt.c bitblt_table_gen.c bitblt_g4.c g4_table_gen.c \
    1.20 +	pdf.c pdf_util.c pdf_prim.c pdf_bookmark.c pdf_name_tree.c pdf_g4.c
    1.21  OSRCS = scanner.l parser.y
    1.22  HDRS = t2p.h semantics.h bitblt.h \
    1.23  	pdf.h pdf_private.h pdf_util.h pdf_prim.h pdf_name_tree.h
    1.24 @@ -75,7 +74,7 @@
    1.25  
    1.26  
    1.27  AUTO_CSRCS = scanner.c parser.tab.c
    1.28 -AUTO_HDRS = parser.tab.h bitblt_tables.h pdf_g4_tables.h
    1.29 +AUTO_HDRS = parser.tab.h bitblt_tables.h g4_tables.h
    1.30  AUTO_MISC = parser.output
    1.31  
    1.32  
    1.33 @@ -85,9 +84,9 @@
    1.34  all: $(TARGETS) $(TEST_TARGETS)
    1.35  
    1.36  
    1.37 -t2p: t2p.o scanner.o semantics.o parser.tab.o bitblt.o \
    1.38 -		pdf_g4.o \
    1.39 -		pdf.o pdf_util.o pdf_prim.o pdf_bookmark.o pdf_name_tree.o
    1.40 +t2p: t2p.o scanner.o semantics.o parser.tab.o bitblt.o bitblt_g4.o \
    1.41 +		pdf.o pdf_util.o pdf_prim.o pdf_bookmark.o pdf_name_tree.o \
    1.42 +		pdf_g4.o
    1.43  	$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
    1.44  ifndef DEBUG
    1.45  	strip $@
    1.46 @@ -99,10 +98,10 @@
    1.47  
    1.48  bitblt_table_gen: bitblt_table_gen.o
    1.49  
    1.50 -pdf_g4_tables.h: pdf_g4_table_gen
    1.51 -	./pdf_g4_table_gen >pdf_g4_tables.h
    1.52 +g4_tables.h: g4_table_gen
    1.53 +	./g4_table_gen >g4_tables.h
    1.54  
    1.55 -pdf_g4_table_gen: pdf_g4_table_gen.o
    1.56 +g4_table_gen: g4_table_gen.o
    1.57  
    1.58  
    1.59  dist: $(DISTFILES)
     2.1 diff -r 4830f4d7ba7a -r e63762afae80 bitblt.h
     2.2 --- a/bitblt.h	Sat Mar 08 10:02:13 2003 +0000
     2.3 +++ b/bitblt.h	Mon Mar 10 09:49:50 2003 +0000
     2.4 @@ -4,7 +4,7 @@
     2.5   *      will be compressed using ITU-T T.6 (G4) fax encoding.
     2.6   *
     2.7   * bitblt routines
     2.8 - * $Id: bitblt.h,v 1.12 2003/02/23 09:40:41 eric Exp $
     2.9 + * $Id: bitblt.h,v 1.13 2003/03/10 01:49:50 eric Exp $
    2.10   * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
    2.11   *
    2.12   * This program is free software; you can redistribute it and/or modify
    2.13 @@ -128,3 +128,6 @@
    2.14  			     int32_t min_x, int32_t max_x,
    2.15  			     int32_t max_runs,
    2.16  			     run_t *runs);
    2.17 +
    2.18 +
    2.19 +void bitblt_write_g4 (Bitmap *bitmap, FILE *f);
     3.1 diff -r 4830f4d7ba7a -r e63762afae80 bitblt_g4.c
     3.2 --- a/bitblt_g4.c	Sat Mar 08 10:02:13 2003 +0000
     3.3 +++ b/bitblt_g4.c	Mon Mar 10 09:49:50 2003 +0000
     3.4 @@ -3,8 +3,8 @@
     3.5   *      bilevel image files.  The images in the resulting PDF file
     3.6   *      will be compressed using ITU-T T.6 (G4) fax encoding.
     3.7   *
     3.8 - * PDF routines
     3.9 - * $Id: bitblt_g4.c,v 1.8 2003/03/05 12:44:33 eric Exp $
    3.10 + * G4 compression
    3.11 + * $Id: bitblt_g4.c,v 1.9 2003/03/10 01:49:50 eric Exp $
    3.12   * Copyright 2003 Eric Smith <eric@brouhaha.com>
    3.13   *
    3.14   * This program is free software; you can redistribute it and/or modify
    3.15 @@ -32,108 +32,111 @@
    3.16  
    3.17  
    3.18  #include "bitblt.h"
    3.19 -#include "pdf.h"
    3.20 -#include "pdf_util.h"
    3.21 -#include "pdf_prim.h"
    3.22 -#include "pdf_private.h"
    3.23  
    3.24  
    3.25 -#include "pdf_g4_tables.h"
    3.26 -
    3.27 -
    3.28 -#define SWAP(type,a,b) do { type temp; temp = a; a = b; b = temp; } while (0)
    3.29 +#include "g4_tables.h"
    3.30  
    3.31  
    3.32 -struct pdf_g4_image
    3.33 +#define BIT_BUF_SIZE 4096
    3.34 +
    3.35 +struct bit_buffer
    3.36  {
    3.37 -  double width, height;
    3.38 -  double x, y;
    3.39 -  double r, g, b;  /* fill color, only for ImageMask */
    3.40 -  unsigned long Columns;
    3.41 -  unsigned long Rows;
    3.42 -  bool ImageMask;
    3.43 -  bool BlackIs1;
    3.44 -  Bitmap *bitmap;
    3.45 -  char XObject_name [4];
    3.46 +  FILE *f;
    3.47 +  uint32_t byte_idx;  /* index to next byte position in data buffer */
    3.48 +  uint32_t bit_idx;   /* index to next bit position in data buffer,
    3.49 +			 0 = MSB, 7 = LSB */
    3.50 +  uint8_t data [BIT_BUF_SIZE];
    3.51  };
    3.52  
    3.53  
    3.54 -char pdf_new_XObject (pdf_page_handle pdf_page, struct pdf_obj *ind_ref)
    3.55 +static void flush_bits (struct bit_buffer *buf)
    3.56  {
    3.57 -  char XObject_name [4] = "Im ";
    3.58 -
    3.59 -  XObject_name [2] = ++pdf_page->last_XObject_name;
    3.60 -  
    3.61 -  if (! pdf_page->XObject_dict)
    3.62 +  size_t s;
    3.63 +  if (buf->bit_idx)
    3.64      {
    3.65 -      pdf_page->XObject_dict = pdf_new_obj (PT_DICTIONARY);
    3.66 -      pdf_set_dict_entry (pdf_page->resources, "XObject", pdf_page->XObject_dict);
    3.67 +      /* zero remaining bits in last byte */
    3.68 +      buf->data [buf->byte_idx] &= ~ ((1 << (8 - buf->bit_idx)) - 1);
    3.69 +      buf->byte_idx++;
    3.70 +      buf->bit_idx = 0;
    3.71      }
    3.72 +  s = fwrite (& buf->data [0], 1, buf->byte_idx, buf->f);
    3.73 +  /* $$$ should check result */
    3.74 +  buf->byte_idx = 0;
    3.75 +}
    3.76  
    3.77 -  pdf_set_dict_entry (pdf_page->XObject_dict, & XObject_name [0], ind_ref);
    3.78  
    3.79 -  return (pdf_page->last_XObject_name);
    3.80 +static void advance_byte (struct bit_buffer *buf)
    3.81 +{
    3.82 +  buf->byte_idx++;
    3.83 +  buf->bit_idx = 0;
    3.84 +  if (buf->byte_idx == BIT_BUF_SIZE)
    3.85 +    flush_bits (buf);
    3.86  }
    3.87  
    3.88  
    3.89 -void pdf_write_g4_content_callback (pdf_file_handle pdf_file,
    3.90 -				    struct pdf_obj *stream,
    3.91 -				    void *app_data)
    3.92 +static void write_bits (struct bit_buffer *buf,
    3.93 +			uint32_t count,
    3.94 +			uint32_t bits)
    3.95  {
    3.96 -  struct pdf_g4_image *image = app_data;
    3.97 +  uint32_t b2;  /* how many bits will fit in byte in data buffer */
    3.98 +  uint32_t c2;  /* how many bits to transfer on this iteration */
    3.99 +  uint32_t d2;  /* bits to transfer on this iteration */
   3.100  
   3.101 -  /* transformation matrix is: width 0 0 height x y cm */
   3.102 -  pdf_stream_printf (pdf_file, stream, "q %g 0 0 %g %g %g cm ",
   3.103 -		     image->width, image->height,
   3.104 -		     image->x, image->y);
   3.105 -  if (image->ImageMask)
   3.106 -    pdf_stream_printf (pdf_file, stream, "%g %g %g rg ",
   3.107 -		       image->r, image->g, image->b);
   3.108 -
   3.109 -  pdf_stream_printf (pdf_file, stream, "/%s Do Q\r\n",
   3.110 -		     image->XObject_name);
   3.111 +  while (count)
   3.112 +    {
   3.113 +      b2 = 8 - buf->bit_idx;
   3.114 +      if (b2 >= count)
   3.115 +	c2 = count;
   3.116 +      else
   3.117 +	c2 = b2;
   3.118 +      d2 = bits >> (count - c2);
   3.119 +      buf->data [buf->byte_idx] |= (d2 << (b2 + c2));
   3.120 +      buf->bit_idx += c2;
   3.121 +      if (buf->bit_idx > 7)
   3.122 +	advance_byte (buf);
   3.123 +      count -= c2;
   3.124 +    }
   3.125  }
   3.126  
   3.127  
   3.128 -static void pdf_g4_encode_horizontal_run (pdf_file_handle pdf_file,
   3.129 -					  struct pdf_obj *stream,
   3.130 -					  bool black,
   3.131 -					  uint32_t run_length)
   3.132 +static void g4_encode_horizontal_run (struct bit_buffer *buf,
   3.133 +				      bool black,
   3.134 +				      uint32_t run_length)
   3.135  {
   3.136    uint32_t i;
   3.137  
   3.138    while (run_length >= 2560)
   3.139      {
   3.140 -      pdf_stream_write_bits (pdf_file, stream, 12, 0x01f);
   3.141 +      write_bits (buf, 12, 0x01f);
   3.142        run_length -= 2560;
   3.143      }
   3.144  
   3.145    if (run_length >= 1792)
   3.146      {
   3.147        i = (run_length - 1792) >> 6;
   3.148 -      pdf_stream_write_bits (pdf_file, stream,
   3.149 -			     g4_long_makeup_code [i].count,
   3.150 -			     g4_long_makeup_code [i].bits);
   3.151 +      write_bits (buf,
   3.152 +		  g4_long_makeup_code [i].count,
   3.153 +		  g4_long_makeup_code [i].bits);
   3.154        run_length -= (1792 + (i << 6));
   3.155      }
   3.156    else if (run_length >= 64)
   3.157      {
   3.158        i = (run_length >> 6) - 1;
   3.159 -      pdf_stream_write_bits (pdf_file, stream,
   3.160 -			     g4_makeup_code [black] [i].count,
   3.161 -			     g4_makeup_code [black] [i].bits);
   3.162 +      write_bits (buf,
   3.163 +		  g4_makeup_code [black] [i].count,
   3.164 +		  g4_makeup_code [black] [i].bits);
   3.165        run_length -= (i + 1) << 6;
   3.166      }
   3.167  
   3.168 -  pdf_stream_write_bits (pdf_file, stream,
   3.169 -			 g4_h_code [black] [run_length].count,
   3.170 -			 g4_h_code [black] [run_length].bits);
   3.171 +  write_bits (buf,
   3.172 +	      g4_h_code [black] [run_length].count,
   3.173 +	      g4_h_code [black] [run_length].bits);
   3.174  }
   3.175  
   3.176  
   3.177 -uint32_t find_transition (uint8_t *data,
   3.178 -			  uint32_t pos,
   3.179 -			  uint32_t width)
   3.180 +static uint32_t find_transition (uint8_t *data,
   3.181 +				 uint32_t pos,
   3.182 +				 uint32_t width)
   3.183  {
   3.184    if (! data)
   3.185      return (width);
   3.186 @@ -141,11 +144,10 @@
   3.187  }
   3.188  
   3.189  
   3.190 -static void pdf_g4_encode_row (pdf_file_handle pdf_file,
   3.191 -			       struct pdf_obj *stream,
   3.192 -			       uint32_t width,
   3.193 -			       uint8_t *ref,
   3.194 -			       uint8_t *row)
   3.195 +static void g4_encode_row (struct bit_buffer *buf,
   3.196 +			   uint32_t width,
   3.197 +			   uint8_t *ref,
   3.198 +			   uint8_t *row)
   3.199  {
   3.200    int a0, a1, a2;
   3.201    int b1, b2;
   3.202 @@ -167,152 +169,58 @@
   3.203        if (b2 < a1)
   3.204  	{
   3.205  	  /* pass mode - 0001 */
   3.206 -	  pdf_stream_write_bits (pdf_file, stream, 4, 0x1);
   3.207 +	  write_bits (buf, 4, 0x1);
   3.208  	  a0 = b2;
   3.209  	}
   3.210        else if (abs (a1 - b1) <= 3)
   3.211  	{
   3.212  	  /* vertical mode */
   3.213 -	  pdf_stream_write_bits (pdf_file, stream,
   3.214 -				 g4_vert_code [3 + a1 - b1].count,
   3.215 -				 g4_vert_code [3 + a1 - b1].bits);
   3.216 +	  write_bits (buf,
   3.217 +		      g4_vert_code [3 + a1 - b1].count,
   3.218 +		      g4_vert_code [3 + a1 - b1].bits);
   3.219  	  a0 = a1;
   3.220  	}
   3.221        else
   3.222  	{
   3.223  	  /* horizontal mode - 001 */
   3.224 -	  pdf_stream_write_bits (pdf_file, stream, 3, 0x1);
   3.225 -	  pdf_g4_encode_horizontal_run (pdf_file, stream,
   3.226 -					0 /* $$$ color (a0) */, a1 - a0);
   3.227 -	  pdf_g4_encode_horizontal_run (pdf_file, stream,
   3.228 -					1 /* $$$ color (a1) */, a2 - a1);
   3.229 +	  write_bits (buf, 3, 0x1);
   3.230 +	  g4_encode_horizontal_run (buf, 0 /* $$$ color (a0) */, a1 - a0);
   3.231 +	  g4_encode_horizontal_run (buf, 1 /* $$$ color (a1) */, a2 - a1);
   3.232  	  a0 = a2;
   3.233  	}
   3.234      }
   3.235  }
   3.236  
   3.237  
   3.238 -void pdf_write_g4_fax_image_callback (pdf_file_handle pdf_file,
   3.239 -				      struct pdf_obj *stream,
   3.240 -				      void *app_data)
   3.241 +void bitblt_write_g4 (Bitmap *bitmap, FILE *f)
   3.242  {
   3.243 -  struct pdf_g4_image *image = app_data;
   3.244 -
   3.245    uint32_t row;
   3.246 +  struct bit_buffer bb;
   3.247  
   3.248    word_type *ref_line = NULL;  /* reference (previous) row */
   3.249 -  word_type *line = image->bitmap->bits;
   3.250 +  word_type *line = bitmap->bits;
   3.251 +
   3.252 +  memset (& bb, 0, sizeof (bb));
   3.253  
   3.254 -  for (row = image->bitmap->rect.min.y;
   3.255 -       row < image->bitmap->rect.max.y;
   3.256 +  bb.f = f;
   3.257 +
   3.258 +  for (row = bitmap->rect.min.y;
   3.259 +       row < bitmap->rect.max.y;
   3.260         row++)
   3.261      {
   3.262 -      pdf_g4_encode_row (pdf_file, stream, image->Columns,
   3.263 -			 (uint8_t *) ref_line,
   3.264 -			 (uint8_t *) line);
   3.265 +      g4_encode_row (& bb,
   3.266 +		     (bitmap->rect.max.x - bitmap->rect.min.x) + 1,
   3.267 +		     (uint8_t *) ref_line,
   3.268 +		     (uint8_t *) line);
   3.269        ref_line = line;
   3.270 -      line += image->bitmap->row_words;
   3.271 +      line += bitmap->row_words;
   3.272      }
   3.273  
   3.274    
   3.275    /* write EOFB code */
   3.276 -  pdf_stream_write_bits (pdf_file, stream, 24, 0x001001);
   3.277 +  write_bits (& bb, 24, 0x001001);
   3.278  
   3.279 -  pdf_stream_flush_bits (pdf_file, stream);
   3.280 +  flush_bits (& bb);
   3.281  }
   3.282  
   3.283  
   3.284 -void pdf_write_g4_fax_image (pdf_page_handle pdf_page,
   3.285 -			     double x,
   3.286 -			     double y,
   3.287 -			     double width,
   3.288 -			     double height,
   3.289 -			     Bitmap *bitmap,
   3.290 -			     bool ImageMask,
   3.291 -			     double r, /* RGB fill color, only for ImageMask */
   3.292 -			     double g,
   3.293 -			     double b,
   3.294 -			     bool BlackIs1)          /* boolean, typ. false */
   3.295 -{
   3.296 -  struct pdf_g4_image *image;
   3.297 -
   3.298 -  struct pdf_obj *stream;
   3.299 -  struct pdf_obj *stream_dict;
   3.300 -  struct pdf_obj *decode_parms;
   3.301 -
   3.302 -  struct pdf_obj *content_stream;
   3.303 -
   3.304 -  image = pdf_calloc (1, sizeof (struct pdf_g4_image));
   3.305 -
   3.306 -  image->width = width;
   3.307 -  image->height = height;
   3.308 -  image->x = x;
   3.309 -  image->y = y;
   3.310 -  image->r = r;
   3.311 -  image->g = g;
   3.312 -  image->b = b;
   3.313 -
   3.314 -  image->bitmap = bitmap;
   3.315 -  image->Columns = bitmap->rect.max.x - bitmap->rect.min.x;
   3.316 -  image->Rows = bitmap->rect.max.y - bitmap->rect.min.y;
   3.317 -  image->ImageMask = ImageMask;
   3.318 -  image->BlackIs1 = BlackIs1;
   3.319 -
   3.320 -  stream_dict = pdf_new_obj (PT_DICTIONARY);
   3.321 -
   3.322 -  stream = pdf_new_ind_ref (pdf_page->pdf_file,
   3.323 -			    pdf_new_stream (pdf_page->pdf_file,
   3.324 -					    stream_dict,
   3.325 -					    & pdf_write_g4_fax_image_callback,
   3.326 -					    image));
   3.327 -
   3.328 -  strcpy (& image->XObject_name [0], "Im ");
   3.329 -  image->XObject_name [2] = pdf_new_XObject (pdf_page, stream);
   3.330 -
   3.331 -  pdf_set_dict_entry (stream_dict, "Type",    pdf_new_name ("XObject"));
   3.332 -  pdf_set_dict_entry (stream_dict, "Subtype", pdf_new_name ("Image"));
   3.333 -  pdf_set_dict_entry (stream_dict, "Name",    pdf_new_name (& image->XObject_name [0]));
   3.334 -  pdf_set_dict_entry (stream_dict, "Width",   pdf_new_integer (image->Columns));
   3.335 -  pdf_set_dict_entry (stream_dict, "Height",  pdf_new_integer (image->Rows));
   3.336 -  pdf_set_dict_entry (stream_dict, "BitsPerComponent", pdf_new_integer (1));
   3.337 -  if (ImageMask)
   3.338 -    pdf_set_dict_entry (stream_dict, "ImageMask", pdf_new_bool (ImageMask));
   3.339 -  else
   3.340 -    pdf_set_dict_entry (stream_dict, "ColorSpace", pdf_new_name ("DeviceGray"));
   3.341 -
   3.342 -  decode_parms = pdf_new_obj (PT_DICTIONARY);
   3.343 -
   3.344 -  pdf_set_dict_entry (decode_parms,
   3.345 -		      "K",
   3.346 -		      pdf_new_integer (-1));
   3.347 -
   3.348 -  pdf_set_dict_entry (decode_parms,
   3.349 -		      "Columns",
   3.350 -		      pdf_new_integer (image->Columns));
   3.351 -
   3.352 -  pdf_set_dict_entry (decode_parms,
   3.353 -		      "Rows",
   3.354 -		      pdf_new_integer (image->Rows));
   3.355 -
   3.356 -  if (BlackIs1)
   3.357 -    pdf_set_dict_entry (decode_parms,
   3.358 -			"BlackIs1",
   3.359 -			pdf_new_bool (BlackIs1));
   3.360 -
   3.361 -  pdf_stream_add_filter (stream, "CCITTFaxDecode", decode_parms);
   3.362 -
   3.363 -  /* the following will write the stream, using our callback function to
   3.364 -     get the actual data */
   3.365 -  pdf_write_ind_obj (pdf_page->pdf_file, stream);
   3.366 -
   3.367 -  content_stream = pdf_new_ind_ref (pdf_page->pdf_file,
   3.368 -				    pdf_new_stream (pdf_page->pdf_file,
   3.369 -						    pdf_new_obj (PT_DICTIONARY),
   3.370 -						    & pdf_write_g4_content_callback,
   3.371 -						    image));
   3.372 -
   3.373 -  pdf_set_dict_entry (pdf_page->page_dict, "Contents", content_stream);
   3.374 -
   3.375 -  pdf_write_ind_obj (pdf_page->pdf_file, content_stream);
   3.376 -}
   3.377 -
     4.1 diff -r 4830f4d7ba7a -r e63762afae80 pdf_g4.c
     4.2 --- a/pdf_g4.c	Sat Mar 08 10:02:13 2003 +0000
     4.3 +++ b/pdf_g4.c	Mon Mar 10 09:49:50 2003 +0000
     4.4 @@ -4,7 +4,7 @@
     4.5   *      will be compressed using ITU-T T.6 (G4) fax encoding.
     4.6   *
     4.7   * PDF routines
     4.8 - * $Id: pdf_g4.c,v 1.8 2003/03/05 12:44:33 eric Exp $
     4.9 + * $Id: pdf_g4.c,v 1.9 2003/03/10 01:49:50 eric Exp $
    4.10   * Copyright 2003 Eric Smith <eric@brouhaha.com>
    4.11   *
    4.12   * This program is free software; you can redistribute it and/or modify
    4.13 @@ -38,9 +38,6 @@
    4.14  #include "pdf_private.h"
    4.15  
    4.16  
    4.17 -#include "pdf_g4_tables.h"
    4.18 -
    4.19 -
    4.20  #define SWAP(type,a,b) do { type temp; temp = a; a = b; b = temp; } while (0)
    4.21  
    4.22  
    4.23 @@ -95,130 +92,13 @@
    4.24  }
    4.25  
    4.26  
    4.27 -static void pdf_g4_encode_horizontal_run (pdf_file_handle pdf_file,
    4.28 -					  struct pdf_obj *stream,
    4.29 -					  bool black,
    4.30 -					  uint32_t run_length)
    4.31 -{
    4.32 -  uint32_t i;
    4.33 -
    4.34 -  while (run_length >= 2560)
    4.35 -    {
    4.36 -      pdf_stream_write_bits (pdf_file, stream, 12, 0x01f);
    4.37 -      run_length -= 2560;
    4.38 -    }
    4.39 -
    4.40 -  if (run_length >= 1792)
    4.41 -    {
    4.42 -      i = (run_length - 1792) >> 6;
    4.43 -      pdf_stream_write_bits (pdf_file, stream,
    4.44 -			     g4_long_makeup_code [i].count,
    4.45 -			     g4_long_makeup_code [i].bits);
    4.46 -      run_length -= (1792 + (i << 6));
    4.47 -    }
    4.48 -  else if (run_length >= 64)
    4.49 -    {
    4.50 -      i = (run_length >> 6) - 1;
    4.51 -      pdf_stream_write_bits (pdf_file, stream,
    4.52 -			     g4_makeup_code [black] [i].count,
    4.53 -			     g4_makeup_code [black] [i].bits);
    4.54 -      run_length -= (i + 1) << 6;
    4.55 -    }
    4.56 -
    4.57 -  pdf_stream_write_bits (pdf_file, stream,
    4.58 -			 g4_h_code [black] [run_length].count,
    4.59 -			 g4_h_code [black] [run_length].bits);
    4.60 -}
    4.61 -
    4.62 -
    4.63 -uint32_t find_transition (uint8_t *data,
    4.64 -			  uint32_t pos,
    4.65 -			  uint32_t width)
    4.66 -{
    4.67 -  if (! data)
    4.68 -    return (width);
    4.69 -  return (0);  /* $$$ */
    4.70 -}
    4.71 -
    4.72 -
    4.73 -static void pdf_g4_encode_row (pdf_file_handle pdf_file,
    4.74 -			       struct pdf_obj *stream,
    4.75 -			       uint32_t width,
    4.76 -			       uint8_t *ref,
    4.77 -			       uint8_t *row)
    4.78 -{
    4.79 -  int a0, a1, a2;
    4.80 -  int b1, b2;
    4.81 -
    4.82 -  a0 = -1;
    4.83 -  
    4.84 -  while (a0 < width)
    4.85 -    {
    4.86 -      /* find a1, a2 */
    4.87 -      a1 = find_transition (row, a0, width);
    4.88 -      a2 = find_transition (row, a1, width);
    4.89 -
    4.90 -      /* find b1, b2 */
    4.91 -      b1 = find_transition (ref, a0, width);
    4.92 -      if (0) /* $$$ b1 color = a0 color */
    4.93 -	b1 = find_transition (ref, b1, width);
    4.94 -      b2 = find_transition (ref, b2, width);
    4.95 -
    4.96 -      if (b2 < a1)
    4.97 -	{
    4.98 -	  /* pass mode - 0001 */
    4.99 -	  pdf_stream_write_bits (pdf_file, stream, 4, 0x1);
   4.100 -	  a0 = b2;
   4.101 -	}
   4.102 -      else if (abs (a1 - b1) <= 3)
   4.103 -	{
   4.104 -	  /* vertical mode */
   4.105 -	  pdf_stream_write_bits (pdf_file, stream,
   4.106 -				 g4_vert_code [3 + a1 - b1].count,
   4.107 -				 g4_vert_code [3 + a1 - b1].bits);
   4.108 -	  a0 = a1;
   4.109 -	}
   4.110 -      else
   4.111 -	{
   4.112 -	  /* horizontal mode - 001 */
   4.113 -	  pdf_stream_write_bits (pdf_file, stream, 3, 0x1);
   4.114 -	  pdf_g4_encode_horizontal_run (pdf_file, stream,
   4.115 -					0 /* $$$ color (a0) */, a1 - a0);
   4.116 -	  pdf_g4_encode_horizontal_run (pdf_file, stream,
   4.117 -					1 /* $$$ color (a1) */, a2 - a1);
   4.118 -	  a0 = a2;
   4.119 -	}
   4.120 -    }
   4.121 -}
   4.122 -
   4.123 -
   4.124  void pdf_write_g4_fax_image_callback (pdf_file_handle pdf_file,
   4.125  				      struct pdf_obj *stream,
   4.126  				      void *app_data)
   4.127  {
   4.128    struct pdf_g4_image *image = app_data;
   4.129  
   4.130 -  uint32_t row;
   4.131 -
   4.132 -  word_type *ref_line = NULL;  /* reference (previous) row */
   4.133 -  word_type *line = image->bitmap->bits;
   4.134 -
   4.135 -  for (row = image->bitmap->rect.min.y;
   4.136 -       row < image->bitmap->rect.max.y;
   4.137 -       row++)
   4.138 -    {
   4.139 -      pdf_g4_encode_row (pdf_file, stream, image->Columns,
   4.140 -			 (uint8_t *) ref_line,
   4.141 -			 (uint8_t *) line);
   4.142 -      ref_line = line;
   4.143 -      line += image->bitmap->row_words;
   4.144 -    }
   4.145 -
   4.146 -  
   4.147 -  /* write EOFB code */
   4.148 -  pdf_stream_write_bits (pdf_file, stream, 24, 0x001001);
   4.149 -
   4.150 -  pdf_stream_flush_bits (pdf_file, stream);
   4.151 +  bitblt_write_g4 (image->bitmap, pdf_file->f);
   4.152  }
   4.153  
   4.154  
     5.1 diff -r 4830f4d7ba7a -r e63762afae80 pdf_g4_table_gen.c
     5.2 --- a/pdf_g4_table_gen.c	Sat Mar 08 10:02:13 2003 +0000
     5.3 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.4 @@ -1,284 +0,0 @@
     5.5 -/*
     5.6 - * t2p: Create a PDF file from the contents of one or more TIFF
     5.7 - *      bilevel image files.  The images in the resulting PDF file
     5.8 - *      will be compressed using ITU-T T.6 (G4) fax encoding.
     5.9 - *
    5.10 - * G4 table generator
    5.11 - * $Id: pdf_g4_table_gen.c,v 1.2 2003/03/05 12:44:33 eric Exp $
    5.12 - * Copyright 2003 Eric Smith <eric@brouhaha.com>
    5.13 - *
    5.14 - * This program is free software; you can redistribute it and/or modify
    5.15 - * it under the terms of the GNU General Public License version 2 as
    5.16 - * published by the Free Software Foundation.  Note that permission is
    5.17 - * not granted to redistribute this program under the terms of any
    5.18 - * other version of the General Public License.
    5.19 - *
    5.20 - * This program is distributed in the hope that it will be useful,
    5.21 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.22 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5.23 - * GNU General Public License for more details.
    5.24 - *
    5.25 - * You should have received a copy of the GNU General Public License
    5.26 - * along with this program; if not, write to the Free Software
    5.27 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
    5.28 - */
    5.29 -
    5.30 -
    5.31 -#include <stdbool.h>
    5.32 -#include <stdint.h>
    5.33 -#include <stdio.h>
    5.34 -#include <stdlib.h>
    5.35 -#include <string.h>
    5.36 -
    5.37 -
    5.38 -void emit_code (int indent, char *code, int last, bool comment, int cval)
    5.39 -{
    5.40 -  int i;
    5.41 -  int count = 0;
    5.42 -  uint32_t val = 0;
    5.43 -
    5.44 -  printf ("%*s{ ", indent, "");
    5.45 -
    5.46 -  printf ("%d, ", strlen (code));
    5.47 -
    5.48 -  for (i = 0; i < strlen (code); i++)
    5.49 -    switch (code [i])
    5.50 -      {
    5.51 -      case '0': val = (val << 1);     count++; break;
    5.52 -      case '1': val = (val << 1) + 1; count++; break;
    5.53 -      case ' ': break;
    5.54 -      default:
    5.55 -	fprintf (stderr, "internal error\n");
    5.56 -	exit (2);
    5.57 -      }
    5.58 -
    5.59 -  printf ("0x%0*x", (count + 3)/4, val);
    5.60 -
    5.61 -  printf (" }");
    5.62 -  if (! last)
    5.63 -    printf (",");
    5.64 -  if (comment)
    5.65 -    printf ("  /* %d */", cval);
    5.66 -  printf ("\n");
    5.67 -}
    5.68 -
    5.69 -
    5.70 -char *long_makeup_code [12] =
    5.71 -  {
    5.72 -    /* 1792 */ "00000001000",
    5.73 -    /* 1856 */ "00000001100",
    5.74 -    /* 1920 */ "00000001101",
    5.75 -    /* 1984 */ "000000010010",
    5.76 -    /* 2048 */ "000000010011",
    5.77 -    /* 2112 */ "000000010100",
    5.78 -    /* 2176 */ "000000010101",
    5.79 -    /* 2240 */ "000000010110",
    5.80 -    /* 2304 */ "000000010111",
    5.81 -    /* 2368 */ "000000011100",
    5.82 -    /* 2432 */ "000000011101",
    5.83 -    /* 2496 */ "000000011110"
    5.84 -    /* 2560    "000000011111"  hard-coded, doesn't need to be in table */
    5.85 -  };
    5.86 -
    5.87 -
    5.88 -void print_long_makeup_code (void)
    5.89 -{
    5.90 -  int i;
    5.91 -
    5.92 -  printf ("static g4_bits g4_long_makeup_code [12] =\n");
    5.93 -  printf ("  {\n");
    5.94 -  for (i = 0; i < 12; i++)
    5.95 -    emit_code (4, long_makeup_code [i], i == 11, 1, i * 64 + 1792);
    5.96 -  printf ("  };\n");
    5.97 -}
    5.98 -
    5.99 -
   5.100 -char *makeup_code [64][2] =
   5.101 -  {
   5.102 -    { /*   64 */ "11011",     "0000001111" },
   5.103 -    { /*  128 */ "10010",     "000011001000" },
   5.104 -    { /*  192 */ "010111",    "000011001001" },
   5.105 -    { /*  256 */ "0110111",   "000001011011" },
   5.106 -    { /*  320 */ "00110110",  "000000110011" },
   5.107 -    { /*  384 */ "00110111",  "000000110100" },
   5.108 -    { /*  448 */ "01100100",  "000000110101" },
   5.109 -    { /*  512 */ "01100101",  "0000001101100" },
   5.110 -    { /*  576 */ "01101000",  "0000001101101" },
   5.111 -    { /*  640 */ "01100111",  "0000001001010" },
   5.112 -    { /*  704 */ "011001100", "0000001001011" },
   5.113 -    { /*  768 */ "011001101", "0000001001100" },
   5.114 -    { /*  832 */ "011010010", "0000001001101" },
   5.115 -    { /*  896 */ "011010011", "0000001110010" },
   5.116 -    { /*  960 */ "011010100", "0000001110011" },
   5.117 -    { /* 1024 */ "011010101", "0000001110100" },
   5.118 -    { /* 1088 */ "011010110", "0000001110101" },
   5.119 -    { /* 1152 */ "011010111", "0000001110110" },
   5.120 -    { /* 1216 */ "011011000", "0000001110111" },
   5.121 -    { /* 1280 */ "011011001", "0000001010010" },
   5.122 -    { /* 1344 */ "011011010", "0000001010011" },
   5.123 -    { /* 1408 */ "011011011", "0000001010100" },
   5.124 -    { /* 1472 */ "010011000", "0000001010101" },
   5.125 -    { /* 1536 */ "010011001", "0000001011010" },
   5.126 -    { /* 1600 */ "010011010", "0000001011011" },
   5.127 -    { /* 1664 */ "011000",    "0000001100100" },
   5.128 -    { /* 1728 */ "010011011", "0000001100101" }
   5.129 -  };
   5.130 -
   5.131 -
   5.132 -void print_makeup_code (void)
   5.133 -{
   5.134 -  int i;
   5.135 -
   5.136 -  printf ("static g4_bits g4_makeup_code [2] [27] =\n");
   5.137 -  printf ("  {\n");
   5.138 -  printf ("    {\n");
   5.139 -  printf ("      /* white */\n");
   5.140 -  for (i = 0; i <= 26; i++)
   5.141 -    emit_code (6, makeup_code [i][0], i == 26, 1, (i + 1) * 64);
   5.142 -  printf ("    },\n");
   5.143 -  printf ("    {\n");
   5.144 -  printf ("      /* black */\n");
   5.145 -  for (i = 0; i <= 26; i++)
   5.146 -    emit_code (6, makeup_code [i][1], i == 26, 1, (i + 1) * 64);
   5.147 -  printf ("    }\n");
   5.148 -  printf ("  };\n");
   5.149 -}
   5.150 -
   5.151 -
   5.152 -char *h_code [64][2] =
   5.153 -  {
   5.154 -    { /*  0 */ "00110101", "0000110111" },
   5.155 -    { /*  1 */ "000111",   "010" },
   5.156 -    { /*  2 */ "0111",     "11" },
   5.157 -    { /*  3 */ "1000",     "10" },
   5.158 -    { /*  4 */ "1011",     "011" },
   5.159 -    { /*  5 */ "1100",     "0011" },
   5.160 -    { /*  6 */ "1110",     "0010" },
   5.161 -    { /*  7 */ "1111",     "00011" },
   5.162 -    { /*  8 */ "10011",    "000101" },
   5.163 -    { /*  9 */ "10100",    "000100" },
   5.164 -    { /* 10 */ "00111",    "0000100" },
   5.165 -    { /* 11 */ "01000",    "0000101" },
   5.166 -    { /* 12 */ "001000",   "0000111" },
   5.167 -    { /* 13 */ "000011",   "00000100" },
   5.168 -    { /* 14 */ "110100",   "00000111" },
   5.169 -    { /* 15 */ "110101",   "000011000" },
   5.170 -    { /* 16 */ "101010",   "0000010111" },
   5.171 -    { /* 17 */ "101011",   "0000011000" },
   5.172 -    { /* 18 */ "0100111",  "0000001000" },
   5.173 -    { /* 19 */ "0001100",  "00001100111" },
   5.174 -    { /* 20 */ "0001000",  "00001101000" },
   5.175 -    { /* 21 */ "0010111",  "00001101100" },
   5.176 -    { /* 22 */ "0000011",  "00000110111" },
   5.177 -    { /* 23 */ "0000100",  "00000101000" },
   5.178 -    { /* 24 */ "0101000",  "00000010111" },
   5.179 -    { /* 25 */ "0101011",  "00000011000" },
   5.180 -    { /* 26 */ "0010011",  "000011001010" },
   5.181 -    { /* 27 */ "0100100",  "000011001011" },
   5.182 -    { /* 28 */ "0011000",  "000011001100" },
   5.183 -    { /* 29 */ "00000010", "000011001101" },
   5.184 -    { /* 30 */ "00000011", "000001101000" },
   5.185 -    { /* 31 */ "00011010", "000001101001" },
   5.186 -    { /* 32 */ "00011011", "000001101010" },
   5.187 -    { /* 33 */ "00010010", "000001101011" },
   5.188 -    { /* 34 */ "00010011", "000011010010" },
   5.189 -    { /* 35 */ "00010100", "000011010011" },
   5.190 -    { /* 36 */ "00010101", "000011010100" },
   5.191 -    { /* 37 */ "00010110", "000011010101" },
   5.192 -    { /* 38 */ "00010111", "000011010110" },
   5.193 -    { /* 39 */ "00101000", "000011010111" },
   5.194 -    { /* 40 */ "00101001", "000001101100" },
   5.195 -    { /* 41 */ "00101010", "000001101101" },
   5.196 -    { /* 42 */ "00101011", "000011011010" },
   5.197 -    { /* 43 */ "00101100", "000011011011" },
   5.198 -    { /* 44 */ "00101101", "000001010100" },
   5.199 -    { /* 45 */ "00000100", "000001010101" },
   5.200 -    { /* 46 */ "00000101", "000001010110" },
   5.201 -    { /* 47 */ "00001010", "000001010111" },
   5.202 -    { /* 48 */ "00001011", "000001100100" },
   5.203 -    { /* 49 */ "01010010", "000001100101" },
   5.204 -    { /* 50 */ "01010011", "000001010010" },
   5.205 -    { /* 51 */ "01010100", "000001010011" },
   5.206 -    { /* 52 */ "01010101", "000000100100" },
   5.207 -    { /* 53 */ "00100100", "000000110111" },
   5.208 -    { /* 54 */ "00100101", "000000111000" },
   5.209 -    { /* 55 */ "01011000", "000000100111" },
   5.210 -    { /* 56 */ "01011001", "000000101000" },
   5.211 -    { /* 57 */ "01011010", "000001011000" },
   5.212 -    { /* 58 */ "01011011", "000001011001" },
   5.213 -    { /* 59 */ "01001010", "000000101011" },
   5.214 -    { /* 60 */ "01001011", "000000101100" },
   5.215 -    { /* 61 */ "00110010", "000001011010" },
   5.216 -    { /* 62 */ "00110011", "000001100110" },
   5.217 -    { /* 63 */ "00110100", "000001100111" }
   5.218 -  };
   5.219 -
   5.220 -
   5.221 -void print_h_code (void)
   5.222 -{
   5.223 -  int i;
   5.224 -
   5.225 -  printf ("static g4_bits g4_h_code [2] [64] =\n");
   5.226 -  printf ("  {\n");
   5.227 -  printf ("    {\n");
   5.228 -  printf ("      /* white */\n");
   5.229 -  for (i = 0; i <= 63; i++)
   5.230 -    emit_code (6, h_code [i][0], i == 63, 1, i);
   5.231 -  printf ("    },\n");
   5.232 -  printf ("    {\n");
   5.233 -  printf ("      /* black */\n");
   5.234 -  for (i = 0; i <= 63; i++)
   5.235 -    emit_code (6, h_code [i][1], i == 63, 1, i);
   5.236 -  printf ("    }\n");
   5.237 -  printf ("  };\n");
   5.238 -}
   5.239 -
   5.240 -
   5.241 -char *v_code [7] =
   5.242 -  {
   5.243 -    /* -3 */ "0000010",
   5.244 -    /* -2 */ "000010",
   5.245 -    /* -1 */ "010",
   5.246 -    /*  0 */ "1",
   5.247 -    /*  1 */ "011",
   5.248 -    /*  2 */ "000011",
   5.249 -    /*  3 */ "0000011"
   5.250 -  };
   5.251 -
   5.252 -
   5.253 -void print_v_code (void)
   5.254 -{
   5.255 -  int i;
   5.256 -
   5.257 -  printf ("static g4_bits g4_vert_code [7] =\n");
   5.258 -  printf ("  {\n");
   5.259 -  for (i = 0; i <= 6; i++)
   5.260 -    emit_code (4, v_code [i], i == 6, 1, i - 3);
   5.261 -  printf ("  };\n");
   5.262 -}
   5.263 -
   5.264 -
   5.265 -int main (int argc, char *argv [])
   5.266 -{
   5.267 -  printf ("/* This file is automatically generated; do not edit */\n");
   5.268 -  printf ("\n");
   5.269 -  printf ("typedef struct\n");
   5.270 -  printf ("{\n");
   5.271 -  printf ("  uint32_t count;\n");
   5.272 -  printf ("  uint32_t bits;\n");
   5.273 -  printf ("} g4_bits;\n");
   5.274 -  printf ("\n");
   5.275 -
   5.276 -  print_long_makeup_code ();
   5.277 -  printf ("\n");
   5.278 -
   5.279 -  print_makeup_code ();
   5.280 -  printf ("\n");
   5.281 -
   5.282 -  print_h_code ();
   5.283 -  printf ("\n");
   5.284 -
   5.285 -  print_v_code ();
   5.286 -
   5.287 -  exit (0);
   5.288 -}
     6.1 diff -r 4830f4d7ba7a -r e63762afae80 pdf_prim.c
     6.2 --- a/pdf_prim.c	Sat Mar 08 10:02:13 2003 +0000
     6.3 +++ b/pdf_prim.c	Mon Mar 10 09:49:50 2003 +0000
     6.4 @@ -4,7 +4,7 @@
     6.5   *      will be compressed using ITU-T T.6 (G4) fax encoding.
     6.6   *
     6.7   * PDF routines
     6.8 - * $Id: pdf_prim.c,v 1.7 2003/03/07 03:02:31 eric Exp $
     6.9 + * $Id: pdf_prim.c,v 1.8 2003/03/10 01:49:50 eric Exp $
    6.10   * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
    6.11   *
    6.12   * This program is free software; you can redistribute it and/or modify
    6.13 @@ -66,8 +66,6 @@
    6.14  };
    6.15  
    6.16  
    6.17 -#define STREAM_BUF_SIZE 4096
    6.18 -
    6.19  struct pdf_stream
    6.20  {
    6.21    struct pdf_obj *stream_dict;
    6.22 @@ -76,13 +74,6 @@
    6.23    void *app_data;  /* arg to pass to callback */
    6.24    struct pdf_obj *filters;  /* name or array of names */
    6.25    struct pdf_obj *decode_parms;
    6.26 -
    6.27 -  /* The following fields are used by pdf_stream_write_bits() and
    6.28 -     pdf_stream_flush_bits(). */
    6.29 -  uint32_t byte_idx;  /* index to next byte position in data buffer */
    6.30 -  uint32_t bit_idx;   /* index to next bit position in data buffer,
    6.31 -			 0 = MSB, 7 = LSB */
    6.32 -  uint8_t data [STREAM_BUF_SIZE];
    6.33  };
    6.34  
    6.35  
    6.36 @@ -494,65 +485,6 @@
    6.37  }
    6.38  
    6.39  
    6.40 -void pdf_stream_flush_bits (pdf_file_handle pdf_file,
    6.41 -			    struct pdf_obj *stream)
    6.42 -{
    6.43 -  struct pdf_stream *s = & stream->val.stream;
    6.44 -
    6.45 -  if (s->bit_idx)
    6.46 -    {
    6.47 -      /* zero remaining bits in last byte */
    6.48 -      s->data [s->byte_idx] &= ~ ((1 << (8 - s->bit_idx)) - 1);
    6.49 -      s->byte_idx++;
    6.50 -      s->bit_idx = 0;
    6.51 -    }
    6.52 -  pdf_stream_write_data (pdf_file, stream, 
    6.53 -			 (char *) & s->data [0],
    6.54 -			 s->byte_idx);
    6.55 -  s->byte_idx = 0;
    6.56 -}
    6.57 -
    6.58 -
    6.59 -static void pdf_stream_advance_byte (pdf_file_handle pdf_file,
    6.60 -				     struct pdf_obj *stream)
    6.61 -{
    6.62 -  struct pdf_stream *s = & stream->val.stream;
    6.63 -
    6.64 -  s->byte_idx++;
    6.65 -  s->bit_idx = 0;
    6.66 -  if (s->byte_idx == STREAM_BUF_SIZE)
    6.67 -    pdf_stream_flush_bits (pdf_file, stream);
    6.68 -}
    6.69 -
    6.70 -
    6.71 -void pdf_stream_write_bits (pdf_file_handle pdf_file,
    6.72 -			    struct pdf_obj *stream,
    6.73 -			    uint32_t count,
    6.74 -			    uint32_t bits)
    6.75 -{
    6.76 -  struct pdf_stream *s = & stream->val.stream;
    6.77 -
    6.78 -  uint32_t b2;  /* how many bits will fit in byte in data buffer */
    6.79 -  uint32_t c2;  /* how many bits to transfer on this iteration */
    6.80 -  uint32_t d2;  /* bits to transfer on this iteration */
    6.81 -
    6.82 -  while (count)
    6.83 -    {
    6.84 -      b2 = 8 - s->bit_idx;
    6.85 -      if (b2 >= count)
    6.86 -	c2 = count;
    6.87 -      else
    6.88 -	c2 = b2;
    6.89 -      d2 = bits >> (count - c2);
    6.90 -      s->data [s->byte_idx] |= (d2 << (b2 + c2));
    6.91 -      s->bit_idx += c2;
    6.92 -      if (s->bit_idx > 7)
    6.93 -	pdf_stream_advance_byte (pdf_file, stream);
    6.94 -      count -= c2;
    6.95 -    }
    6.96 -}
    6.97 -
    6.98 -
    6.99  void pdf_stream_printf (pdf_file_handle pdf_file,
   6.100  			struct pdf_obj *stream,
   6.101  			char *fmt, ...)
     7.1 diff -r 4830f4d7ba7a -r e63762afae80 pdf_prim.h
     7.2 --- a/pdf_prim.h	Sat Mar 08 10:02:13 2003 +0000
     7.3 +++ b/pdf_prim.h	Mon Mar 10 09:49:50 2003 +0000
     7.4 @@ -4,7 +4,7 @@
     7.5   *      will be compressed using ITU-T T.6 (G4) fax encoding.
     7.6   *
     7.7   * PDF routines
     7.8 - * $Id: pdf_prim.h,v 1.6 2003/03/07 03:02:31 eric Exp $
     7.9 + * $Id: pdf_prim.h,v 1.7 2003/03/10 01:49:50 eric Exp $
    7.10   * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
    7.11   *
    7.12   * This program is free software; you can redistribute it and/or modify
    7.13 @@ -99,15 +99,8 @@
    7.14  				pdf_stream_write_callback callback,
    7.15  				void *app_data);
    7.16  
    7.17 -/* The callback should call pdf_stream_write_bits(), pdf_stream_write_data(),
    7.18 -   or pdf_stream_printf() to write the actual stream data.  If
    7.19 -   pdf_stream_write_bits() is used, pdf_stream_flush_bits() should be
    7.20 -   called after all the bits are written.  */
    7.21 -
    7.22 -void pdf_stream_write_bits (pdf_file_handle pdf_file,
    7.23 -			    struct pdf_obj *stream,
    7.24 -			    uint32_t count,
    7.25 -			    uint32_t bits);
    7.26 +/* The callback should call pdf_stream_write_data() or pdf_stream_printf()
    7.27 +   to write the actual stream data. */
    7.28  
    7.29  void pdf_stream_flush_bits (pdf_file_handle pdf_file,
    7.30  			    struct pdf_obj *stream);