/** * Process the raw data from a binary stream * * @return void */ public function processData(Woops_Swf_Binary_Stream $stream) { $data = $stream->unsignedChar(); $nBits = ($data & 0xf8) >> 3; $length = ceil($nBits / 8 * 4); $fields = str_pad(decbin($data & 0x7), 3, '0', STR_PAD_LEFT); for ($i = 0; $i < $length; $i++) { $fields .= str_pad(decbin($stream->unsignedChar()), 8, '0', STR_PAD_LEFT); } $this->_xMin = bindec(substr($fields, 0, $nBits)); $this->_xMax = bindec(substr($fields, $nBits, $nBits)); $this->_yMin = bindec(substr($fields, $nBits * 2, $nBits)); $this->_yMax = bindec(substr($fields, $nBits * 3, $nBits)); }
/** * Process the raw data from a binary stream * * @return void */ public function processData(Woops_Swf_Binary_Stream $stream) { // Gets the SWF file signature $signature = $stream->read(3); // Checks the SWF file signature if ($signature === 'FWS') { // No compression $this->_isCompressed = false; } elseif ($signature === 'CWS') { // SWF file data is compressed $this->_isCompressed = true; } else { // Error - Invalid SWF signature throw new Woops_Swf_Header_Exception('Invalid SWF file signature (' . $signature . ')', Woops_Swf_Header_Exception::EXCEPTION_BAD_SIGNATURE); } // Gets the SWF version $this->_version = $stream->unsignedChar(); // Do not process the file size $stream->seek(4, Woops_Swf_Binary_Stream::SEEK_CUR); // Checks if we have to uncompress the SWF data if ($this->_isCompressed) { // Uncompress the SWF data $stream->uncompressData(); } // Processes the frame size rectangle $this->_frameSize->processData($stream); // Gets the frame rate $this->_frameRate = $stream->littleEndianFixedPoint(8, 8); // Gets the number of frames $this->_frameCount = $stream->littleEndianUnsignedShort(); }
/** * Process the raw data from a binary stream * * @return void */ public function processData(Woops_Swf_Binary_Stream $stream) { // Gets the alpha value $this->_alpha = $stream->unsignedChar(); // Calls the parent method parent::processData($stream); }
/** * Process the raw data from a binary stream * * @return void */ public function processData(Woops_Swf_Binary_Stream $stream) { // Gets the label $this->_label = $stream->nullTerminatedString(); // Checks if we have a named anchor if (!$stream->endOfStream()) { // Sets the named anchor flag $this->_namedAnchor = (bool) $stream->unsignedChar(); } }
/** * Process the raw data from a binary stream * * @return void */ public function processData(Woops_Swf_Binary_Stream $stream) { $this->_red = $stream->unsignedChar(); $this->_green = $stream->unsignedChar(); $this->_blue = $stream->unsignedChar(); }