[Swfed-svn] swfed-svn [132] - DefineShape の一階層分、parse 処理を実装

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 5月 26日 (火) 23:17:51 JST


Revision: 132
          http://svn.sourceforge.jp/view?root=swfed&view=rev&rev=132
Author:   yoya
Date:     2009-05-26 23:17:51 +0900 (Tue, 26 May 2009)

Log Message:
-----------
- DefineShape の一階層分、parse 処理を実装
- swf_tag から swf_tag_shape に処理を接続

Modified Paths:
--------------
    trunk/src/swf_tag.c
    trunk/src/swf_tag_shape.c
    trunk/src/swf_tag_shape.h


-------------- next part --------------
Modified: trunk/src/swf_tag.c
===================================================================
--- trunk/src/swf_tag.c	2009-05-25 16:36:50 UTC (rev 131)
+++ trunk/src/swf_tag.c	2009-05-26 14:17:51 UTC (rev 132)
@@ -15,11 +15,12 @@
 #include "swf_tag_action.h"
 #include "swf_tag_sound.h"
 #include "swf_tag_sprite.h"
+#include "swf_tag_shape.h"
 
 swf_tag_info_t swf_tag_info_table[] = {
     { 0, "End", NULL },
     { 1, "ShowFrame", NULL },
-    { 2, "DefineShape", NULL },
+    { 2, "DefineShape", swf_tag_shape_detail_handler },
     { 3, "FreeCharacter", NULL},
     { 4, "PlaceObject", NULL},
     { 5, "RemoveObject", NULL},
@@ -39,10 +40,10 @@
     { 19, "SoundStreamBlock", NULL },
     { 20, "DefineBitsLossless", swf_tag_lossless_detail_handler },
     { 21, "DefineBitsJPEG2", swf_tag_jpeg_detail_handler },
-    { 22, "DefineShape2", NULL },
+    { 22, "DefineShape2", swf_tag_shape_detail_handler },
     { 26, "PlaceObject2", NULL },
     { 28, "RemoveObject2", NULL },
-    { 32, "DefineShape3", NULL },
+    { 32, "DefineShape3", swf_tag_shape_detail_handler },
     { 33, "DefineText2", NULL },
     { 34, "DefineButton2", NULL },
     { 35, "DefineBitsJPEG3", swf_tag_jpeg3_detail_handler },
@@ -50,6 +51,7 @@
     { 37, "DefineEditText", swf_tag_edit_detail_handler },
     { 39, "DefineSprite", swf_tag_sprite_detail_handler },
     { 43, "FrameLabel", NULL } ,
+    { 46, "DefineMorphShape", swf_tag_shape_detail_handler },
     { 48, "DefineFont2", NULL } ,
     { 56, "Export", NULL } ,
     { 59, "DoInitAction", NULL } ,
@@ -57,7 +59,8 @@
     { 73, "DefineFontAlignZones", NULL },
     { 74, "CSMTextSettings", NULL },
     { 75, "DefineFont3", NULL } ,
-    { 83, "DefineShape4", NULL },
+    { 83, "DefineShape4", swf_tag_shape_detail_handler },
+    { 84, "DefineMorphShape2", swf_tag_shape_detail_handler },
     { 88, "DefineFontName", NULL } ,
     { 777,"Reflex", NULL } ,
 };

Modified: trunk/src/swf_tag_shape.c
===================================================================
--- trunk/src/swf_tag_shape.c	2009-05-25 16:36:50 UTC (rev 131)
+++ trunk/src/swf_tag_shape.c	2009-05-26 14:17:51 UTC (rev 132)
@@ -48,6 +48,31 @@
     bs = bitstream_open();
     bitstream_input(bs, data, length);
     swf_tag_shape->shape_id = bitstream_getbytesLE(bs, 2);
