1 /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
2 
3     Copyright (C) 2007-2014 by Jin-Hwan Cho and Shunsaku Hirata,
4     the dvipdfmx project team.
5 
6     Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu>
7 
8     This program is free software; you can redistribute it and/or modify
9     it under the terms of the GNU General Public License as published by
10     the Free Software Foundation; either version 2 of the License, or
11     (at your option) any later version.
12 
13     This program is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     GNU General Public License for more details.
17 
18     You should have received a copy of the GNU General Public License
19     along with this program; if not, write to the Free Software
20     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 */
22 
23 #ifndef _PDFXIMAGE_H_
24 #define _PDFXIMAGE_H_
25 
26 #include "pdfdev.h"
27 
28 #define PDF_XOBJECT_TYPE_FORM  0
29 #define PDF_XOBJECT_TYPE_IMAGE 1
30 
31 typedef struct {
32   int  flags;
33 
34   long width;
35   long height;
36 
37   int  bits_per_component;
38   int  num_components;
39 
40   long min_dpi; /* NOT USED YET */
41 
42   double xdensity, ydensity; /* scale factor for bp */
43 } ximage_info;
44 
45 typedef struct {
46   int         flags;
47 
48   pdf_rect    bbox;
49   pdf_tmatrix matrix;
50 } xform_info;
51 
52 typedef struct pdf_ximage_ pdf_ximage;
53 
54 extern void     pdf_ximage_set_verbose    (void);
55 
56 extern void     pdf_init_images           (void);
57 extern void     pdf_close_images          (void);
58 
59 extern char    *pdf_ximage_get_resname    (int xobj_id);
60 extern pdf_obj *pdf_ximage_get_reference  (int xobj_id);
61 
62 
63 extern int      pdf_ximage_findresource   (const char *ident, long page_no,
64                                            pdf_obj *dict);
65 extern int      pdf_ximage_defineresource (const char *ident, int subtype,
66                                            void *cdata, pdf_obj *resource);
67 
68 /* Called by pngimage, jpegimage, epdf, mpost, etc. */
69 extern void pdf_ximage_init_image_info (ximage_info *info);
70 extern void pdf_ximage_init_form_info  (xform_info  *info);
71 extern void pdf_ximage_set_image (pdf_ximage *ximage, void *info, pdf_obj *resource);
72 extern void pdf_ximage_set_form  (pdf_ximage *ximage, void *info, pdf_obj *resource);
73 extern long pdf_ximage_get_page  (pdf_ximage *I);
74 
75 /* from pdfximage.c */
76 extern void set_distiller_template (char *s);
77 extern char *get_distiller_template (void);
78 
79 extern int
80 pdf_ximage_scale_image (int            id,
81                         pdf_tmatrix    *M, /* ret */
82                         pdf_rect       *r, /* ret */
83                         transform_info *p  /* arg */
84                        );
85 
86 /* from dvipdfmx.c */
87 extern void pdf_ximage_disable_ebb (void);
88 
89 /* from spc_pdfm.c */
90 extern int      pdf_ximage_get_subtype    (int xobj_id);
91 extern void
92 pdf_ximage_set_attr (int xobj_id,
93                      long width, long height, double xdensity, double ydensity,
94                      double llx, double lly, double urx, double ury);
95 
96 #endif /* _PDFXIMAGE_H_ */
97