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