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