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