Пример #1
0
 function buildContent($tagCode, $opts = array())
 {
     $opts['tagCode'] = $tagCode;
     $writer = new IO_Bit();
     $writer->putUI16LE($this->_CharacterID);
     IO_SWF_TYPE_RECT::build($writer, $this->_TextBounds);
     IO_SWF_Type_MATRIX::build($writer, $this->_TextMatrix);
     $glyphBits = $this->_GlyphBits;
     // XXX
     $advanceBits = $this->_AdvanceBits;
     // XXX
     $writer->putUI8($glyphBits);
     $writer->putUI8($advanceBits);
     $opts['GlyphBits'] = $glyphBits;
     $opts['AdvanceBits'] = $advanceBits;
     foreach ($this->_TextRecords as $textRecord) {
         IO_SWF_Type_TEXTRECORD::build($writer, $textRecord, $opts);
     }
     $writer->putUI8(0);
     // TEXTRECORD TERMINATER
     return $writer->output();
 }
Пример #2
0
 static function string($fillStyle, $opts = array())
 {
     $tagCode = $opts['tagCode'];
     $isMorph = $tagCode == 46 || $tagCode == 84;
     $text = '';
     $fillStyleType = $fillStyle['FillStyleType'];
     switch ($fillStyleType) {
         case 0x0:
             // solid fill
             if ($isMorph === false) {
                 $color = $fillStyle['Color'];
                 if ($tagCode < 32) {
                     // 32:DefineShape3
                     $color_str = IO_SWF_Type_RGB::string($color);
                 } else {
                     $color_str = IO_SWF_Type_RGBA::string($color);
                 }
                 $text .= "solid fill: {$color_str}\n";
             } else {
                 $startColor = $fillStyle['StartColor'];
                 $endColor = $fillStyle['EndColor'];
                 $startColor_str = IO_SWF_Type_RGBA::string($startColor);
                 $endColor_str = IO_SWF_Type_RGBA::string($endColor);
                 $text .= "solid fill: {$startColor_str} => {$endColor_str}\n";
             }
             break;
         case 0x10:
             // linear gradient fill
         // linear gradient fill
         case 0x12:
             // radial gradient fill
             if ($fillStyleType == 0x10) {
                 $text .= "linear gradient fill\n";
             } else {
                 $text .= "radial gradient fill\n";
             }
             $opts = array('indent' => 2);
             if ($isMorph === false) {
                 $matrix_str = IO_SWF_Type_MATRIX::string($fillStyle['GradientMatrix'], $opts);
                 $text .= $matrix_str . "\n";
                 $spreadMode = $fillStyle['SpreadMode'];
                 $interpolationMode = $fillStyle['InterpolationMode'];
             } else {
                 $matrix_str = IO_SWF_Type_MATRIX::string($fillStyle['StartGradientMatrix'], $opts);
                 $matrix_str = IO_SWF_Type_MATRIX::string($fillStyle['EndGradientMatrix'], $opts);
                 $text .= $matrix_str . "\n";
             }
             foreach ($fillStyle['GradientRecords'] as $gradientRecord) {
                 if ($isMorph === false) {
                     $ratio = $gradientRecord['Ratio'];
                     $color = $gradientRecord['Color'];
                     if ($tagCode < 32) {
                         // 32:DefineShape3
                         $color_str = IO_SWF_Type_RGB::string($color);
                     } else {
                         $color_str = IO_SWF_Type_RGBA::string($color);
                     }
                     $text .= "\t\tRatio: {$ratio} Color:{$color_str}\n";
                 } else {
                     $startRatio = $gradientRecord['StartRatio'];
                     $startColorStr = IO_SWF_Type_RGBA::string($gradientRecord['StartColor']);
                     $endRatio = $gradientRecord['EndRatio'];
                     $endColorStr = IO_SWF_Type_RGBA::string($gradientRecord['EndColor']);
                     $text .= "\t\tStart: Ratio:{$startRatio} Color:{$startColorStr} => End: Ratio:{$endRatio} Color:{$endColorStr}\n";
                 }
             }
             break;
         case 0x40:
             // repeating bitmap fill
         // repeating bitmap fill
         case 0x41:
             // clipped bitmap fill
         // clipped bitmap fill
         case 0x42:
             // non-smoothed repeating bitmap fill
         // non-smoothed repeating bitmap fill
         case 0x43:
             // non-smoothed clipped bitmap fill
             $text .= "Bitmap({$fillStyleType}): ";
             $text .= "  BitmapId: " . $fillStyle['BitmapId'] . "\n";
             if ($isMorph === false) {
                 $text .= "\tBitmapMatrix:\n";
                 $opts = array('indent' => 2);
                 $matrix_str = IO_SWF_Type_MATRIX::string($fillStyle['BitmapMatrix'], $opts);
                 $text .= $matrix_str . "\n";
             } else {
                 $opts = array('indent' => 2);
                 $text .= "\tStartBitmapMatrix:\n";
                 $matrix_str = IO_SWF_Type_MATRIX::string($fillStyle['StartBitmapMatrix'], $opts);
                 $text .= $matrix_str . "\n";
                 $text .= "\tEndBitmapMatrix:\n";
                 $matrix_str = IO_SWF_Type_MATRIX::string($fillStyle['EndBitmapMatrix'], $opts);
                 $text .= $matrix_str . "\n";
             }
             break;
         default:
             $text .= "Unknown FillStyleType({$fillStyleType})\n";
     }
     return $text;
 }
