applied patches from Huub Schaeks
[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 "types.h"
26 #include "rfxswf.h"
27 #include "q.h"
28 #include "feedback.h"
29 #include "interpolation.h"
30
31 enum
32 {
33         CF_PUT = 1,
34         CF_CHANGE = 2,
35         CF_QCHANGE = 3,
36         CF_ARCCHANGE = 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 0x01000
53 #define SF_FILTER 0x02000
54
55
56 typedef struct _change
57 {
58         U16 frame;
59         float value;
60         int function;
61         interpolation_t* interpolation;
62         struct _change* next;
63 } change_t;
64
65 change_t* change_new(U16 frame, int function, float value, interpolation_t* inter);
66 void change_free(change_t* change);
67 void change_init(change_t* change);
68 void change_append(change_t* first, change_t* newChange);
69 float change_value(change_t* first, U16 frame);
70
71 typedef struct _changeFilter
72 {
73         U16 frame;
74         FILTER* value;
75         int function;
76         interpolation_t* interpolation;
77         struct _changeFilter* next;
78 } changeFilter_t;
79
80 changeFilter_t* changeFilter_new(U16 frame, int function, FILTER* value, interpolation_t* inter);
81 void changeFilter_free(changeFilter_t* change);
82 void changeFilter_init(changeFilter_t* change);
83 void changeFilter_append(changeFilter_t* first, changeFilter_t* newChange);
84 FILTER* changeFilter_value(changeFilter_t* first, U16 frame);
85
86 typedef struct _history
87 {
88         U16 firstFrame;
89         TAG* firstTag;
90         dictionary_t* changes;
91 } history_t;
92
93 history_t* history_new();
94 void history_free(history_t* past);
95 void history_init(history_t* past);
96 void history_begin(history_t* past, char* parameter, U16 frame, TAG* tag, float value);
97 void history_beginFilter(history_t* past, U16 frame, TAG* tag, FILTER* value);
98 void history_remember(history_t* past, char* parameter, U16 frame, int function, float value, interpolation_t* inter);
99 void history_rememberFilter(history_t* past, U16 frame, int function, FILTER* value, interpolation_t* inter);
100 float history_value(history_t* past, U16 frame, char* parameter);
101 FILTER* history_valueFilter(history_t* past, U16 frame);
102
103 #endif