2 +----------------------------------------------------------------------+
3 | Author: yoya@awm.jp |
4 +----------------------------------------------------------------------+
7 #ifndef __SWF_OBJECT_H__
8 #define __SWF_OBJECT_H__
10 #include "y_keyvalue.h"
11 #include "swf_header.h"
12 #include "swf_header.h"
14 #include "swf_tag_sprite.h"
16 typedef struct swf_object_ {
18 swf_header_movie_t header_movie;
19 swf_tag_t *tag_head, *tag_tail;
20 unsigned shape_adjust_mode;
21 unsigned compress_level;
24 #define SWFED_SHAPE_BITMAP_NONE 0
25 #define SWFED_SHAPE_BITMAP_MATRIX_RESCALE 1
26 #define SWFED_SHAPE_BITMAP_RECT_RESIZE 2
27 #define SWFED_SHAPE_BITMAP_TYPE_TILLED 4
29 extern swf_object_t *swf_object_open(void);
30 extern void swf_object_close(swf_object_t *swf);
31 extern int swf_object_input(swf_object_t *swf, unsigned char *data, unsigned long data_len);
32 extern unsigned char *swf_object_output(swf_object_t *swf, unsigned long *length);
33 extern void swf_object_print(swf_object_t *swf);
37 extern int swf_object_rebuild(swf_object_t *swf);
38 extern void swf_object_purge_contents(swf_object_t *swf);
42 extern unsigned char *swf_object_get_tagdata(swf_object_t *swf, int tag_seqno,
43 unsigned long *length);
44 extern int swf_object_replace_tagdata(swf_object_t *swf, int tag_seqno,
46 unsigned long length);
47 extern unsigned char *swf_object_get_tagdata_bycid(swf_object_t *swf,
49 unsigned long *length);
50 extern int swf_object_replace_tagdata_bycid(swf_object_t *swf,
53 unsigned long length);
54 extern unsigned char *swf_object_get_tagcontents_bycid(swf_object_t *swf,
56 unsigned long *length);
57 extern int swf_object_replace_tagcontents_bycid(swf_object_t *swf, int cid,
59 unsigned long length);
60 extern int swf_object_remove_tag(swf_object_t *swf, int tag_seqno,
61 int tag_seqno_in_sprite);
62 extern int swf_object_print_tagdata(swf_object_t *swf,
63 unsigned char *data, unsigned long length);
68 extern swf_tag_t *swf_object_search_tag_byseqno(swf_object_t *swf,
70 extern swf_tag_t *swf_object_search_tag_in_sprite_byseqno(swf_tag_sprite_detail_t *sprite, int tag_seqno);
72 extern swf_tag_t *swf_object_search_tag_bycid(swf_object_t *swf,
74 extern swf_tag_t *swf_object_search_shape_tag(swf_object_t *swf,
77 extern swf_tag_t *swf_object_search_bitmap_tag(swf_object_t *swf,
79 extern int swf_object_search_cid_by_bitmap_condition(swf_object_t *swf,
80 int width, int height,
81 int red, int green, int blue);
85 extern unsigned char *swf_object_get_shapedata(swf_object_t *swf,
87 unsigned long *length);
88 extern int swf_object_replace_shapedata(swf_object_t *swf, int shape_id,
90 unsigned long length);
91 extern int swf_object_set_shape_adjust_mode(swf_object_t *swf, unsigned mode);
92 extern int swf_object_adjust_shapebitmap(swf_object_t *swf, int bitmap_id,
93 int old_width, int old_height,
94 int new_width, int new_height);
96 extern int swf_object_get_bitmap_size(swf_object_t *swf, int bitmap_id,
97 int *width, int *height);
101 extern unsigned char *swf_object_get_jpegdata(swf_object_t *swf, unsigned long *length, int image_id);
102 extern unsigned char *swf_object_get_alphadata(swf_object_t *swf, unsigned long *length, int image_id);
103 extern int swf_object_replace_jpegdata(swf_object_t *swf, int image_id,
104 unsigned char *jpeg_data,
105 unsigned long jpeg_data_len,
106 unsigned char *alpha_data,
107 unsigned long alpha_data_len);
108 extern unsigned char *swf_object_get_pngdata(swf_object_t *swf, unsigned long *length, int image_id);
109 extern int swf_object_replace_pngdata(swf_object_t *swf, int image_id,
110 unsigned char *png_data,
111 unsigned long png_data_len);
112 extern int swf_object_replace_gifdata(swf_object_t *swf, int image_id,
113 unsigned char *gif_data,
114 unsigned long gif_data_len);
115 extern unsigned char *swf_object_get_sounddata(swf_object_t *swf, unsigned long *length, int sound_id);
116 extern int swf_object_replace_melodata(swf_object_t *swf, int sound_id,
117 unsigned char *melo_data,
118 unsigned long melo_data_len);
119 extern char *swf_object_get_editstring(swf_object_t *swf,
121 int variable_name_len);
122 extern int swf_object_replace_editstring(swf_object_t *swf,
124 int variable_name_len,
126 int initial_text_len);
127 extern unsigned char *swf_object_get_actiondata(swf_object_t *swf, unsigned long *length, int tag_seqno);
128 extern int swf_object_insert_action_setvariables(swf_object_t *swf,
131 extern int swf_object_replace_action_strings(swf_object_t *swf,
134 extern int swf_object_replace_movieclip(swf_object_t *swf,
135 unsigned char *instance_name,
136 int instancee_name_len,
137 unsigned char *swf_data,
140 extern int swf_object_apply_shapematrix_factor(swf_object_t *swf,int shape_id,
141 double scale_x, double scale_y,
145 extern int swf_object_apply_shaperect_factor(swf_object_t *swf,int shape_id,
146 double scale_x, double scale_y,
149 extern int swf_object_apply_shapetype_tilled(swf_object_t *swf,int shape_id);
154 extern int swf_object_is_shape_tagdata(unsigned char *data, int data_len);
156 extern int swf_object_is_bitmap_tagdata(unsigned char *data, int data_len);
157 extern int swf_object_replace_tag(struct swf_object_ *swf,
158 swf_tag_t *old_tag, swf_tag_t *new_tag);
161 #endif /* __SWF_OBJECT_H__ */