3 #include "swf_fill_style.h"
4 #include "swf_tag_shape.h"
7 swf_fill_style_parse(bitstream_t *bs, swf_fill_style_t *fill_style,
9 swf_tag_shape_detail_t *swf_tag_shape = (swf_tag_shape_detail_t *) tag->detail;
11 fill_style->type = bitstream_getbyte(bs);
13 if (swf_tag_shape->_parse_condition == SWF_TAG_SHAPE_PARSE_CONDITION_BITMAP) {
14 if ((fill_style->type < 0x40) || (0x43 < fill_style->type)) {
19 switch (fill_style->type) {
20 case 0x00: // solid fill
21 swf_fill_style_solid_parse(bs, &(fill_style->solid), tag);
23 case 0x10: // linear gradient fill
24 case 0x12: // radial gradient fill
25 case 0x13: // focal gradient fill
26 swf_fill_style_gradient_parse(bs, &(fill_style->gradient), tag);
28 case 0x40: // tilled bitmap fill with smoothed edges
29 case 0x41: // clipped bitmap fill with smoothed edges
30 case 0x42: // tilled bitmap fill with hard edges
31 case 0x43: // clipped bitmap fill with hard edges
32 swf_fill_style_bitmap_parse(bs, &(fill_style->bitmap), tag);
35 fprintf(stderr, "swf_fill_style_parse: unknown fill_style->type=0x%02x\n", fill_style->type);
42 swf_fill_style_build(bitstream_t *bs, swf_fill_style_t *fill_style,
44 if (fill_style == NULL) {
45 fprintf(stderr, "swf_fill_style_build: fill_style == NULL\n");
48 bitstream_putbyte(bs, fill_style->type);
49 switch (fill_style->type) {
50 case 0x00: // solid fill
51 swf_fill_style_solid_build(bs, &(fill_style->solid), tag);
53 case 0x10: // linear gradient fill
54 case 0x11: // radial gradient fill
55 case 0x12: // focal gradient fill
56 swf_fill_style_gradient_build(bs, &(fill_style->gradient), tag);
58 case 0x40: // tilled bitmap fill with smoothed edges
59 case 0x41: // clipped bitmap fill with smoothed edges
60 case 0x42: // tilled bitmap fill with hard edges
61 case 0x43: // clipped bitmap fill with hard edges
62 swf_fill_style_bitmap_build(bs, &(fill_style->bitmap), tag);
65 fprintf(stderr, "swf_fill_style_build: unknown fill_style->type=%d\n", fill_style->type);
72 swf_fill_style_print(swf_fill_style_t *fill_style, int indent_depth,
74 if (fill_style == NULL) {
75 fprintf(stderr, "swf_fill_style_print: fill_style == NULL\n");
78 printf("type=0x%02x\n", fill_style->type);
79 switch (fill_style->type) {
80 case 0x00: // solid fill
81 swf_fill_style_solid_print(&(fill_style->solid),
82 indent_depth + 1, tag);
84 case 0x10: // linear gradient fill
85 case 0x11: // radial gradient fill
86 case 0x12: // focal gradient fill
87 swf_fill_style_gradient_print(&(fill_style->gradient),
88 indent_depth + 1, tag);
90 case 0x40: // tilled bitmap fill with smoothed edges
91 case 0x41: // clipped bitmap fill with smoothed edges
92 case 0x42: // tilled bitmap fill with hard edges
93 case 0x43: // clipped bitmap fill with hard edges
94 swf_fill_style_bitmap_print(&(fill_style->bitmap),
95 indent_depth + 1, tag);
102 swf_fill_style_delete(swf_fill_style_t *fill_style) {
103 swf_fill_style_gradient_delete(&(fill_style->gradient));