TITLE:Flash SWF 仕様 - 仕様書 -- http://www.adobe.com/devnet/swf/ --- flash_fileformat_specification.pdf ---- 以下、気まぐれに意訳。 (三日坊主に終わるかも) #contents * Instoduction [#intro] - SWF ファイルフォーマットはインターネット上でベクター画像/ビデオ/音声を運ぶもの。 - 運ぶものであって、画像エディターで画像をやり取りするものではない。 - 以下の目標をもって設計されている - On-screen display -- The format is primarily intended for on-screen display and supports anti-aliasing, fast rendering to a bitmap of any color format, animation, and interactive buttons. - Extensibility (拡張性) - タグ・フォーマットの為、新しい機能に対して拡張する際にも、古いバージョンの Flash Player に対して後方互換性を保つ事が出来る。 - Network delivery (ネットワーク伝達) -- このフォーマットは、限られた帯域で帯域予約もないネットワークを介して伝送できる。 -- このファイルは圧縮で小さくでき、かつ、ストリーミングを通してインクリメンタル(訳注: 先頭から読まれた順番に)にレンダリングできる。 -- SWF ファイルフォーマットはバイナリフォーマットであり、HTML のような人が読めるもの(human readable)ではない。 -- SWF ファイルフォーマットは、bit-packing や optional fields といった技術を用いて、ファイルサイズを最小化している - Simplicity (簡易性) -- フォーマットがシンプルな為、Flash Player は小さく移植も易しい。 -- その上、Flash Player が依存する OS の機能は限られたものとなる。 - File independence -- The files display with minimal dependence on external resources such as fonts. - Scalability -- The files work well on limited hardware, and can take advantage of better hardware when it is available. -- This ability is important because computers have different monitor resolutions and bit depths. - Speed -- The graphics described by SWF files render quickly. - Scriptability -- このフォーマットは、スタックマシーンで解釈できるバイトコード列を供給するタグを含む。 -- このバイトコードは、ActionScript(R) 言語をサポートする。 -- Flash Player provides a runtime ActionScript object model that allows interaction with drawing primitives, servers, and features of Flash Player. - SWF ファイルは .swf の拡張子と、application/x-shockwave-flash の MIME type を持つ。 - SWF フォーマットは幾つものバージョンを通して発展している。 -- Through SWF 5, substantial additions were made to the SWF tag set. -- SWF 5 に至るまでに、SWF tag set に多くの追加がなされた。 -- SWF 6 からは、SWF フォーマットの変化は少なく、新しい機能として ACtionScript レベルでの一部、又は全部の実装がなされている。 -- SWF 9 からは、ActionScript Virtual Machine 2 (AVM2) を使う ActionScript 3.0 language が利用できるようになった。 - Anyone planning to generate SWF file content that uses newer features should become familiar with the ActionScript object model that Flash Player exposes. - Some references for this information are Programming ActionScript 3.0 (see www.adobe.com/go/learn_fl_cs4_programmingAS3_en), ActionScript 3.0 Language Reference (see www.adobe.com/go/learn_flashcs4_langref_en), and the Adobe ActionScript Virtual Machine 2 Overview (PDF file) at www.adobe.com/go/avm2overview. - Adobe seriously considers all feedback to the SWF file format specification. - E-mail any unclear or potentially erroneous information within the specification to Adobe at flashformat@adobe.com. - All such email submissions shall be subject to the Submitted Materials guidelines in the Terms of Use at www.adobe.com/misc/copyright.html. ** What’s new in SWF 10 [#whats-new-swf10] * Basic Data Types [#basic-data-types] ** Coordinates and twips [#cord-twips] - SWF ファイルフォーマットは x-y 座標を(通常、twip と呼ばれる)整数で保存する。 - SWF ファイルフォーマットの twip は論理 pixel の 1/20 である。 - 論理 pixel はスクリーン上で(拡大縮小せずに)100% スケールで再生したときの pixel である。例えば、800 twips x 400 twips の長方形は、40 x 20 の論理 pixel にレンダリングされる。 - 少数点以下の pixel サイズはアンチエイリアシングで近似される。790x390 twips ( 39.5 x 19.5 pixels) は少しぼやけたエッジで表される。 - twips はサイズと精度の良い折衷案である。これによって、極小な座標を処理している間も、ズーミングやオブジェクトの正確な配置に際して、sub-pixel(訳注: 1 pixel 以下)に対する正確さがもたらされる。 - SWF ファイルフォーマットの座標は、伝統的なグラフィックの座標軸を持つ。 -- x は水平方向に、左の最小値から右の最大値まで続く。 -- y は垂直方向で、上の最小値から下の最大値に続く。 ** Integer types and byte order [#int-byteorder] - SWF ファイルフォーマットは 8-bit, 16-bit, 32bit, 64-bite, signed, unsigned の整数型を使う - 全ての整数値は SWF ファイルに little-endian の byte order で格納される。 -- 最小位 bit (LSB)が初めに格納され、最上位 bit (MSB)が最後に格納される。この方式は Intel x86 アーキテクチャと同じ。 - SWF ファイルフォーマットのバイト中の bit order は big-endian である。 -- 最上位 bit (MSB)が初めに格納され、最小位 bit (LSB)が最後に格納される。 - 例) -- 32-bit 値 0x456e7120 は 20 71 6e 45 として格納される。 -- 16 bit 値 0xe712 は 12 e7 として格納される。 - 全ての整数型は byte-aligned (訳注: bit-packing 等で byte 境界を跨がないように、byte の頭に揃えて保存する事) されなければならない。 -- すなわち、整数値の最初の bit は、SWF ファイルの byte の最初の bit に保存しなければならない。 - 符号あり整数(Signed integers) は伝統的な 2 の補数の bit パターンで表現される。 - いまどきのプラットフォームで表現される符号あり整数、そのものである。 - 2の補数のシステムでは、負の数は最初の bit が 1 であり、0 や正の数は最初の bit が 0 である。 - 負の値 -n は正の値 n-1 のビットを反転したものとして表現される。 -整数型 | 型 | コメント | | SI8 | 符号付き 8-bit 整数値 | | SI16 | 符号付き 16-bit 整数値 | | SI32 | 符号付き 32-bit 整数値 | | SI8[n] | 符号付き 8-bit の配列、n は配列の要素数 | | SI16[n] | 符号付き 16-bit の配列、n は配列の要素数 | | UI8 | 符号なし 8-bit 整数値 | | UI16 | 符号なし 16-bit 整数値 | | UI32 | 符号なし 32-bit 整数値 | | UI8[n] | 符号なし 8-bit の配列、n は配列の要素数 | | UI16[n] | 符号なし 16-bit の配列、n は配列の要素数 | | UI32[n] | 符号なし 32-bit の配列、n は配列の要素数 | | UI64[n] | 符号なし 64-bit の配列、n は配列の要素数 | ** Fixed-point numbers [#fixed-point-num] - SWF ファイルフォーマットは 32-bit と 16-bit の2つの固定小数点数(fixed-point numbers)の型をサポートしている。 - 32-bit 固定小数点数は 16.16 である。 - すなわち、上位 16 bits が小数点の前の数を表わし、下位 16 bits が小数点の後の数を表わす。 - FIXED values は SWF ファイルに 32-bit のように格納され(little-endian byte order が使われる)、byte aligned でなければならない。 - 例) -- The real value 7.5 is equivalent to: 0x0007.8000. -- This value is stored in the SWF file as: 00 80 07 00. - SWF 8 and later supports 16-bit 8.8 signed, fixed-point numbers. - The high 8 bits represent the number before the decimal point, and the low 8 bits represent the number after the decimal point. - FIXED8 values are stored like 16-bit integers in the SWF file (using littleendian byte order) and must be byte aligned. |