PGメモ

非エンジニアの記録

swfmillで生成したxmlをひも解いてみる 短形置いてみた編

前回はシンプルはswfをxmlにしてみましたが、今回は短形ツールでシェイプを1つ作ってみました。
x座標が14、y座標が15、大きさが14pxの正方形です。

前回と同様の部分は割愛します。以下はの後に出てきます

      <DefineShape5 objectID="1" nonScalingStrokes="0" scalingStrokes="1">
        <bounds>
          <Rectangle left="270" right="570" top="290" bottom="590"/>
        </bounds>
        <strokeBounds>
          <Rectangle left="280" right="560" top="300" bottom="580"/>
        </strokeBounds>
        <styles>
          <StyleList>
            <fillStyles>
              <Solid>
                <color>
                  <Color red="0" green="102" blue="204" alpha="255"/>
                </color>
              </Solid>
            </fillStyles>
            <lineStyles>
              <LineStyle width="20" startCapStyle="0" jointStyle="0" hasFill="0" noHScale="0" noVScale="0" pixelHinting="0" reserved="0" noClose="0" endCapStyle="0">
                <fillColor>
                  <Color red="0" green="0" blue="0" alpha="255"/>
                </fillColor>
              </LineStyle>
            </lineStyles>
          </StyleList>
        </styles>
        <shapes>
          <Shape>
            <edges>
              <ShapeSetup x="560" y="300" fillStyle1="1" lineStyle="1"/>
              <LineTo x="0" y="280"/>
              <LineTo x="-280" y="0"/>
              <LineTo x="0" y="-280"/>
              <LineTo x="280" y="0"/>
              <ShapeSetup/>
            </edges>
          </Shape>
        </shapes>
      </DefineShape5>
      <PlaceObject2 replace="0" depth="1" objectID="1">
        <transform>
          <Transform transX="0" transY="0"/>
        </transform>
      </PlaceObject2>

ここからオブジェクト情報が記述されます
5って何でしょうね

<DefineShape5 objectID="1" nonScalingStrokes="0" scalingStrokes="1">

オブジェクトの大きさです。
boundsが塗りのみのオブジェクトを配置した範囲、strokeBoundsが線も塗りも含めたオブジェクトを配置した範囲です。線がない場合はboundsのみになります。

<bounds>
  <Rectangle left="270" right="570" top="290" bottom="590"/>
</bounds>
<strokeBounds>
  <Rectangle left="280" right="560" top="300" bottom="580"/>
</strokeBounds> 

stylesタグの中にオブジェクトのスタイルが記述されています。

<styles></styles>

塗りのスタイルです。colorはもちろん色

<fillStyles>
  <Solid>
    <color>
      <Color red="0" green="102" blue="204" alpha="255"/>
    </color>
  </Solid>
</fillStyles>

線のスタイルを定義します

<lineStyles>
  <LineStyle width="20" startCapStyle="0" jointStyle="0" hasFill="0" noHScale="0" noVScale="0" pixelHinting="0" reserved="0" noClose="0" endCapStyle="0">
    <fillColor>
      <Color red="0" green="0" blue="0" alpha="255"/>
    </fillColor>
  </LineStyle>
</lineStyles>

形を定義します。LineToは左上を起点としてそこから右、下、左、上に回っていきます

<shapes>
  <Shape>
    <edges>
      <ShapeSetup x="560" y="300" fillStyle1="1" lineStyle="1"/>
      <LineTo x="0" y="280"/>
      <LineTo x="-280" y="0"/>
      <LineTo x="0" y="-280"/>
      <LineTo x="280" y="0"/>
      <ShapeSetup/>
    </edges>
  </Shape>
</shapes>

ここで実際に描画するようです。

<PlaceObject2 replace="0" depth="1" objectID="1">
  <transform>
    <Transform transX="0" transY="0"/>
  </transform>
</PlaceObject2>