fix for t1lib-5.0.0
[swftools.git] / pdf2swf / swfoutput.h
1 /* swfoutput.h
2    Header file for swfoutput.cc (and swfoutput_x11.cc).
3
4    Part of the swftools package.
5
6    Copyright (c) 2001 Matthias Kramm <kramm@quiss.org> 
7
8    This file is distributed under the GPL, see file COPYING for details */
9
10 #ifndef __swfoutput_h__
11 #define __swfoutput_h__
12
13 #include <t1lib.h>
14 #ifdef T1ERR_SCAN_ENCODING //t1lib 5.0.0
15 #define T1_Get_no_fonts T1_GetNoFonts
16 #endif
17
18 extern "C" {
19 #include "../lib/rfxswf.h"
20 }
21
22 extern int enablezlib; //default:0
23 extern int opennewwindow; //default:0
24 extern int ignoredraworder; //default:0
25 extern int drawonlyshapes; //default:0
26 extern int jpegquality; //default:100;
27 extern int storeallcharacters; // default:0
28 extern int insertstoptag; //default:0
29 extern int flashversion; //default:4
30
31 typedef long int twip;
32
33 struct swfmatrix {
34     double m11,m12,m21,m22,m13,m23;
35 };
36
37 struct swfcoord {
38     twip x;
39     twip y;
40 };
41
42 class SWFFont
43 {
44     T1_OUTLINE**outline;
45     char**charname;
46     int*width;
47     char*used;
48
49     char*name;
50     int charnum;
51
52     U16*char2swfcharid;
53     U16*swfcharid2char;
54     int swfcharpos;
55
56     char**standardtable;
57     int standardtablesize;
58
59     public:
60     
61     int t1id;
62     char*fontid;
63     unsigned int swfid;
64
65     SWFFont(char*name, int t1id, char*filename);
66     SWFFont::~SWFFont();
67     T1_OUTLINE*getOutline(char*charname, int charnr);
68     int getSWFCharID(char*name, int charnr);
69     int getWidth(char*name);
70     char*getName();
71     char*getCharName(int t);
72     int getCharWidth(int t) {return width[t];}
73 };
74
75 struct swfoutput 
76 {
77     //int t1font;
78     double fontm11,fontm12,fontm21,fontm22;
79     unsigned short int linewidth;
80     SWFFont*font;
81     RGBA strokergb;
82     RGBA fillrgb;
83 };
84
85 #define DRAWMODE_STROKE 1
86 #define DRAWMODE_FILL 2
87 #define DRAWMODE_EOFILL 3
88 #define DRAWMODE_CLIP 4
89 #define DRAWMODE_EOCLIP 5
90
91 void swfoutput_init(struct swfoutput*, char*filename, int sizex, int sizey);
92 void swfoutput_setprotected(); //write PROTECT tag
93
94 void swfoutput_newpage(struct swfoutput*);
95
96 void swfoutput_setfont(struct swfoutput*, char*fontid, int t1font, char*filename);
97 int swfoutput_queryfont(struct swfoutput*, char*fontid);
98 void swfoutput_setdrawmode(struct swfoutput*, int drawmode);
99 void swfoutput_setfillcolor(struct swfoutput*, unsigned char r, unsigned char g, unsigned char b, unsigned char a);
100 void swfoutput_setstrokecolor(struct swfoutput*, unsigned char r, unsigned char g, unsigned char b, unsigned char a);
101 void swfoutput_setfontmatrix(struct swfoutput*,double,double,double,double);
102 void swfoutput_setlinewidth(struct swfoutput*, double linewidth);
103
104 void swfoutput_drawchar(struct swfoutput*,double x,double y,char*a, int charnr);
105 void swfoutput_drawpath(struct swfoutput*, T1_OUTLINE*outline, struct swfmatrix*m);
106 void swfoutput_startclip(struct swfoutput*, T1_OUTLINE*outline, struct swfmatrix*m);
107 void swfoutput_endclip(struct swfoutput*);
108 int swfoutput_drawimagejpeg(struct swfoutput*, RGBA*pic, int sizex,int sizey, 
109         double x1,double y1,
110         double x2,double y2,
111         double x3,double y3,
112         double x4,double y4);
113 int swfoutput_drawimagelossless(struct swfoutput*, RGBA*pic, int sizex, int sizey,
114         double x1,double y1,
115         double x2,double y2,
116         double x3,double y3,
117         double x4,double y4);
118 int swfoutput_drawimagelosslessN(struct swfoutput*, U8*pic, RGBA*pal, int sizex, int sizey,
119         double x1,double y1,
120         double x2,double y2,
121         double x3,double y3,
122         double x4,double y4, int n);
123 void swfoutput_drawimageagain(struct swfoutput*, int id, int sizex, int sizey,
124         double x1,double y1,
125         double x2,double y2,
126         double x3,double y3,
127         double x4,double y4);
128
129 void swfoutput_linktopage(struct swfoutput*, int page, swfcoord*points);
130 void swfoutput_linktourl(struct swfoutput*, char*url, swfcoord*points);
131 void swfoutput_namedlink(struct swfoutput*obj, char*name, swfcoord*points);
132
133 void swfoutput_destroy(struct swfoutput*);
134
135 #endif //__swfoutput_h__