OSDN Git Service

delete png_set_gAMA
[swfed/swfed.git] / src / swf_object.h
1 /*
2   +----------------------------------------------------------------------+
3   | Author: yoya@awm.jp                                                  |
4   +----------------------------------------------------------------------+
5 */
6
7 #ifndef __SWF_OBJECT_H__
8 #define __SWF_OBJECT_H__
9
10 #include "y_keyvalue.h"
11 #include "swf_header.h"
12 #include "swf_header.h"
13 #include "swf_tag.h"
14 #include "swf_tag_sprite.h"
15
16 typedef struct swf_object_ {
17     swf_header_t header;
18     swf_header_movie_t header_movie;
19     swf_tag_t *tag_head, *tag_tail;
20     unsigned shape_adjust_mode;
21     unsigned compress_level;
22 } swf_object_t;
23
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
28
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);
34
35 /* --- */
36
37 extern int swf_object_rebuild(swf_object_t *swf);
38 extern void swf_object_purge_contents(swf_object_t *swf);
39
40 /* --- */
41
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,
45                                       unsigned char *data,
46                                       unsigned long length);
47 extern unsigned char *swf_object_get_tagdata_bycid(swf_object_t *swf,
48                                                    int cid,
49                                                    unsigned long *length);
50 extern int swf_object_replace_tagdata_bycid(swf_object_t *swf,
51                                             int cid,
52                                             unsigned char *data,
53                                             unsigned long length);
54 extern unsigned char *swf_object_get_tagcontents_bycid(swf_object_t *swf,
55                                                        int cid,
56                                                        unsigned long *length);
57 extern int swf_object_replace_tagcontents_bycid(swf_object_t *swf, int cid,
58                                                 unsigned char *data,
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);
64
65
66 /* --- */
67
68 extern swf_tag_t *swf_object_search_tag_byseqno(swf_object_t *swf,
69                                                 int tag_seqno);
70 extern swf_tag_t *swf_object_search_tag_in_sprite_byseqno(swf_tag_sprite_detail_t *sprite, int tag_seqno);
71
72 extern swf_tag_t *swf_object_search_tag_bycid(swf_object_t *swf,
73                                                 int cid);
74 extern swf_tag_t *swf_object_search_shape_tag(swf_object_t *swf,
75                                                int shape_id);
76
77 extern swf_tag_t *swf_object_search_bitmap_tag(swf_object_t *swf,
78                                                int bitmap_id);
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);
82
83 /* --- */
84
85 extern unsigned char *swf_object_get_shapedata(swf_object_t *swf,
86                                                int shape_id,
87                                                unsigned long *length);
88 extern int swf_object_replace_shapedata(swf_object_t *swf, int shape_id,
89                                         unsigned char *data,
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);
95
96 extern int swf_object_get_bitmap_size(swf_object_t *swf, int bitmap_id,
97                                       int *width, int *height);
98
99 /* --- */
100
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,
120                                        char *variable_name,
121                                        int variable_name_len);
122 extern int swf_object_replace_editstring(swf_object_t *swf,
123                                          char *variable_name,
124                                          int variable_name_len,
125                                          char *initial_text,
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,
129                                                  y_keyvalue_t *kv);
130
131 extern int swf_object_replace_action_strings(swf_object_t *swf,
132                                              y_keyvalue_t *kv);
133
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,
138                                         int swf_data_len);
139
140 extern int swf_object_apply_shapematrix_factor(swf_object_t *swf,int shape_id,
141                                                double scale_x, double scale_y,
142                                                double rotate_rad,
143                                                signed int trans_x,
144                                                signed int trans_y);
145 extern int swf_object_apply_shaperect_factor(swf_object_t *swf,int shape_id,
146                                              double scale_x, double scale_y,
147                                              signed int trans_x,
148                                              signed int trans_y);
149 extern int swf_object_apply_shapetype_tilled(swf_object_t *swf,int shape_id);
150
151
152 /* --- */
153
154 extern int swf_object_is_shape_tagdata(unsigned char *data, int data_len);
155
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);
159
160
161 #endif /* __SWF_OBJECT_H__ */