added image position and size arguments to pdf_write_g4_fax_image.

Fri, 21 Feb 2003 09:01:33 +0000

author
eric
date
Fri, 21 Feb 2003 09:01:33 +0000
changeset 64
151394412eba
parent 63
6eddf63aa517
child 65
5acb5b549729

added image position and size arguments to pdf_write_g4_fax_image.

bitblt_g4.c file | annotate | diff | revisions
pdf.h file | annotate | diff | revisions
pdf_g4.c file | annotate | diff | revisions
t2p.c file | annotate | diff | revisions
tumble.c file | annotate | diff | revisions
     1.1 diff -r 6eddf63aa517 -r 151394412eba bitblt_g4.c
     1.2 --- a/bitblt_g4.c	Fri Feb 21 08:49:11 2003 +0000
     1.3 +++ b/bitblt_g4.c	Fri Feb 21 09:01:33 2003 +0000
     1.4 @@ -4,7 +4,7 @@
     1.5   *      will be compressed using ITU-T T.6 (G4) fax encoding.
     1.6   *
     1.7   * PDF routines
     1.8 - * $Id: bitblt_g4.c,v 1.3 2003/02/20 04:44:17 eric Exp $
     1.9 + * $Id: bitblt_g4.c,v 1.4 2003/02/21 01:01:33 eric Exp $
    1.10   * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
    1.11   *
    1.12   * This program is free software; you can redistribute it and/or modify
    1.13 @@ -39,6 +39,8 @@
    1.14  
    1.15  struct pdf_g4_image
    1.16  {
    1.17 +  double width, height;
    1.18 +  double x, y;
    1.19    unsigned long Columns;
    1.20    unsigned long Rows;
    1.21    int BlackIs1;
    1.22 @@ -69,18 +71,16 @@
    1.23  				    struct pdf_obj *stream,
    1.24  				    void *app_data)
    1.25  {
    1.26 -  unsigned long width = (8.5 * 72);  /* full width of page */
    1.27 -  unsigned long height = (11 * 72);  /* full height of page */
    1.28 -  unsigned long x = 0;  /* 0 is left edge */
    1.29 -  unsigned long y = 0;  /* 0 is bottom edge */
    1.30    struct pdf_g4_image *image = app_data;
    1.31  
    1.32    char str1 [100];
    1.33    char *str2 = "/";
    1.34 -  char *str3 = " Do\r\n";
    1.35 +  char *str3 = " Do Q\r\n";
    1.36  
    1.37    /* width 0 0 height x y cm */
    1.38 -  sprintf (str1, "q %ld 0 0 %ld %ld %ld cm\r\n", width, height, x, y);
    1.39 +  sprintf (str1, "q %g 0 0 %g %g %g cm\r\n",
    1.40 +	   image->width, image->height,
    1.41 +	   image->x, image->y);
    1.42  
    1.43    pdf_stream_write_data (pdf_file, stream, str1, strlen (str1));
    1.44    pdf_stream_write_data (pdf_file, stream, str2, strlen (str2));
    1.45 @@ -108,7 +108,7 @@
    1.46  
    1.47    while (row < image->Rows)
    1.48      {
    1.49 -      pdf_stream_write_data (pdf_file, stream, raw,
    1.50 +      pdf_stream_write_data (pdf_file, stream, (uint8_t *) raw,
    1.51  			     image->bitmap->row_words * sizeof (word_type));
    1.52  
    1.53        row++;
    1.54 @@ -122,6 +122,10 @@
    1.55  
    1.56  
    1.57  void pdf_write_g4_fax_image (pdf_page_handle pdf_page,
    1.58 +			     double x,
    1.59 +			     double y,
    1.60 +			     double width,
    1.61 +			     double height,
    1.62  			     Bitmap *bitmap,
    1.63  			     int ImageMask,
    1.64  			     int BlackIs1)          /* boolean, typ. false */
    1.65 @@ -136,6 +140,11 @@
    1.66  
    1.67    image = pdf_calloc (sizeof (struct pdf_g4_image));
    1.68  
    1.69 +  image->width = width;
    1.70 +  image->height = height;
    1.71 +  image->x = x;
    1.72 +  image->y = y;
    1.73 +
    1.74    image->bitmap = bitmap;
    1.75    image->Columns = bitmap->rect.max.x - bitmap->rect.min.x;
    1.76    image->Rows = bitmap->rect.max.y - bitmap->rect.min.y;
     2.1 diff -r 6eddf63aa517 -r 151394412eba pdf.h
     2.2 --- a/pdf.h	Fri Feb 21 08:49:11 2003 +0000
     2.3 +++ b/pdf.h	Fri Feb 21 09:01:33 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   * PDF routines
     2.8 - * $Id: pdf.h,v 1.2 2003/02/20 04:44:17 eric Exp $
     2.9 + * $Id: pdf.h,v 1.3 2003/02/21 01:01:33 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 @@ -54,6 +54,10 @@
    2.14     Note that rowbytes must be at least (Columns+7)/8, but may be arbitrarily
    2.15     large. */
    2.16  void pdf_write_g4_fax_image (pdf_page_handle pdf_page,
    2.17 +			     double x,
    2.18 +			     double y,
    2.19 +			     double width,
    2.20 +			     double height,
    2.21  			     Bitmap *bitmap,
    2.22  			     int ImageMask,
    2.23  			     int BlackIs1);    /* boolean, typ. false */
     3.1 diff -r 6eddf63aa517 -r 151394412eba pdf_g4.c
     3.2 --- a/pdf_g4.c	Fri Feb 21 08:49:11 2003 +0000
     3.3 +++ b/pdf_g4.c	Fri Feb 21 09:01:33 2003 +0000
     3.4 @@ -4,7 +4,7 @@
     3.5   *      will be compressed using ITU-T T.6 (G4) fax encoding.
     3.6   *
     3.7   * PDF routines
     3.8 - * $Id: pdf_g4.c,v 1.3 2003/02/20 04:44:17 eric Exp $
     3.9 + * $Id: pdf_g4.c,v 1.4 2003/02/21 01:01:33 eric Exp $
    3.10   * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
    3.11   *
    3.12   * This program is free software; you can redistribute it and/or modify
    3.13 @@ -39,6 +39,8 @@
    3.14  
    3.15  struct pdf_g4_image
    3.16  {
    3.17 +  double width, height;
    3.18 +  double x, y;
    3.19    unsigned long Columns;
    3.20    unsigned long Rows;
    3.21    int BlackIs1;
    3.22 @@ -69,18 +71,16 @@
    3.23  				    struct pdf_obj *stream,
    3.24  				    void *app_data)
    3.25  {
    3.26 -  unsigned long width = (8.5 * 72);  /* full width of page */
    3.27 -  unsigned long height = (11 * 72);  /* full height of page */
    3.28 -  unsigned long x = 0;  /* 0 is left edge */
    3.29 -  unsigned long y = 0;  /* 0 is bottom edge */
    3.30    struct pdf_g4_image *image = app_data;
    3.31  
    3.32    char str1 [100];
    3.33    char *str2 = "/";
    3.34 -  char *str3 = " Do\r\n";
    3.35 +  char *str3 = " Do Q\r\n";
    3.36  
    3.37    /* width 0 0 height x y cm */
    3.38 -  sprintf (str1, "q %ld 0 0 %ld %ld %ld cm\r\n", width, height, x, y);
    3.39 +  sprintf (str1, "q %g 0 0 %g %g %g cm\r\n",
    3.40 +	   image->width, image->height,
    3.41 +	   image->x, image->y);
    3.42  
    3.43    pdf_stream_write_data (pdf_file, stream, str1, strlen (str1));
    3.44    pdf_stream_write_data (pdf_file, stream, str2, strlen (str2));
    3.45 @@ -108,7 +108,7 @@
    3.46  
    3.47    while (row < image->Rows)
    3.48      {
    3.49 -      pdf_stream_write_data (pdf_file, stream, raw,
    3.50 +      pdf_stream_write_data (pdf_file, stream, (uint8_t *) raw,
    3.51  			     image->bitmap->row_words * sizeof (word_type));
    3.52  
    3.53        row++;
    3.54 @@ -122,6 +122,10 @@
    3.55  
    3.56  
    3.57  void pdf_write_g4_fax_image (pdf_page_handle pdf_page,
    3.58 +			     double x,
    3.59 +			     double y,
    3.60 +			     double width,
    3.61 +			     double height,
    3.62  			     Bitmap *bitmap,
    3.63  			     int ImageMask,
    3.64  			     int BlackIs1)          /* boolean, typ. false */
    3.65 @@ -136,6 +140,11 @@
    3.66  
    3.67    image = pdf_calloc (sizeof (struct pdf_g4_image));
    3.68  
    3.69 +  image->width = width;
    3.70 +  image->height = height;
    3.71 +  image->x = x;
    3.72 +  image->y = y;
    3.73 +
    3.74    image->bitmap = bitmap;
    3.75    image->Columns = bitmap->rect.max.x - bitmap->rect.min.x;
    3.76    image->Rows = bitmap->rect.max.y - bitmap->rect.min.y;
     4.1 diff -r 6eddf63aa517 -r 151394412eba t2p.c
     4.2 --- a/t2p.c	Fri Feb 21 08:49:11 2003 +0000
     4.3 +++ b/t2p.c	Fri Feb 21 09:01:33 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   * Main program
     4.8 - * $Id: t2p.c,v 1.22 2003/02/20 04:44:17 eric Exp $
     4.9 + * $Id: t2p.c,v 1.23 2003/02/21 01:01:33 eric Exp $
    4.10   * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
    4.11   *
    4.12   * This program is free software; you can redistribute it and/or modify
    4.13 @@ -465,6 +465,10 @@
    4.14    page = pdf_new_page (out->pdf, width_points, height_points);
    4.15  
    4.16    pdf_write_g4_fax_image (page,
    4.17 +			  0,  /* x */
    4.18 +			  0,  /* y */
    4.19 +			  width_points,
    4.20 +			  height_points,
    4.21  			  bitmap,
    4.22  			  0, /* ImageMask */
    4.23  			  0); /* BlackIs1 */
     5.1 diff -r 6eddf63aa517 -r 151394412eba tumble.c
     5.2 --- a/tumble.c	Fri Feb 21 08:49:11 2003 +0000
     5.3 +++ b/tumble.c	Fri Feb 21 09:01:33 2003 +0000
     5.4 @@ -4,7 +4,7 @@
     5.5   *      will be compressed using ITU-T T.6 (G4) fax encoding.
     5.6   *
     5.7   * Main program
     5.8 - * $Id: tumble.c,v 1.22 2003/02/20 04:44:17 eric Exp $
     5.9 + * $Id: tumble.c,v 1.23 2003/02/21 01:01:33 eric Exp $
    5.10   * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
    5.11   *
    5.12   * This program is free software; you can redistribute it and/or modify
    5.13 @@ -465,6 +465,10 @@
    5.14    page = pdf_new_page (out->pdf, width_points, height_points);
    5.15  
    5.16    pdf_write_g4_fax_image (page,
    5.17 +			  0,  /* x */
    5.18 +			  0,  /* y */
    5.19 +			  width_points,
    5.20 +			  height_points,
    5.21  			  bitmap,
    5.22  			  0, /* ImageMask */
    5.23  			  0); /* BlackIs1 */