-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen_test1.c
88 lines (60 loc) · 2.1 KB
/
gen_test1.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
* Copyright (C) 2002 Ben Evans <[email protected]>
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
/* Test the background colour test flag */
#include "swf_types.h"
#include "swf_parse.h"
#include "swf_movie.h"
#include "swf_serialise.h"
#include "swf_destroy.h"
#include <stdio.h>
void usage (char * name);
void usage (char * name) {
fprintf (stderr, "%s <filename>\n", name);
}
int main (int argc, char *argv[]) {
swf_movie * movie;
int error;
swf_tagrecord * temp;
error = 0;
if ((movie = swf_make_movie(&error)) == NULL) {
fprintf (stderr, "Fail\n");
return 1;
}
swf_make_header(movie, &error, -4000, 4000, -4000, 4000);
movie->name = "ben1.swf\0";
temp = swf_make_triangle(movie, &error);
/* Need to calloc a (raw) buffer for temp... */
if ((temp->buffer->raw = (SWF_U8 *) calloc (10240, sizeof (SWF_U8))) == NULL) {
fprintf (stderr, "Calloc Fail\n");
return 1;
}
printf("foo 1\n");
swf_serialise_defineshape(temp->buffer, &error, (swf_defineshape *) temp->tag);
printf("foo 2\n");
temp->serialised = 1;
swf_add_protect(movie, &error);
swf_add_setbackgroundcolour(movie, &error, 0, 255, 0, 255);
swf_dump_tag(movie, &error, temp);
swf_add_showframe(movie, &error);
swf_add_end(movie, &error);
swf_make_finalise(movie, &error);
swf_destroy_movie(movie);
swf_free(temp->buffer->raw);
fprintf (stderr, "OK\n");
return 0;
}