added color, width_samples, height_samples areguments to pdf_write_jpeg_image().

Thu, 20 Mar 2003 07:53:09 +0000

author
eric
date
Thu, 20 Mar 2003 07:53:09 +0000
changeset 147
090af3709920
parent 146
4854a8183ae3
child 148
d4a6e303703a

added color, width_samples, height_samples areguments to pdf_write_jpeg_image().

pdf.h file | annotate | diff | revisions
pdf_jpeg.c file | annotate | diff | revisions
tumble_jpeg.c file | annotate | diff | revisions
     1.1 --- a/pdf.h	Thu Mar 20 07:52:25 2003 +0000
     1.2 +++ b/pdf.h	Thu Mar 20 07:53:09 2003 +0000
     1.3 @@ -2,7 +2,7 @@
     1.4   * tumble: build a PDF file from image files
     1.5   *
     1.6   * PDF routines
     1.7 - * $Id: pdf.h,v 1.12 2003/03/19 22:54:07 eric Exp $
     1.8 + * $Id: pdf.h,v 1.13 2003/03/19 23:53:09 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 @@ -22,7 +22,8 @@
    1.13   */
    1.14  
    1.15  
    1.16 -#define POINTS_PER_INCH 72
    1.17 +/* Acrobat default units aren't really points, but they're close. */
    1.18 +#define POINTS_PER_INCH 72.0
    1.19  
    1.20  /* page size limited by Acrobat Reader to 45 inches on a side */
    1.21  #define PAGE_MAX_INCHES 45
    1.22 @@ -86,6 +87,9 @@
    1.23  			   double y,
    1.24  			   double width,
    1.25  			   double height,
    1.26 +			   bool color,
    1.27 +			   uint32_t width_samples,
    1.28 +			   uint32_t height_samples,
    1.29  			   FILE *f);
    1.30  
    1.31  
     2.1 --- a/pdf_jpeg.c	Thu Mar 20 07:52:25 2003 +0000
     2.2 +++ b/pdf_jpeg.c	Thu Mar 20 07:53:09 2003 +0000
     2.3 @@ -2,7 +2,7 @@
     2.4   * tumble: build a PDF file from image files
     2.5   *
     2.6   * PDF routines
     2.7 - * $Id: pdf_jpeg.c,v 1.4 2003/03/19 23:44:53 eric Exp $
     2.8 + * $Id: pdf_jpeg.c,v 1.5 2003/03/19 23:53:09 eric Exp $
     2.9   * Copyright 2003 Eric Smith <eric@brouhaha.com>
    2.10   *
    2.11   * This program is free software; you can redistribute it and/or modify
    2.12 @@ -98,6 +98,9 @@
    2.13  			   double y,
    2.14  			   double width,
    2.15  			   double height,
    2.16 +			   bool color,
    2.17 +			   uint32_t width_samples,
    2.18 +			   uint32_t height_samples,
    2.19  			   FILE *f)
    2.20  {
    2.21    struct pdf_jpeg_image *image;
    2.22 @@ -116,10 +119,9 @@
    2.23  
    2.24    image->f = f;
    2.25  
    2.26 -  /* $$$ quick hack, should read these from file! */
    2.27 -  image->color = 1;
    2.28 -  image->width_samples = 71;
    2.29 -  image->height_samples = 88;
    2.30 +  image->color = color;
    2.31 +  image->width_samples = width_samples;
    2.32 +  image->height_samples = height_samples;
    2.33  
    2.34    pdf_add_array_elem_unique (pdf_page->procset,
    2.35  			     pdf_new_name (image->color ? "ImageC" : "ImageB"));
     3.1 --- a/tumble_jpeg.c	Thu Mar 20 07:52:25 2003 +0000
     3.2 +++ b/tumble_jpeg.c	Thu Mar 20 07:53:09 2003 +0000
     3.3 @@ -1,7 +1,7 @@
     3.4  /*
     3.5   * tumble: build a PDF file from image files
     3.6   *
     3.7 - * $Id: tumble_jpeg.c,v 1.1 2003/03/19 22:54:08 eric Exp $
     3.8 + * $Id: tumble_jpeg.c,v 1.2 2003/03/19 23:53:09 eric Exp $
     3.9   * Copyright 2003 Eric Smith <eric@brouhaha.com>
    3.10   *
    3.11   * This program is free software; you can redistribute it and/or modify
    3.12 @@ -87,6 +87,16 @@
    3.13  {
    3.14    double unit;
    3.15  
    3.16 +#ifdef DEBUG_JPEG
    3.17 +  printf ("color space: %d\n", cinfo.jpeg_color_space);
    3.18 +  printf ("components: %d\n", cinfo.num_components);
    3.19 +  printf ("density unit: %d\n", cinfo.density_unit);
    3.20 +  printf ("x density: %d\n", cinfo.X_density);
    3.21 +  printf ("y density: %d\n", cinfo.Y_density);
    3.22 +  printf ("width: %d\n", cinfo.image_width);
    3.23 +  printf ("height: %d\n", cinfo.image_height);
    3.24 +#endif
    3.25 +
    3.26    switch (cinfo.jpeg_color_space)
    3.27      {
    3.28      case JCS_GRAYSCALE:
    3.29 @@ -154,6 +164,9 @@
    3.30  			0, 0,  /* x, y */
    3.31  			image_info->width_points,
    3.32  			image_info->height_points,
    3.33 +			image_info->color,
    3.34 +			image_info->width_samples,
    3.35 +			image_info->height_samples,
    3.36  			jpeg_f);
    3.37  
    3.38    return (page);