1
0
mirror of synced 2026-04-07 14:14:08 +00:00

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

This commit is contained in:
Eric Smith
2003-03-20 07:53:09 +00:00
parent e9915ad10f
commit dccd163653
3 changed files with 27 additions and 8 deletions

8
pdf.h
View File

@@ -2,7 +2,7 @@
* tumble: build a PDF file from image files
*
* PDF routines
* $Id: pdf.h,v 1.12 2003/03/19 22:54:07 eric Exp $
* $Id: pdf.h,v 1.13 2003/03/19 23:53:09 eric Exp $
* Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -22,7 +22,8 @@
*/
#define POINTS_PER_INCH 72
/* Acrobat default units aren't really points, but they're close. */
#define POINTS_PER_INCH 72.0
/* page size limited by Acrobat Reader to 45 inches on a side */
#define PAGE_MAX_INCHES 45
@@ -86,6 +87,9 @@ void pdf_write_jpeg_image (pdf_page_handle pdf_page,
double y,
double width,
double height,
bool color,
uint32_t width_samples,
uint32_t height_samples,
FILE *f);

View File

@@ -2,7 +2,7 @@
* tumble: build a PDF file from image files
*
* PDF routines
* $Id: pdf_jpeg.c,v 1.4 2003/03/19 23:44:53 eric Exp $
* $Id: pdf_jpeg.c,v 1.5 2003/03/19 23:53:09 eric Exp $
* Copyright 2003 Eric Smith <eric@brouhaha.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -98,6 +98,9 @@ void pdf_write_jpeg_image (pdf_page_handle pdf_page,
double y,
double width,
double height,
bool color,
uint32_t width_samples,
uint32_t height_samples,
FILE *f)
{
struct pdf_jpeg_image *image;
@@ -116,10 +119,9 @@ void pdf_write_jpeg_image (pdf_page_handle pdf_page,
image->f = f;
/* $$$ quick hack, should read these from file! */
image->color = 1;
image->width_samples = 71;
image->height_samples = 88;
image->color = color;
image->width_samples = width_samples;
image->height_samples = height_samples;
pdf_add_array_elem_unique (pdf_page->procset,
pdf_new_name (image->color ? "ImageC" : "ImageB"));

View File

@@ -1,7 +1,7 @@
/*
* tumble: build a PDF file from image files
*
* $Id: tumble_jpeg.c,v 1.1 2003/03/19 22:54:08 eric Exp $
* $Id: tumble_jpeg.c,v 1.2 2003/03/19 23:53:09 eric Exp $
* Copyright 2003 Eric Smith <eric@brouhaha.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -87,6 +87,16 @@ bool get_jpeg_image_info (int image,
{
double unit;
#ifdef DEBUG_JPEG
printf ("color space: %d\n", cinfo.jpeg_color_space);
printf ("components: %d\n", cinfo.num_components);
printf ("density unit: %d\n", cinfo.density_unit);
printf ("x density: %d\n", cinfo.X_density);
printf ("y density: %d\n", cinfo.Y_density);
printf ("width: %d\n", cinfo.image_width);
printf ("height: %d\n", cinfo.image_height);
#endif
switch (cinfo.jpeg_color_space)
{
case JCS_GRAYSCALE:
@@ -154,6 +164,9 @@ bool process_jpeg_image (int image, /* range 1 .. n */
0, 0, /* x, y */
image_info->width_points,
image_info->height_points,
image_info->color,
image_info->width_samples,
image_info->height_samples,
jpeg_f);
return (page);