added optional storing of full font sets in the .swf. (option -f)
[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 extern "C" {
15 #include "../lib/rfxswf.h"
16 }
17
18 extern int opennewwindow; //default:0
19 extern int ignoredraworder; //default:0
20 extern int drawonlyshapes; //default:0
21 extern int jpegquality; //default:100;
22 extern int storeallcharacters; // default:0
23
24 typedef long int twip;
25
26 struct swfmatrix {
27     double m11,m12,m21,m22,m13,m23;
28 };
29
30 struct swfcoord {
31     twip x;
32     twip y;
33 };
34
35 class SWFFont
36 {
37     T1_OUTLINE**outline;
38     char**charname;
39     char*used;
40
41     char*name;
42     int charnum;
43
44     U16*char2swfcharid;
45     U16*swfcharid2char;
46     int swfcharpos;
47
48     public:
49     
50     int t1id;
51     char*fontid;
52     unsigned int swfid;
53
54     SWFFont(char*name, int t1id, char*filename);
55     SWFFont::~SWFFont();
56     T1_OUTLINE*getOutline(char*charname);
57     int getSWFCharID(char*name);
58     char*getName();
59     char*getCharName(int t);
60 };
61
62 struct swfoutput 
63 {
64     //int t1font;
65     double fontm11,fontm12,fontm21,fontm22;
66     unsigned short int linewidth;
67     SWFFont*font;
68     RGBA strokergb;
69     RGBA fillrgb;
70 };
71
72 #define DRAWMODE_STROKE 1
73 #define DRAWMODE_FILL 2
74 #define DRAWMODE_EOFILL 3
75 #define DRAWMODE_CLIP 4
76 #define DRAWMODE_EOCLIP 5
77
78 void swfoutput_init(struct swfoutput*, char*filename, int sizex, int sizey);
79 void swfoutput_setprotected(); //write PROTECT tag
80
81 void swfoutput_newpage(struct swfoutput*);
82
83 void swfoutput_setfont(struct swfoutput*, char*fontid, int t1font, char*filename);
84 int swfoutput_queryfont(struct swfoutput*, char*fontid);
85 void swfoutput_setdrawmode(struct swfoutput*, int drawmode);
86 void swfoutput_setfillcolor(struct swfoutput*, unsigned char r, unsigned char g, unsigned char b, unsigned char a);
87 void swfoutput_setstrokecolor(struct swfoutput*, unsigned char r, unsigned char g, unsigned char b, unsigned char a);
88 void swfoutput_setfontmatrix(struct swfoutput*,double,double,double,double);
89 void swfoutput_setlinewidth(struct swfoutput*, double linewidth);
90
91 void swfoutput_drawchar(struct swfoutput*,double x,double y,char*a);
92 void swfoutput_drawpath(struct swfoutput*, T1_OUTLINE*outline, struct swfmatrix*m);
93 void swfoutput_startclip(struct swfoutput*, T1_OUTLINE*outline, struct swfmatrix*m);
94 void swfoutput_endclip(struct swfoutput*);
95 int swfoutput_drawimagejpeg(struct swfoutput*, char*filename, int sizex,int sizey, 
96         double x1,double y1,
97         double x2,double y2,
98         double x3,double y3,
99         double x4,double y4);
100 int swfoutput_drawimagelossless(struct swfoutput*, RGBA*pic, int sizex, int sizey,
101         double x1,double y1,
102         double x2,double y2,
103         double x3,double y3,
104         double x4,double y4);
105 int swfoutput_drawimagelossless256(struct swfoutput*, U8*pic,RGBA*pal, int sizex, int sizey,
106         double x1,double y1,
107         double x2,double y2,
108         double x3,double y3,
109         double x4,double y4);
110 void swfoutput_drawimageagain(struct swfoutput*, int id, int sizex, int sizey,
111         double x1,double y1,
112         double x2,double y2,
113         double x3,double y3,
114         double x4,double y4);
115
116 void swfoutput_linktopage(struct swfoutput*, int page, swfcoord*points);
117 void swfoutput_linktourl(struct swfoutput*, char*url, swfcoord*points);
118
119 void swfoutput_destroy(struct swfoutput*);
120
121 #endif //__swfoutput_h__