bitblt_g4.c

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