Пример #3
0
 static function string($buttonrecord, $opts = array())
 {
     $text = '';
     $buttonHasBlendMode = $buttonrecord['ButtonHasBlandMode'];
     $buttonHasFilterList = $buttonrecord['ButtonHasFilterList'];
     $text .= "HasBlandMode:" . $buttonrecord['ButtonHasBlandMode'] . ' HasFilterList:' . $buttonrecord['ButtonHasFilterList'] . "\n\t\t";
     foreach (array('StateHitTest', 'StateDown', 'StateOver', 'StateUp') as $label) {
         $text .= $label . ':' . $buttonrecord['Button' . $label] . ' ';
     }
     $text .= "\n\t\t";
     $text .= "CharacterID:{$buttonrecord['CharacterID']} PlaceDepth:{$buttonrecord['PlaceDepth']}";
     $text .= "\n";
     $opts['indent']++;
     $text .= IO_SWF_Type_MATRIX::string($buttonrecord['PlaceMatrix'], $opts) . "\n";
     if ($opts['tagCode'] == 34) {
         // DefineButton2
         $text .= "\t\tColorTransform:" . IO_SWF_Type_CXFORMWITHALPHA::string($buttonrecord['ColorTransform']) . ' ';
     } else {
         $text .= 'ColorTransform:' . IO_SWF_Type_CXFORM::string($buttonrecord['ColorTransform']) . ' ';
     }
     if ($opts['tagCode'] == 34 && $opts['Version'] >= 8) {
         // DefineButton2 & SWF8 later
         if ($buttonHasFilterList == 1) {
             $text .= 'FilterList:' . IO_SWF_Type_FILTERLIST::string($buttonrecord['FilterList']) . "\n";
         }
         if ($buttonHasBlendMode == 1) {
             $text .= 'BlendMode:' . $buttonrecord['BlendMode'] . "\n";
         }
     }
     return $text;
 }
Пример #4
0
 function buildContent($tagCode, $opts = array())
 {
     $writer = new IO_Bit();
     switch ($tagCode) {
         case 4:
             // PlaceObject
             $this->_characterId = $writer->getUI16LE();
             $this->_depth = $writer->getUI16LE();
             $this->_matrix = IO_SWF_Type_MATRIX::parse($writer);
             if ($writer->hasNextData()) {
                 // optional
                 $this->_colorTransform = IO_SWF_Type_CXFORM::parse($writer);
             }
             break;
         case 26:
             // PlaceObject2
             //
             if (is_null($this->_characterId) === false) {
                 $this->_placeFlagHasCharacter = 1;
             } else {
                 $this->_placeFlagHasCharacter = 0;
             }
             if (is_null($this->_matrix) === false) {
                 $this->_placeFlagHasMatrix = 1;
             } else {
                 $this->_placeFlagHasMatrix = 0;
             }
             if (is_null($this->_colorTransform) === false) {
                 $this->_placeFlagHasColorTransform = 1;
             } else {
                 $this->_placeFlagHasColorTransform = 0;
             }
             if (is_null($this->_ratio) === false) {
                 $this->_placeFlagHasRatio = 1;
             } else {
                 $this->_placeFlagHasRatio = 0;
             }
             if (is_null($this->_name) === false) {
                 $this->_placeFlagHasName = 1;
             } else {
                 $this->_placeFlagHasName = 0;
             }
             if (is_null($this->_clipDepth) === false) {
                 $this->_placeFlagHasClipDepth = 1;
             } else {
                 $this->_placeFlagHasClipDepth = 0;
             }
             if (is_null($this->_clipActions) === false) {
                 $this->_placeFlagHasClipActions = 1;
             } else {
                 $this->_placeFlagHasClipActions = 0;
             }
             // placeFlag
             $writer->putUIBit($this->_placeFlagHasClipActions);
             $writer->putUIBit($this->_placeFlagHasClipDepth);
             $writer->putUIBit($this->_placeFlagHasName);
             $writer->putUIBit($this->_placeFlagHasRatio);
             $writer->putUIBit($this->_placeFlagHasColorTransform);
             $writer->putUIBit($this->_placeFlagHasMatrix);
             $writer->putUIBit($this->_placeFlagHasCharacter);
             $writer->putUIBit($this->_placeFlagMove);
             //
             $writer->putUI16LE($this->_depth);
             if ($this->_placeFlagHasCharacter) {
                 $writer->putUI16LE($this->_characterId);
             }
             if ($this->_placeFlagHasMatrix) {
                 IO_SWF_Type_MATRIX::build($writer, $this->_matrix);
             }
             if ($this->_placeFlagHasColorTransform) {
                 IO_SWF_Type_CXFORMWITHALPHA::build($writer, $this->_colorTransform);
             }
             if ($this->_placeFlagHasRatio) {
                 $writer->putUI16LE($this->_ratio);
             }
             if ($this->_placeFlagHasName) {
                 IO_SWF_Type_String::build($writer, $this->_name);
             }
             if ($this->_placeFlagHasClipDepth) {
                 $writer->putUI16LE($this->_clipDepth);
             }
             if ($this->_placeFlagHasClipActions) {
                 IO_SWF_Type_CLIPACTIONS::build($writer, $this->_clipActions, $opts);
             }
             break;
     }
     return $writer->output();
 }