Back to index

tetex-bin  3.0
image.h
Go to the documentation of this file.
00001 /*
00002 Copyright (c) 1996-2002 Han The Thanh, <thanh@pdftex.org>
00003 
00004 This file is part of pdfTeX.
00005 
00006 pdfTeX is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2 of the License, or
00009 (at your option) any later version.
00010 
00011 pdfTeX is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License
00017 along with pdfTeX; if not, write to the Free Software
00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 $Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/image.h#10 $
00021 */
00022 
00023 #include <png.h>
00024 
00025 /* JPG_IMAGE_INFO is main structure for interchange of image data */
00026 
00027 #define JPG_UINT16      unsigned int
00028 #define JPG_UINT32      unsigned long
00029 #define JPG_UINT8       unsigned char
00030 
00031 typedef struct {
00032     int color_space;    /* used color space. See JPG_ constants */
00033     JPG_UINT8  bits_per_component; /* bits per component                         */
00034     JPG_UINT32 length;             /* length of file/data                        */
00035     FILE *file;                    /* jpg file                                   */
00036 } JPG_IMAGE_INFO;
00037 
00038 typedef struct {
00039     png_structp png_ptr;
00040     png_infop info_ptr;
00041 } png_image_struct;
00042 
00043 typedef struct {
00044     integer orig_x;
00045     integer orig_y;
00046     integer selected_page;
00047     integer page_box;
00048     integer always_use_pdfpagebox;
00049     void *doc;
00050 } pdf_image_struct;
00051 
00052 typedef struct {
00053     char *image_name;
00054     int image_type;
00055     int color_type;
00056     integer width;
00057     integer height;
00058     integer x_res;
00059     integer y_res;
00060     integer num_pages;
00061     integer colorspace_ref;
00062     union {
00063         pdf_image_struct *pdf;
00064         png_image_struct png;
00065         JPG_IMAGE_INFO *jpg;
00066     } image_struct;
00067 } image_entry;
00068 
00069 extern image_entry *image_ptr, *image_array;
00070 extern integer image_max;
00071 
00072 #define IMAGE_TYPE_NONE 0
00073 #define IMAGE_TYPE_PDF  1
00074 #define IMAGE_TYPE_PNG  2
00075 #define IMAGE_TYPE_JPG  3
00076 #define IMAGE_TYPE_TIF  4
00077 
00078 #define IMAGE_COLOR_B   1
00079 #define IMAGE_COLOR_C   2
00080 #define IMAGE_COLOR_I   4
00081 
00082 #define img_ptr(N)      (image_array + (N))
00083 #define img_name(N)     (img_ptr(N)->image_name)
00084 #define img_type(N)     (img_ptr(N)->image_type)
00085 #define img_color(N)    (img_ptr(N)->color_type)
00086 #define img_colorspace_ref(N) (img_ptr(N)->colorspace_ref)
00087 #define img_pages(N)    (img_ptr(N)->num_pages)
00088 #define img_width(N)    (img_ptr(N)->width)
00089 #define img_height(N)   (img_ptr(N)->height)
00090 #define img_xres(N)     (img_ptr(N)->x_res)
00091 #define img_yres(N)     (img_ptr(N)->y_res)
00092 #define png_ptr(N)      (img_ptr(N)->image_struct.png.png_ptr)
00093 #define png_info(N)     (img_ptr(N)->image_struct.png.info_ptr)
00094 #define pdf_ptr(N)      (img_ptr(N)->image_struct.pdf)
00095 #define jpg_ptr(N)      (img_ptr(N)->image_struct.jpg)
00096 #define tif_ptr(N)      (img_ptr(N)->image_struct.tif)
00097 
00098 extern integer read_pdf_info(char*, char*, integer, integer, integer, integer);
00099 extern void write_epdf(void);
00100 extern void epdf_delete(void);
00101 extern void read_png_info(integer);
00102 extern void write_png(integer);
00103 extern void read_jpg_info(integer);
00104 extern void write_jpg(integer);