function build() { $writer_head = new IO_Bit(); $writer = new IO_Bit(); /* SWF Header */ $writer_head->putData($this->_headers['Signature']); $writer_head->putUI8($this->_headers['Version']); $writer_head->putUI32LE($this->_headers['FileLength']); /* SWF Movie Header */ IO_SWF_Type_RECT::build($writer, $this->_headers['FrameSize']); $writer->byteAlign(); $writer->putUI16LE($this->_headers['FrameRate']); $writer->putUI16LE($this->_headers['FrameCount']); /* SWF Tags */ foreach ($this->_tags as $idx => $tag) { $tagData = $tag->build(); if ($tagData != false) { $writer->putData($tagData); } else { throw new IO_SWF_Exception("tag build failed (tag idx={$idx})"); } } list($fileLength, $bit_offset_dummy) = $writer->getOffset(); $fileLength += 8; // swf header $this->_headers['FileLength'] = $fileLength; $writer_head->setUI32LE($fileLength, 4); if ($this->_headers['Signature'][0] == 'C') { return $writer_head->output() . gzcompress($writer->output()); } return $writer_head->output() . $writer->output(); }
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 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(); }