+    swf_rect_parse(bs, &(swf_tag_shape->rect));
+    // DefineMorphShape, DefineMorphShape2
+    swf_tag_shape->is_morph = (tag->tag == 46) || (tag->tag == 84);
+    // DefineShape4, DefineMorphShape2
+    swf_tag_shape->has_strokes = (tag->tag == 83) || (tag->tag == 84);
+
+    if (swf_tag_shape->is_morph) {
+        swf_rect_parse(bs, &(swf_tag_shape->rect_morph));
+    }
+    if (swf_tag_shape->has_strokes) {
+        swf_rect_parse(bs, &(swf_tag_shape->stroke_rect));
+        if (swf_tag_shape->is_morph) {
+            swf_rect_parse(bs, &(swf_tag_shape->stroke_rect_morph));
+        }
+        swf_tag_shape->define_shape_reserved = bitstream_getbits(bs, 6);
+        swf_tag_shape->define_shape_non_scaling_strokes = bitstream_getbits(bs, 1);
+        swf_tag_shape->define_shape_scaling_strokes = bitstream_getbits(bs, 1);
+    }
+    if (swf_tag_shape->is_morph) {
+        swf_tag_shape->offset_morph = bitstream_getbytesLE(bs, 4);
+        ; // swf_morph_shape_with_style_parse(bs, &swf_tag_shape->morph_shape_with_style);
+    } else {
+        ; // swf_morph_shape_with_style_parse(bs, &swf_tag_shape->shape_with_style);
+    }
+        
     bitstream_close(bs);
     return 0;
 }
@@ -92,10 +117,32 @@
 swf_tag_shape_print_detail(swf_tag_t *tag,
                            struct swf_object_ *swf, int indent_depth) {
     swf_tag_shape_detail_t *swf_tag_shape = (swf_tag_shape_detail_t *) tag->detail;
-    int i;
-    swf_tag_t *_tag;
+    (void) tag;
     print_indent(indent_depth);
-    printf("\tshape_id=%d\n", swf_tag_shape->shape_id);
+    printf("shape_id=%d\n", swf_tag_shape->shape_id);
+    print_indent(indent_depth);
+    printf("is_morph=%d has_strokes=%d\n",
+           swf_tag_shape->is_morph, swf_tag_shape->has_strokes);
+    if (swf_tag_shape->is_morph) {
+        swf_rect_print(&(swf_tag_shape->rect_morph), indent_depth);
+    }
+    if (swf_tag_shape->has_strokes) {
+        swf_rect_print(&(swf_tag_shape->stroke_rect), indent_depth);
+        if (swf_tag_shape->is_morph) {
+            swf_rect_print(&(swf_tag_shape->stroke_rect_morph), indent_depth);
+        }
+        print_indent(indent_depth);
+        printf("define_shape_non_scaling_strokes=%d define_shape_scaling_strokes=%d\n",
+               swf_tag_shape->define_shape_non_scaling_strokes,
+               swf_tag_shape->define_shape_scaling_strokes);
+    }
+    if (swf_tag_shape->is_morph) {
+        print_indent(indent_depth);
+        printf("offset_morph=%lu\n", swf_tag_shape->offset_morph);
+        ; // swf_morph_shape_with_style_print(&swf_tag_shape->morph_shape_with_style, indent_depth);
+    } else {
+        ; // swf_morph_shape_with_style_print(&swf_tag_shape->shape_with_style, indent_depth);
+    }
     return ;
 }
 

Modified: trunk/src/swf_tag_shape.h
===================================================================
--- trunk/src/swf_tag_shape.h	2009-05-25 16:36:50 UTC (rev 131)
+++ trunk/src/swf_tag_shape.h	2009-05-26 14:17:51 UTC (rev 132)
@@ -25,9 +25,9 @@
     //// is_morph
     swf_rect_t stroke_rect_morph;   // & MorphShape(1) or 2
     //
-    // 6bit reserved area
-    unsigned char define_shape_non_scaling_strokes;
-    unsigned char define_shape_scaling_strokes;
+    unsigned char define_shape_reserved : 6;    // 6bit reserved area
+    unsigned char define_shape_non_scaling_strokes : 1;
+    unsigned char define_shape_scaling_strokes : 1;
     // is_morph
     unsigned long offset_morph;
      swf_morph_shape_with_style_t  morph_shape_with_style;



Swfed-svn メーリングリストの案内
Back to archive index