new parameter addspacechars
[swftools.git] / src / swfc-history.h
1 /* swfc- Compiles swf code (.sc) files into .swf files.
2
3    Part of the swftools package.
4
5    Copyright (c) 2007 Huub Schaeks <huub@h-schaeks.speedlinq.nl>
6    Copyright (c) 2007 Matthias Kramm <kramm@quiss.org>
7  
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2 of the License, or
11    (at your option) any later version.
12
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
21
22 #ifndef __HISTORY_H
23 #define __HISTORY_Y
24
25 #include "../lib/types.h"
26 #include "../lib/rfxswf.h"
27 #include "../lib/q.h"
28 #include "swfc-feedback.h"
29 #include "swfc-interpolation.h"
30
31 enum
32 {
33         CF_PUT = 1,
34         CF_CHANGE = 2,
35     CF_SCHANGE = 3,
36     CF_SWEEP = 4,
37         CF_JUMP = 5     
38 };
39
40 #define SF_X 0x0001
41 #define SF_Y 0x0002
42 #define SF_SCALEX 0x0004
43 #define SF_SCALEY 0x0008
44 #define SF_CX_R 0x0010
45 #define SF_CX_G 0x0020
46 #define SF_CX_B 0x0040
47 #define SF_CX_A 0x0080
48 #define SF_ROTATE 0x0100
49 #define SF_SHEAR 0x0200
50 #define SF_PIVOT 0x0400
51 #define SF_PIN 0x0800
52 #define SF_BLEND 0x1000
53 #define SF_FILTER 0x2000
54 #define SF_ALL 0x3fff
55
56 #define IF_FIXED_ALIGNMENT 0x0001
57
58 FILTER* noFilters;
59 FILTER_BLUR* noBlur;
60 FILTER_BEVEL* noBevel;
61 FILTER_DROPSHADOW* noDropshadow;
62 FILTER_GRADIENTGLOW* noGradientGlow;
63
64 typedef struct _spline
65 {
66     float a, b, c, d;
67 } spline_t;
68
69 typedef struct _arc
70 {
71     float r, angle, delta_angle, cX, cY;
72     int X; // boolean: 1 if this is for x; 0 if this is for y;
73 } arc_t;
74
75 typedef struct _flagparms
76 {
77     float pathAngle, instanceAngle;
78 } flagparams_t;
79
80 typedef struct _state
81 {
82         U16 frame;
83         float value;
84         int function;
85         interpolation_t* interpolation;
86     spline_t spline;
87     arc_t arc;
88     flagparams_t params;
89     struct _state* next;
90 } state_t;
91
92 state_t* state_new(U16 frame, int function, float value, interpolation_t* inter);
93 void state_free(state_t* state);
94 void state_init(state_t* state);
95 state_t* state_at(state_t* state, U16 frame);
96 void state_append(state_t* state, state_t* newState);
97 void state_insert(state_t* state, state_t* newState);
98 float state_value(state_t* first, float frame);
99 float state_tangent(state_t* modification, U16 frame, int tangent);
100
101 typedef struct _filterState
102 {
103         U16 frame;
104     FILTERLIST* value;
105         int function;
106         interpolation_t* interpolation;
107     struct _filterState* next;
108 } filterState_t;
109
110 filterState_t* filterState_new(U16 frame, int function, FILTERLIST* value, interpolation_t* inter);
111 void filterState_free(filterState_t* change);
112 void filterState_init(filterState_t* change);
113 void filterState_append(filterState_t* first, filterState_t* newChange);
114 FILTERLIST* filterState_value(filterState_t* first, U16 frame);
115
116 typedef struct _history
117 {
118     U16 firstFrame, lastFrame;
119         TAG* firstTag;
120     dict_t* states;
121 } history_t;
122
123 history_t* history_new();
124 void history_free(history_t* past);
125 void history_init(history_t* past);
126 void history_begin(history_t* past, char* parameter, U16 frame, TAG* tag, float value);
127 void history_beginFilter(history_t* past, U16 frame, TAG* tag, FILTERLIST* value);
128 void history_remember(history_t* past, char* parameter, U16 frame, int function, float value, interpolation_t* inter);
129 void history_rememberSweep(history_t* past, U16 frame, float x, float y, float r, int clockwise, int short_arc, interpolation_t* inter);
130 void history_rememberFilter(history_t* past, U16 frame, int function, FILTERLIST* value, interpolation_t* inter);
131 void history_processFlags(history_t* past);
132 int history_change(history_t* past, U16 frame, char* parameter);
133 float history_value(history_t* past, U16 frame, char* parameter);
134 float history_rotateValue(history_t* past, U16 frame);
135 int history_changeFilter(history_t* past, U16 frame);
136 FILTERLIST* history_filterValue(history_t* past, U16 frame);
137
138 #endif