bitblt_g4.c

changeset 64
151394412eba
parent 62
9bd354b83e16
child 66
6e0551b59dba
     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;