public function build() { $writer = new IO_Bit(); $writer->putUI16LE($this->_fields['CharacterId']); $writer->putUI16LE($this->_fields['Depth']); return $writer->output(); }
function buildContent($tagCode, $opts = array()) { $writer = new IO_Bit(); $writer->putUIBit($this->Reserved); $writer->putUIBit($this->UseDirectBlit); $writer->putUIBit($this->UseGPU); $writer->putUIBit($this->HasMetadata); $writer->putUIBit($this->ActionScript3); $writer->putUIBits($this->Reserved2, 2); $writer->putUIBit($this->UseNetwork); $writer->putUIBits($this->Reserved3, 24); return $writer->output(); }
function buildContent($tagCode, $opts = array()) { $writer = new IO_Bit(); $writer->putUI16LE($this->SoundId); // ---- $writer->putUIBits($this->SoundFormat, 4); $writer->putUIBits($this->SoundRate, 2); $writer->putUIBit($this->SoundSize); // --- $writer->putUI32LE($this->SoundSampleCount); $writer->putData($this->SoundData); return $writer->output(); }
function buildContent($tagCode, $opts = array()) { $writer = new IO_Bit(); $writer->putUI16LE($this->_CharacterID); $bitmapFormat = $this->_BitmapFormat; $writer->putUI8($bitmapFormat); $writer->putUI16LE($this->_BitmapWidth); $writer->putUI16LE($this->_BitmapHeight); if ($bitmapFormat == 3) { $writer->putUI8($this->_BitmapColorTableSize - 1); } $writer->putData($this->_ZlibBitmapData); return $writer->output(); }
function buildContent($tagCode, $opts = array()) { $writer = new IO_Bit(); switch ($tagCode) { case 5: // RemoveObject $writer->putUI16LE($this->_characterId); $writer->putUI16LE($this->_depth); break; case 28: // RemoveObject2 $writer->putUI16LE($this->_depth); break; } return $writer->output(); }
function buildContent($tagCode, $opts = array()) { $writer = new IO_Bit(); if ($tagCode != 8) { // ! JPEGTablesa $writer->putUI16LE($this->_CharacterID); } if ($tagCode == 35) { // DefgineBitsJPEG3 $this->_AlphaDataOffset = strlen($this->_JPEGData); $writer->putUI32LE($this->_AlphaDataOffset); } if ($tagCode != 35) { // ! DefgineBitsJPEG3 $writer->putData($this->_JPEGData); } else { $writer->putData($this->_JPEGData); $writer->putData($this->_ZlibBitmapAlphaData); } return $writer->output(); }
function build($opts = array()) { $code = $this->code; if (is_null($this->content)) { $this->content = $this->buildTagContent(); } $length = strlen($this->content); $writer = new IO_Bit(); switch ($code) { case 6: // DefineBitsJPEG // DefineBitsJPEG case 21: // DefineBitsJPEG2 // DefineBitsJPEG2 case 35: // DefineBitsJPEG3 // DefineBitsJPEG3 case 20: // DefineBitsLossless // DefineBitsLossless case 36: // DefineBitsLossless2 // DefineBitsLossless2 case 19: // SoundStreamBlock $longFormat = true; break; default: $longFormat = false; break; } if ($longFormat === false && $length < 0x3f) { $tagAndLength = $code << 6 | $length; $writer->putUI16LE($tagAndLength); } else { $tagAndLength = $code << 6 | 0x3f; $writer->putUI16LE($tagAndLength); $writer->putUI32LE($length); } return $writer->output() . $this->content; }
function getStdJpegData() { if (count($this->_jpegChunk) == 0) { $this->_splitChunk(false, false); } $bitout = new IO_Bit(); foreach ($this->stdChunkOrder as $stdMarker) { foreach ($this->_jpegChunk as $chunk) { $marker = $chunk['marker']; if ($stdMarker == $marker) { $bitout->putUI8(0xff); $bitout->putUI8($marker); if (!is_null($chunk['length'])) { $bitout->putUI16BE($chunk['length']); } $bitout->putData($chunk['data']); if ($marker == 0xd8 || $marker == 0xd9) { break; // SOI | EOI } } } } return $bitout->output(); }
public function build() { $writer = new IO_Bit(); foreach ($this->_actions as $index => $d) { $writer->putUI8($d['ActionCode']); if ($d['Length'] == 0) { continue; } $writer->putUI16LE($d['Length']); $writer->putData($d['Content']); } return $writer->output(); }
<?php require_once 'IO/Bit.php'; if ($argc < 2) { echo "Usage: php iobit_put.php <width>:<value> [<width2>:<value2> [...]]" . PHP_EOL; echo "ex) php iobit_put.php 1:0 2:1 3:7 4:0 5:31 6:46 7:6 8:135" . PHP_EOL; exit(1); } $iobit = new IO_Bit(); foreach (array_slice($argv, 1) as $arg) { list($width, $value) = explode(':', $arg); $value = $iobit->putUIBits($value, $width); } echo $iobit->output();
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(); }