SWFFont now has a destructor
[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 typedef long int twip;
19
20 struct swfmatrix {
21     double m11,m12,m21,m22,m13,m23;
22 };
23
24 struct swfcoord {
25     twip x;
26     twip y;
27 };
28
29 class SWFFont
30 {
31     T1_OUTLINE**outline;
32     char**charname;
33     char*used;
34
35     char*name;
36     int charnum;
37
38     public:
39     
40     int t1id;
41     char*fontid;
42     unsigned int swfid;
43
44     SWFFont(char*name, int t1id, char*filename);
45     SWFFont::~SWFFont();
46     T1_OUTLINE*getOutline(char*charname);
47     char*getName();
48     char*getCharName(int t);
49 };
50
51 struct swfoutput 
52 {
53     //int t1font;
54     double fontm11,fontm12,fontm21,fontm22;
55     unsigned short int linewidth;
56     SWFFont*font;
57     RGBA strokergb;
58     RGBA fillrgb;
59 };
60
61 #define DRAWMODE_STROKE 1
62 #define DRAWMODE_FILL 2
63 #define DRAWMODE_EOFILL 3
64 #define DRAWMODE_CLIP 4
65 #define DRAWMODE_EOCLIP 5
66
67 void swfoutput_init(struct swfoutput*, char*filename, int sizex, int sizey);
68 void swfoutput_setprotected(); //write PROTECT tag
69
70 void swfoutput_newpage(struct swfoutput*);
71
72 void swfoutput_setfont(struct swfoutput*, char*fontid, int t1font, char*filename);
73 int swfoutput_queryfont(struct swfoutput*, char*fontid);
74 void swfoutput_setdrawmode(struct swfoutput*, int drawmode);
75 void swfoutput_setfillcolor(struct swfoutput*, unsigned char r, unsigned char g, unsigned char b, unsigned char a);
76 void swfoutput_setstrokecolor(struct swfoutput*, unsigned char r, unsigned char g, unsigned char b, unsigned char a);
77 void swfoutput_setfontmatrix(struct swfoutput*,double,double,double,double);
78 void swfoutput_setlinewidth(struct swfoutput*, double linewidth);
79
80 void swfoutput_drawchar(struct swfoutput*,double x,double y,char*a);
81 void swfoutput_drawpath(struct swfoutput*, T1_OUTLINE*outline, struct swfmatrix*m);
82 void swfoutput_startclip(struct swfoutput*, T1_OUTLINE*outline, struct swfmatrix*m);
83 void swfoutput_endclip(struct swfoutput*);
84 void swfoutput_drawimagefile(struct swfoutput*, char*filename, int sizex,int sizey, 
85         double x1,double y1,
86         double x2,double y2,
87         double x3,double y3,
88         double x4,double y4);
89
90 void swfoutput_destroy(struct swfoutput*);
91
92 #endif //__swfoutput_h__