/** * Process the raw data from a binary stream * * @param Woops_Icc_Binary_Stream The IC binary stream * @return void */ public function processData(Woops_Icc_Binary_Stream $stream) { $this->_profileSize = $stream->bigEndianUnsignedLong(); $this->_preferredCmmType = $stream->read(4); $version = $stream->bigEndianUnsignedLong(); $major = $version >> 24; $minor = $version >> 16 & 0xf0; $bugfix = $version >> 16 & 0xf; $this->_version = self::ICC_VERSION . '.' . $major . '.' . $minor . '.' . $bugfix; $this->_class = $stream->read(4); $this->_colourSpace = $stream->read(4); $this->_connectionSpace = $stream->read(4); $this->_dateTime = $stream->dateTime(); $signature = $stream->bigEndianUnsignedLong(); if ($signature !== self::ICC_SIGNATURE) { throw new Woops_Icc_Header_Exception('Invalid ICC signature (' . $signature . ')', Woops_Icc_Header_Exception::EXCEPTION_BAD_SIGNATURE); } $this->_primaryPlatform = $stream->read(4); $this->_flags = $stream->bigEndianUnsignedLong(); $this->_manufacturer = $stream->read(4); $this->_model = $stream->bigEndianUnsignedLong(); $this->_attributes = $stream->bigEndianUnsignedLong() << 32 | $stream->bigEndianUnsignedLong(); $this->_renderingIntent = $stream->bigEndianUnsignedLong(); $this->_illuminant = $stream->xyzNumber(12); $this->_creator = $stream->read(4); $this->_id = $stream->read(16); // Reserved bytes $stream->seek(28, Woops_Icc_Binary_Stream::SEEK_CUR); }
/** * Process the raw data from a binary stream * * @param Woops_Icc_Binary_Stream The IC binary stream * @return void */ public function processData(Woops_Icc_Binary_Stream $stream) { $this->_tags = array(); $tagCount = $stream->bigEndianUnsignedLong(); for ($i = 0; $i < $tagCount; $i++) { $type = $stream->bigEndianUnsignedLong(); $datOffset = $stream->bigEndianUnsignedLong(); $size = $stream->bigEndianUnsignedLong(); $offset = $stream->getOffset(); try { $tag = $this->newTag($type); } catch (Woops_Icc_TagTable_Exception $e) { if ($e->getCode() !== Woops_Icc_TagTable_Exception::EXCEPTION_INVALID_TAG_TYPE) { throw $e; } $tag = new Woops_Icc_UnknownTag($type); $this->_tags[] = $tag; } } }