diff options
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/image/image.h')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/image/image.h | 81 |
1 files changed, 55 insertions, 26 deletions
diff --git a/Build/source/texk/web2c/luatexdir/image/image.h b/Build/source/texk/web2c/luatexdir/image/image.h index 33f09274433..7d9bb8b0e00 100644 --- a/Build/source/texk/web2c/luatexdir/image/image.h +++ b/Build/source/texk/web2c/luatexdir/image/image.h @@ -1,23 +1,24 @@ -/* -Copyright (c) 1996-2002 Han The Thanh, <thanh@pdftex.org> +/* image.h + + Copyright 1996-2006 Han The Thanh <thanh@pdftex.org> + Copyright 2006-2008 Taco Hoekwater <taco@luatex.org> -This file is part of pdfTeX. -pdfTeX is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This file is part of LuaTeX. -pdfTeX is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + LuaTeX is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your + option) any later version. -You should have received a copy of the GNU General Public License -along with pdfTeX; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + LuaTeX is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. -$Id: image.h 1125 2008-03-25 19:36:52Z hhenkel $ -*/ + You should have received a copy of the GNU General Public License along + with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ + +/* $Id: image.h 1407 2008-07-15 10:49:28Z taco $ */ #ifndef IMAGE_H # define IMAGE_H @@ -34,6 +35,7 @@ $Id: image.h 1125 2008-03-25 19:36:52Z hhenkel $ extern integer zround(double); /* from zround.c */ # define bp2int(p) zround(p * (one_hundred_bp / 100.0)) +# define int2bp(i) (i * 100.0 / one_hundred_bp) # define TYPE_IMG "image" # define TYPE_IMG_DICT "image-dict" @@ -43,6 +45,10 @@ extern integer zround(double); /* from zround.c */ /**********************************************************************/ typedef struct { + char *stream; +} pdf_stream_struct; + +typedef struct { png_structp png_ptr; png_infop info_ptr; } png_img_struct; @@ -52,21 +58,21 @@ typedef struct { JPG_UINT32 length; /* length of file/data */ } jpg_img_struct; -#if 0 +# if 0 typedef struct { /* currently unused */ } jb2_img_struct; -#endif +# endif typedef enum { DICT_NEW, /* fresh dictionary */ DICT_FILESCANNED, /* image file scanned */ DICT_REFERED, /* pdf_refximage_node in node list --> read-only dict */ DICT_OUTIMG, /* /Im* appears in pagestream */ - DICT_SCHEDULED, /* image dict scheduled for writing */ + DICT_SCHEDULED, /* image dict scheduled for writing (PONR) */ DICT_WRITTEN /* image dict written to file */ } dict_state; -typedef enum { IMAGE_TYPE_NONE, IMAGE_TYPE_PDF, IMAGE_TYPE_PNG, IMAGE_TYPE_JPG, - IMAGE_TYPE_JBIG2, IMAGE_TYPE_SENTINEL +typedef enum { IMG_TYPE_NONE, IMG_TYPE_PDF, IMG_TYPE_PNG, IMG_TYPE_JPG, + IMG_TYPE_JBIG2, IMG_TYPE_PDFSTREAM, IMG_TYPE_SENTINEL } imgtype_e; typedef enum { IMG_KEEPOPEN, IMG_CLOSEINBETWEEN } img_readtype_e; @@ -87,7 +93,9 @@ typedef struct { integer y_orig; integer x_res; /* pixel resolution as in JPG/PNG/JBIG2 file */ integer y_res; + integer rotation; /* rotation (multiples of 90 deg.) for PDF files */ integer colorspace; /* number of /ColorSpace object */ + integer group_ref; /* if it's <=0, the page has no group */ integer total_pages; integer page_num; /* requested page (by number) */ char *pagename; /* requested page (by name) */ @@ -99,8 +107,11 @@ typedef struct { int color_space; /* used color space. See JPG_ constants */ int color_depth; /* color depth */ pdfboxspec_e page_box_spec; /* PDF page box spec.: media/crop/bleed/trim/art */ + integer bbox[4]; dict_state state; + integer flags; union { + pdf_stream_struct *pdfstream; png_img_struct *png; jpg_img_struct *jpg; /* jb2_img_struct *jb2; */ @@ -115,7 +126,9 @@ typedef struct { # define img_yorig(N) ((N)->y_orig) # define img_xres(N) ((N)->x_res) # define img_yres(N) ((N)->y_res) +# define img_rotation(N) ((N)->rotation) # define img_colorspace(N) ((N)->colorspace) +# define img_group_ref(N) ((N)->group_ref) # define img_totalpages(N) ((N)->total_pages) # define img_pagenum(N) ((N)->page_num) # define img_pagename(N) ((N)->pagename) @@ -127,8 +140,12 @@ typedef struct { # define img_color(N) ((N)->color_space) # define img_colordepth(N) ((N)->color_depth) # define img_pagebox(N) ((N)->page_box_spec) +# define img_bbox(N) ((N)->bbox) # define img_state(N) ((N)->state) +# define img_pdfstream_ptr(N) ((N)->img_struct.pdfstream) +# define img_pdfstream_stream(N) ((N)->img_struct.pdfstream->stream) + # define img_png_ptr(N) ((N)->img_struct.png) # define img_png_png_ptr(N) ((N)->img_struct.png->png_ptr) # define img_png_info_ptr(N) ((N)->img_struct.png->info_ptr) @@ -138,6 +155,12 @@ typedef struct { # define img_jb2_ptr(N) ((N)->img_struct.jb2) +# define F_FLAG_BBOX (1 << 0) + +# define img_set_bbox(N) (img_flags(N) |= F_FLAG_BBOX) +# define img_unset_bbox(N) (img_flags(N) &= ~F_FLAG_BBOX) +# define img_is_bbox(N) ((img_flags(N) & F_FLAG_BBOX) != 0) + /**********************************************************************/ typedef struct { @@ -147,6 +170,7 @@ typedef struct { integer transform; integer flags; image_dict *dict; + int array_idx; /* index within img_array */ int dict_ref; /* luaL_ref() reference */ } image; @@ -156,18 +180,17 @@ typedef struct { # define img_transform(N) ((N)->transform) # define img_flags(N) ((N)->flags) # define img_dict(N) ((N)->dict) +# define img_arrayidx(N) ((N)->array_idx) # define img_dictref(N) ((N)->dict_ref) -# define F_FLAG_SCALED 0x01 -# define F_FLAG_REFERED 0x02 +# define img_is_refered(N) (img_arrayidx(N) != -1) + +# define F_FLAG_SCALED (1 << 0) # define img_flags(N) ((N)->flags) # define img_set_scaled(N) (img_flags(N) |= F_FLAG_SCALED) -# define img_set_refered(N) (img_flags(N) |= F_FLAG_REFERED) # define img_unset_scaled(N) (img_flags(N) &= ~F_FLAG_SCALED) -# define img_unset_refered(N) (img_flags(N) &= ~F_FLAG_REFERED) # define img_is_scaled(N) ((img_flags(N) & F_FLAG_SCALED) != 0) -# define img_is_refered(N) ((img_flags(N) & F_FLAG_REFERED) != 0) # define set_wd_running(N) (img_width(N) = null_flag) # define set_ht_running(N) (img_height(N) = null_flag) @@ -180,6 +203,9 @@ typedef struct { /* writeimg.c */ +void new_img_pdfstream_struct(image_dict *); +void check_pdfstream_dict(image_dict *); +void write_pdfstream(image_dict *); image *new_image(); image_dict *new_image_dict(); void init_image(image *); @@ -206,6 +232,9 @@ void write_jpg(image_dict *); void write_jbig2(image_dict *); void write_epdf(image_dict *); +extern void write_additional_epdf_objects(void); +extern void write_additional_png_objects(void); + /* pdftoepdf.cc */ void unrefPdfDocument(char *); |