OSDN Git Service

add bitmap_id parameter into apply factor method.
[swfed/swfed.git] / src / swf_tag.h
1 /*
2   +----------------------------------------------------------------------+
3   | Author: yoya@awm.jp                                                  |
4   +----------------------------------------------------------------------+
5 */
6
7 #ifndef __SWF_TAG_H__
8 #define __SWF_TAG_H__
9
10 #include "bitstream.h"
11 #include "y_keyvalue.h"
12
13 struct swf_object_; // swf_object.h
14
15 typedef struct swf_tag_ {
16     int code;
17     unsigned long length;
18     int length_longformat;
19     //
20     unsigned char *data;
21     void *detail;
22     //
23     struct swf_tag_ *prev, *next;
24 } swf_tag_t;
25
26 typedef struct swf_tag_detail_handler_ {
27     void          * (*create)   (void);
28     int             (*input)    (swf_tag_t *tag, struct swf_object_ *swf);
29     int             (*get_cid)  (swf_tag_t *tag);
30     int             (*replace_cid) (swf_tag_t *tag, int cid);
31     unsigned char * (*output)   (swf_tag_t *tag, unsigned long *length,
32                                  struct swf_object_ *swf);
33     void            (*print)    (swf_tag_t *tag, struct swf_object_ *swf,
34                                  int indent_depth);
35     void            (*destroy)  (swf_tag_t *tag);
36 } swf_tag_detail_handler_t;
37
38 typedef struct swf_tag_info_ {
39     int id;
40     const char *name;
41     swf_tag_detail_handler_t *(*detail_handler)(void);
42 } swf_tag_info_t;
43
44 extern swf_tag_info_t *get_swf_tag_info(int tag_id);
45
46 extern swf_tag_t *swf_tag_create(bitstream_t *bs);
47 extern void swf_tag_destroy(swf_tag_t *tag);
48 extern int swf_tag_build(bitstream_t *bs, swf_tag_t *tag, struct swf_object_ *swf);
49 extern int swf_tag_rebuild(swf_tag_t *tag, struct swf_object_ *swf);
50 extern void swf_tag_print(swf_tag_t *tag, struct swf_object_ *swf, int indent_depth);
51 extern void *swf_tag_create_input_detail(swf_tag_t *tag, struct swf_object_ *swf);
52 extern void swf_tag_destroy_detail(swf_tag_t *tag);
53
54 extern int swf_tag_get_cid(swf_tag_t *tag);
55 extern int swf_tag_replace_cid(swf_tag_t *tag, int cid);
56
57 extern int swf_tag_get_refcid(swf_tag_t *tag);
58 extern int swf_tag_replace_refcid(swf_tag_t *tag, int cid);
59
60 /* image */
61
62 extern int swf_tag_get_bitmap_size(swf_tag_t *tag,
63                                    int *width, int *height);
64 extern int swf_tag_get_bitmap_color1stpixel(swf_tag_t *tag,
65                                             int *red, int *green, int *blue);
66
67 extern unsigned char *swf_tag_get_jpeg_data(swf_tag_t *tag, unsigned long *length, int image_id, swf_tag_t *tag_jpegtables);
68 extern unsigned char *swf_tag_get_alpha_data(swf_tag_t *tag, unsigned long *length, int image_id);
69 extern int swf_tag_replace_jpeg_data(swf_tag_t *tag, int image_id,
70                                      unsigned char *jpeg_data,
71                                      unsigned long jpeg_data_len,
72                                      unsigned char *alpha_data,
73                                      unsigned long alpha_data_len,
74                                      int without_converting);
75
76 extern unsigned char *swf_tag_get_png_data(swf_tag_t *tag, unsigned long *length, int image_id);
77 extern int swf_tag_replace_png_data(swf_tag_t *tag, int image_id,
78                                     unsigned char *png_data,
79                                     unsigned long png_data_len, int rgb15);
80 extern int swf_tag_replace_gif_data(swf_tag_t *tag, int image_id,
81                                     unsigned char *gif_data,
82                                     unsigned long gif_data_len);
83 extern int swf_tag_convert_bitmap_data_tojpegtag(swf_tag_t *tag);
84
85 /* sound */
86 extern unsigned char *swf_tag_get_sound_data(swf_tag_t *tag,
87                                              unsigned long *length,
88                                              int sound_id);
89 extern int swf_tag_replace_melo_data(swf_tag_t *tag, int sound_id,
90                                      unsigned char *melo_data,
91                                      unsigned long melo_data_len);
92 /* edit text */
93
94 extern char *swf_tag_get_edit_string(swf_tag_t *tag,
95                                      char *variable_name,
96                                      int variable_name_len,
97                                      int *error,
98                                      struct swf_object_ *swf);
99 extern int swf_tag_replace_edit_string(swf_tag_t *tag,
100                                        char *variable_name,
101                                        int variable_name_len,
102                                        char *initial_text,
103                                        int initial_text_len,
104                                        struct swf_object_ *swf);
105
106 extern int swf_tag_apply_shape_matrix_factor(swf_tag_t *tag, int shape_id,
107                                              int bitmap_id,
108                                              double scale_x, double scale_y,
109                                              double rotate_rad,
110                                              signed int trans_x,
111                                              signed int trans_y,
112                                              struct swf_object_ *swf);
113 extern int swf_tag_apply_shape_rect_factor(swf_tag_t *tag, int shape_id,
114                                            int bitmap_id,
115                                            double scale_x, double scale_y,
116                                            signed int trans_x,
117                                            signed int trans_y,
118                                            struct swf_object_ *swf);
119 extern int swf_tag_apply_shape_type_tilled(swf_tag_t *tag, int shape_id,
120                                            int bitmap_id,
121                                            struct swf_object_ *swf);
122
123 extern swf_tag_t *swf_tag_create_action_setvariables(y_keyvalue_t *kv);
124 extern int swf_tag_put_action_setvariables(swf_tag_t *tag,
125                                            y_keyvalue_t *kv,
126                                            struct swf_object_ *swf);
127
128 extern int swf_tag_replace_action_strings(swf_tag_t *tag,
129                                           y_keyvalue_t *kv,
130                                           int *modified,
131                                           struct swf_object_ *swf);
132
133 extern swf_tag_t * swf_tag_move(swf_tag_t *tag);
134
135 extern int swf_tag_search_cid_by_bitmap_condition(swf_tag_t *tag,
136                                                   int width, int height,
137                                                   int red, int green, int blue);
138
139
140 #endif /* __SWF_TAG_H__ */