• 追加された行はこの色です。
  • 削除された行はこの色です。
  • Flash/SWF/format/Shape へ行く。

TITLE:Flash SWF format - Shape

- ベクター画像を表現するタグ。 ビットマップ貼り付けやグラデーションも対応。あとモーフも。

#contents

* (2) DefineShape [#tag2]

- http://www.m2osw.com/swf_tag_defineshape

 +---------------------------------------------------+
 | tag & length | shape_id | rect | shape_with_style |
 |  2           |          |      |                  |
 +---------------------------------------------------+
 < 2 or 6 bytes ><-2 bytes><-RECT->
                 <------------------  length -------->

- shape_with_style

 +------------------------------------------------------+
 |fill_style|line_style|fill_bits|line_bits|   shape    |
 |  array   |  array   |  count  |  count  |   records  |
 +------------------------------------------------------+
 <--     STYLES     --> <-4 bits-><-4 bits-><-- SHAPE -->

-- fill_style_array
 +---------------------------------------+
 | count | fill_style | fill_style | ... |
 +---------------------------------------+
 <-1 byte><----- count 個分 ------------->
--- fill_style (solid: type=0x00)
 +-------------------------------+
 | type  |  red  | green | blue  |
 +-------------------------------+
 <-1 byte><-----  3 bytes ------>
--- fill_style (gradient: type=0x10, 0x12, 0x13)
 +-----------------------------+
 | type  |  matrix  | gradient |
 +-----------------------------+
 <-1 byte><-MATRIX->
 * gradient
 +--------------------------------------------------------+
 | pad | count | gradient_record | gradient_record |  ... | 
 +--------------------------------------------------------+
 <4bits><4bits->  <------ count 個分 ---------->
 * gradient_record
 +-----------------------------------+
 | position |  red  |  green |  blue |
 +-----------------------------------+
 <- 1 byte ->< 1byte>< 1byte>< 1byte >

--- fill_style (bitmap: type=0x40, 0x41, 0x42, 0x43)
 +-------------------------------------+
 | type  |  bitmap_ref | bitmap_matrix |
 +-------------------------------------+
 <-1 byte> <- 2 bytes -> <-MATRIX->
-- line_style_array
 +---------------------------------------+
 | count | line_style | line_style | ... |
 +---------------------------------------+
 <-1 byte><----- count 個分 ------------->
--- line_style
 +--------------------------------+
 | width  |  red  | green | blue  |
 +--------------------------------+
 <-2bytes><-----  3 bytes ------>
-- shape_record
--- shape_record_end
 +--------+
 | 000000 |
 +--------+
 <-6 bits->
--- shape_record_setup
 +-----------------------------------------------------+
 | 00WXYZ | move | move| move|  fill  |  fill  | line  |
 |        | size |  x  |  y  | style0 | style1 | style |
 +-----------------------------------------------------+
 <-6 bits-><5bits>/move\/move\/numfill\/numfill\/numline\
                  \size/\size/\ bits  /\ bits / \ bits  /
           <--- if Z==1 ---> <if Y==1><if X==1><if W==1>
--- shape_record_edge
 +--------------------------+
 | 1 |edge_type| coord_size |
 +--------------------------+
 <1bit><-1bit-> <- 4 bits -->
--- shape_record_edge (edge_type:0) spline curve
 +-----------------------------------------------+
 | 1 | 0 | coord |control|control| anchor| anchor|
 |   |   | size  |delta_x|delta_y|delta_x|delta_y|
 +-----------------------------------------------+
 <1bi 1bi><4bits>/coord \/coord \/coord \/coord \
                 \size+2/\size+2/\size+2/\size+2/

--- shape_record_edge (edge_type:1) straight line
 +-----------------------------------+
 | 1 | 1 | coord |x_and| delta| delta| slanted line (斜線)
 |   |   | size  |y = 1|  _x  |  _y  |
 +-----------------------------------+
 <1bi 1bi><4bits><1bit>/coord \/coord \
                       \size+2/\size+2/
  ----------------------------------+
             ... |x_and|has_x |delta| horizontal line
                 |y = 0|or_y=0| _x  |
                       |has_x |delta| vertical line
                       |or_y=1| _y  |
  ----------------------------------+
 <1bi 1bi><4bits><1bit><1bit> /coord \
                              \size+2/