24 #require_once 'Zend/Pdf/FileParser/Image.php'; 53 if(!$this->_isParsed) {
60 if(!$this->_isParsed) {
67 if(!$this->_isParsed) {
74 if(!$this->_isParsed) {
81 if(!$this->_isParsed) {
88 if(!$this->_isParsed) {
95 if(!$this->_isParsed) {
102 if(!$this->_isParsed) {
109 if(!$this->_isParsed) {
116 if(!$this->_isParsed) {
131 if ($this->_isScreened) {
144 if ($this->_isParsed) {
160 $this->_isPNG =
false;
162 $this->_isPNG =
true;
167 if(!isset($this->_isPNG)) {
180 if($chunkLength < 0 || ($chunkLength + $this->
getOffset() + 4) > $size) {
181 #require_once 'Zend/Pdf/Exception.php'; 207 if($offset + $chunkLength + 4 < $size) {
211 if(empty($this->_imageData)) {
212 #require_once 'Zend/Pdf/Exception.php'; 213 throw new Zend_Pdf_Exception (
"This PNG is corrupt. All png must contain IDAT chunks." );
220 #require_once 'Zend/Pdf/Exception.php'; 221 throw new Zend_Pdf_Exception(
"This PNG is corrupt. The first chunk in a PNG file must be IHDR." );
224 $this->_height = $this->
readUInt(4);
225 $this->_bits = $this->
readInt(1);
226 $this->_color = $this->
readInt(1);
227 $this->_compression = $this->
readInt(1);
228 $this->_preFilter = $this->
readInt(1);
229 $this->_interlacing = $this->
readInt(1);
231 #require_once 'Zend/Pdf/Exception.php'; 232 throw new Zend_Pdf_Exception(
"Only non-interlaced images are currently supported." );
238 if(!isset($this->_imageData)) {
239 $this->_imageData = $this->
readBytes($chunkLength);
241 $this->_imageData .= $this->
readBytes($chunkLength);
247 $this->_paletteData = $this->
readBytes($chunkLength);
255 switch($this->_color) {
257 $baseColor = $this->
readInt(1);
258 $this->_transparencyData = array($baseColor, $baseColor);
287 $this->_transparencyData = array($red, $red, $green, $green, $blue, $blue);
314 $tmpData = $this->
readBytes($chunkLength);
315 if(($trnsIdx = strpos($tmpData,
"\0")) !==
false) {
316 $this->_transparencyData = array($trnsIdx, $trnsIdx);
324 #require_once 'Zend/Pdf/Exception.php';
const PNG_INTERLACING_DISABLED
readInt($size, $byteOrder=Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN)
_parseTRNSChunk($chunkOffset, $chunkLength)
_parseIDATChunk($chunkOffset, $chunkLength)
_parsePLTEChunk($chunkOffset, $chunkLength)
const PNG_CHANNEL_GRAY_ALPHA
const PNG_CHANNEL_RGB_ALPHA
const PNG_CHANNEL_INDEXED
readUInt($size, $byteOrder=Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN)