function dumpContent($tagCode, $opts = array()) { $opts['tagCode'] = $tagCode; echo " CharacterID: {$this->_CharacterID}\n"; echo " TextBounds:\n"; $rect_str = IO_SWF_Type_RECT::string($this->_TextBounds, $opts); echo "\t{$rect_str}\n"; $opts['indent'] = 1; $matrix_str = IO_SWF_Type_MATRIX::string($this->_TextMatrix, $opts); echo " TextMatrix:\n"; echo "{$matrix_str}\n"; echo " GlyphBits: {$this->_GlyphBits} AdvanceBits: {$this->_AdvanceBits}\n"; if (count($this->_TextRecords) == 0) { echo " (TEXTRECORD empty)\n"; } else { echo " TextRecords:\n"; foreach ($this->_TextRecords as $idx => $textRecord) { echo " [{$idx}]:\n"; echo "\t" . IO_SWF_Type_TEXTRECORD::string($textRecord, $opts); } } }
function buildContent($tagCode, $opts = array()) { $isMorph = $tagCode == 46 || $tagCode == 84; $writer = new IO_Bit(); if (empty($opts['noShapeId'])) { $writer->putUI16LE($this->_shapeId); } $opts = array('tagCode' => $tagCode); if ($isMorph === false) { IO_SWF_Type_RECT::build($writer, $this->_shapeBounds); // 描画スタイル IO_SWF_Type_FILLSTYLEARRAY::build($writer, $this->_fillStyles, $opts); IO_SWF_Type_LINESTYLEARRAY::build($writer, $this->_lineStyles, $opts); // 描画枠 $opts['fillStyleCount'] = count($this->_fillStyles); $opts['lineStyleCount'] = count($this->_lineStyles); IO_SWF_Type_SHAPE::build($writer, $this->_shapeRecords, $opts); } else { IO_SWF_Type_RECT::build($writer, $this->_startBounds); IO_SWF_Type_RECT::build($writer, $this->_endBounds); $writer->byteAlign(); list($offset_offset, $dummy) = $writer->getOffset(); $this->_offset = $writer->putUI32LE(0); // at first, write dummy // 描画スタイル IO_SWF_Type_FILLSTYLEARRAY::build($writer, $this->_morphFillStyles, $opts); IO_SWF_Type_LINESTYLEARRAY::build($writer, $this->_morphLineStyles, $opts); // 描画枠 $opts['fillStyleCount'] = count($this->_morphFillStyles); $opts['lineStyleCount'] = count($this->_morphLineStyles); // StartEdge IO_SWF_Type_SHAPE::build($writer, $this->_startEdge, $opts); // EndEdge $writer->byteAlign(); list($end_edge_offset, $dummy) = $writer->getOffset(); $this->_offset = $end_edge_offset - $offset_offset - 4; $writer->setUI32LE($this->_offset, $offset_offset); IO_SWF_Type_SHAPE::build($writer, $this->_endEdge, $opts); } return $writer->output(); }
function dump($opts = array()) { if (empty($opts['hexdump']) === false) { $bitio = new IO_Bit(); $bitio->input($this->_swfdata); } /* SWF Header */ echo 'Signature: ' . $this->_headers['Signature'] . PHP_EOL; echo 'Version: ' . $this->_headers['Version'] . PHP_EOL; echo 'FileLength: ' . $this->_headers['FileLength'] . PHP_EOL; echo 'FrameSize: ' . IO_SWF_Type_RECT::string($this->_headers['FrameSize']) . "\n"; echo 'FrameRate: ' . $this->_headers['FrameRate'] / 0x100 . PHP_EOL; echo 'FrameCount: ' . $this->_headers['FrameCount'] . PHP_EOL; if (empty($opts['hexdump']) === false) { $bitio->hexdump(0, $this->_header_size); $opts['bitio'] =& $bitio; // for tag } $opts['indent'] = 0; /* SWF Tags */ echo 'Tags:' . PHP_EOL; foreach ($this->_tags as $tag) { self::parseTagContent($tag, $opts); } $frame_num = 1; $sprite_tags = array(); for ($i = 0; $i < count($this->_tags); $i++) { $tag = $this->_tags[$i]; switch ($tag->code) { case 39: // Sprite $sprite_tags[] = $tag; break; case 12: // Action // Action case 59: // InitAction self::dumpActionTag($tag, $frame_num, $opts); break; case 1: // ShowFrame $frame_num++; break; case 43: // FrameLabel $tag->dump(); break; default: break; } } foreach ($sprite_tags as $tag) { self::dumpSpriteTag($tag, $opts); } }
function dump($opts = array()) { if (empty($opts['hexdump']) === false) { $bitio = new IO_Bit(); $bitio->input($this->_swfdata); } /* SWF Header */ echo 'Signature: ' . $this->_headers['Signature'] . PHP_EOL; echo 'Version: ' . $this->_headers['Version'] . PHP_EOL; echo 'FileLength: ' . $this->_headers['FileLength'] . PHP_EOL; echo 'FrameSize: ' . IO_SWF_Type_RECT::string($this->_headers['FrameSize']) . "\n"; echo 'FrameRate: ' . $this->_headers['FrameRate'] / 0x100 . PHP_EOL; echo 'FrameCount: ' . $this->_headers['FrameCount'] . PHP_EOL; if (empty($opts['hexdump']) === false) { $bitio->hexdump(0, $this->_header_size); $opts['bitio'] =& $bitio; // for tag } $opts['indent'] = 0; /* SWF Tags */ if ($this->_headers['Version'] < 6) { ob_start('mb_convert_encoding_from_sjis'); } echo 'Tags:' . PHP_EOL; foreach ($this->_tags as $tag) { try { $tag->dump($opts); } catch (IO_Bit_Exception $e) { echo "(tag dump failed) {$e}\n"; } if ($this->_headers['Version'] < 6) { ob_flush(); } } }
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(); }