3 #include "swf_gradient_record.h"
6 swf_gradient_record_parse(bitstream_t
7 *bs, swf_gradient_record_t *gradient_record,
10 if (tag->code == 46 || tag->code == 84) { // DefineMorph || DefineMorphShape2
11 gradient_record->position = bitstream_getbyte(bs);
12 swf_rgba_parse(bs, &(gradient_record->rgba));
13 gradient_record->position_morph = bitstream_getbyte(bs);
14 ret = swf_rgba_parse(bs, &(gradient_record->rgba_morph));
15 } else if (tag->code == 32 || tag->code == 83) {
16 // DefineShape3 || DefineShape4
17 gradient_record->position = bitstream_getbyte(bs);
18 ret = swf_rgba_parse(bs, &(gradient_record->rgba));
20 gradient_record->position = bitstream_getbyte(bs);
21 ret = swf_rgb_parse(bs, &(gradient_record->rgb));
27 swf_gradient_record_build(bitstream_t *bs,
28 swf_gradient_record_t *gradient_record,
30 if (tag->code == 46 || tag->code == 84) { // DefineMorph || DefineMorphShape2
31 bitstream_putbyte(bs, gradient_record->position);
32 swf_rgba_build(bs, &(gradient_record->rgba));
33 bitstream_putbyte(bs, gradient_record->position_morph);
34 swf_rgba_build(bs, &(gradient_record->rgba_morph));
35 } else if (tag->code == 32 || tag->code == 83) {
36 // DefineShape3 || DefineShape4
37 bitstream_putbyte(bs, gradient_record->position);
38 swf_rgba_build(bs, &(gradient_record->rgba));
40 bitstream_putbyte(bs, gradient_record->position);
41 swf_rgb_build(bs, &(gradient_record->rgb));
47 swf_gradient_record_print(swf_gradient_record_t *gradient_record,
48 int indent_depth, swf_tag_t *tag) {
49 if (gradient_record == NULL) {
50 fprintf(stderr, "swf_gradient_record_print: gradient_record == NULL\n");
53 if (tag->code == 46 || tag->code == 84) { // DefineMorph || DefineMorphShape2
54 print_indent(indent_depth);
55 printf("position=%d\n", gradient_record->position);
56 swf_rgba_print(&(gradient_record->rgba), indent_depth);
57 print_indent(indent_depth);
58 printf("position_morph=%d\n", gradient_record->position_morph);
59 swf_rgba_print(&(gradient_record->rgba_morph), indent_depth);
60 } else if (tag->code == 32 || tag->code == 83) {
61 // DefineShape3 || DefineShape4
62 print_indent(indent_depth);
63 printf("position=%d\n", gradient_record->position);
64 swf_rgba_print(&(gradient_record->rgba), indent_depth);
66 print_indent(indent_depth);
67 printf("position=%d\n", gradient_record->position);
68 swf_rgb_print(&(gradient_record->rgb), indent_depth);