1 /* 2 * tumble: build a PDF file from image files 3 * 4 * Copyright 2003, 2017 Eric Smith <spacewar@gmail.com> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 2 as 8 * published by the Free Software Foundation. Note that permission is 9 * not granted to redistribute this program under the terms of any 10 * other version of the General Public License. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA 20 * 21 * 2010-09-02 [JDB] Added support for min-is-black TIFF images. 22 */ 23 24 25 typedef struct 26 { 27 bool color; 28 bool negative; 29 uint32_t width_samples, height_samples; 30 double width_points, height_points; 31 double x_resolution, y_resolution; 32 } image_info_t; 33 34 35 typedef struct 36 { 37 bool (*match_suffix) (char *suffix); 38 bool (*open_input_file) (FILE *f, char *name); 39 bool (*close_input_file) (void); 40 bool (*last_input_page) (void); 41 bool (*get_image_info) (int image, 42 input_attributes_t input_attributes, 43 image_info_t *image_info); 44 bool (*process_image) (int image, 45 input_attributes_t input_attributes, 46 image_info_t *image_info, 47 pdf_page_handle page, 48 position_t position); 49 } input_handler_t; 50 51 52 void install_input_handler (input_handler_t *handler); 53 54 55 bool match_input_suffix (char *suffix); 56 bool open_input_file (char *name); 57 bool close_input_file (void); 58 bool last_input_page (void); 59 bool get_image_info (int image, 60 input_attributes_t input_attributes, 61 image_info_t *image_info); 62 bool process_image (int image, 63 input_attributes_t input_attributes, 64 image_info_t *image_info, 65 pdf_page_handle page, 66 position_t position); 67 68 69 void init_tiff_handler (void); 70 void init_jpeg_handler (void); 71 void init_pbm_handler (void); 72 void init_png_handler (void); 73 74 extern input_handler_t blank_handler; 75