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