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; }
static function string($textrecord, $opts = array()) { $text = ''; if ($textrecord['StyleFlagsHasFont']) { $text .= "FontID: {$textrecord['FontID']} TextHeight: {$textrecord['TextHeight']} "; } if ($textrecord['StyleFlagsHasColor']) { if ($opts['tagCode'] == 11) { // DefintText $color_str = IO_SWF_Type_RGB::string($textrecord['TextColor']); } else { // DefineText2 $color_str = IO_SWF_Type_RGBA::string($textrecord['TextColor']); } $text .= "TextColor: {$color_str} "; } if ($textrecord['StyleFlagsHasXOffeet']) { $text .= "XOffset: {$textrecord['XOffset']}"; } if ($textrecord['StyleFlagsHasYOffeet']) { $text .= "YOffset: {$textrecord['YOffset']}"; } if ($text != '') { $text .= "\n\t"; } $text .= "GryphEntries:"; foreach ($textrecord['GlyphEntries'] as $glyphEntrie) { $text .= "\n\t\t" . IO_SWF_Type_GLYPHENTRY::string($glyphEntrie, $opts); } $text .= "\n"; return $text; }
static function string($lineStyle, $opts = array()) { $tagCode = $opts['tagCode']; $isMorph = $tagCode == 46 || $tagCode == 84; $text = ''; if ($isMorph === false) { $text .= "Width:{$lineStyle['Width']} "; if ($tagCode == 83) { // DefineShape4 $text .= "StartCapStyle:{$lineStyle['StartCapStyle']} JoinStyle:{$lineStyle['JoinStyle']} "; $text .= "HasFillFlag:{$lineStyle['HasFillFlag']} NoHScaleFlag:{$lineStyle['NoHScaleFlag']} NoVScaleFlag:{$lineStyle['NoVScaleFlag']} PixelHintingFlag:{$lineStyle['PixelHintingFlag']} "; } if ($tagCode < 32) { // DefineShape1,2 $color_str = IO_SWF_Type_RGB::string($lineStyle['Color']); $text .= "Color: {$color_str} "; } else { if ($tagCode == 32) { // DefineShape3 $color_str = IO_SWF_Type_RGBA::string($lineStyle['Color']); $text .= "Color: {$color_str} "; } else { // DefineShape4 if ($lineStyle['HasFillFlag'] == 0) { $color_str = IO_SWF_Type_RGBA::string($lineStyle['Color']); $text .= "Color: {$color_str} "; } else { $filltype_str = IO_SWF_Type_FILLSTYLE::string($lineStyle['FillType']); $text .= "FillType: " . $filltype_str; } } } } else { $startWidth = $lineStyle['StartWidth']; $endWidth = $lineStyle['EndWidth']; $startColorStr = IO_SWF_Type_RGBA::string($lineStyle['StartColor']); $endColorStr = IO_SWF_Type_RGBA::string($lineStyle['EndColor']); $text .= "Width: {$startWidth} => {$endWidth} Color: {$startColorStr} => {$endColorStr} "; } return $text . PHP_EOL; }
function buildContent($tagCode, $opts = array()) { $writer = new IO_Bit(); $writer->putUI16LE($this->CharacterID); IO_SWF_Type_RECT::build($writer, $this->Bounds); // ---- $hasText = is_null($this->InitialText) ? 0 : 1; $hasTextColor = is_null($this->TextColor) ? 0 : 1; $hasMaxLength = is_null($this->MaxLength) ? 0 : 1; $hasFont = is_null($this->FontID) ? 0 : 1; $hasFontClass = is_null($this->FontClass) ? 0 : 1; $hasLayout = is_null($this->Align) ? 0 : 1; // ---- $writer->byteAlign(); $writer->putUIBit($hasText); $writer->putUIBit($this->WordWrap); $writer->putUIBit($this->Multiline); $writer->putUIBit($this->Password); $writer->putUIBit($this->ReadOnly); $writer->putUIBit($hasTextColor); $writer->putUIBit($hasMaxLength); $writer->putUIBit($hasFont); // ---- $writer->putUIBit($hasFontClass); $writer->putUIBit($this->AutoSize); $writer->putUIBit($hasLayout); $writer->putUIBit($this->NoSelect); $writer->putUIBit($this->Border); $writer->putUIBit($this->WasStatic); $writer->putUIBit($this->HTML); $writer->putUIBit($this->UseOutlines); if ($hasFont) { $writer->putUI16LE($this->FontID); } if ($hasFontClass) { IO_SWF_Type_String::build($writer, $this->FontClass); } if ($hasFont) { $writer->putUI16LE($this->FontHeight); } if ($hasTextColor) { IO_SWF_Type_RGBA::build($writer, $this->TextColor); } if ($hasMaxLength) { $writer->putUI16LE($this->MaxLength); } if ($hasLayout) { $writer->putUI8($this->Align); $writer->putUI16LE($this->LeftMargin); $writer->putUI16LE($this->RightMargin); $writer->putUI16LE($this->Indent); $writer->putSI16LE($this->Leading); } IO_SWF_Type_String::build($writer, $this->VariableName); if ($hasText) { IO_SWF_Type_String::build($writer, $this->InitialText); } return $writer->output(); }