Pdf/FileParser/Image/Png.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Pdf  
Subpackage
FileParser  
Version
$Id: Png.php 24593 2012-01-05 20:35:02Z matthew $  

\Zend_Pdf_FileParser_Image_Png

Package: Zend\Pdf\FileParser
Abstract base class for Image file parsers.

Provides a library of methods to quickly navigate and extract various data types (signed and unsigned integers, floating- and fixed-point numbers, strings, etc.) from the file.

File access is managed via a Zend_Pdf_FileParserDataSource object. This allows the same parser code to work with many different data sources: in-memory objects, filesystem files, etc.

Parent(s)
\Zend_Pdf_FileParser_Image < \Zend_Pdf_FileParser
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

>VConstant  BYTE_ORDER_LITTLE_ENDIAN = 0
inherited
Little-endian byte order (0x04 0x03 0x02 0x01).
Inherited from: \Zend_Pdf_FileParser::BYTE_ORDER_LITTLE_ENDIAN\Zend_Pdf_FileParser_Image::BYTE_ORDER_LITTLE_ENDIAN
>VConstant  BYTE_ORDER_BIG_ENDIAN = 1
inherited
Big-endian byte order (0x01 0x02 0x03 0x04).
Inherited from: \Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN\Zend_Pdf_FileParser_Image::BYTE_ORDER_BIG_ENDIAN

Properties

>VPropertyprotected$_bits
Details
Type
n/a
>VPropertyprotected$_color
Details
Type
n/a
>VPropertyprotected$_compression
Details
Type
n/a
>VPropertyprotected\Zend_Pdf_FileParserDataSource $_dataSource = null
inherited
Object representing the data source to be parsed.
Inherited from: \Zend_Pdf_FileParser::$$_dataSource\Zend_Pdf_FileParser_Image::$$_dataSource
>VPropertyprotected$_height
Details
Type
n/a
>VPropertyprotected$_imageData
Details
Type
n/a
>VPropertyprotected$_interlacing
Details
Type
n/a
>VPropertyprotected$_isPNG
Details
Type
n/a
>VPropertyprotectedboolean $_isParsed = false
inherited
Flag indicating that the file has been sucessfully parsed.
Inherited from: \Zend_Pdf_FileParser::$$_isParsed\Zend_Pdf_FileParser_Image::$$_isParsed
Default valuefalseDetails
Type
boolean
Inherited_from
\Zend_Pdf_FileParser::$$_isParsed  
Inherited_from
\Zend_Pdf_FileParser_Image::$$_isParsed  
>VPropertyprotectedboolean $_isScreened = false
inherited
Flag indicating that the file has passed a cursory validation check.
Inherited from: \Zend_Pdf_FileParser::$$_isScreened\Zend_Pdf_FileParser_Image::$$_isScreened
Default valuefalseDetails
Type
boolean
Inherited_from
\Zend_Pdf_FileParser::$$_isScreened  
Inherited_from
\Zend_Pdf_FileParser_Image::$$_isScreened  
>VPropertyprotected$_paletteData
Details
Type
n/a
>VPropertyprotected$_preFilter
Details
Type
n/a
>VPropertyprotected$_transparencyData
Details
Type
n/a
>VPropertyprotected$_width
Details
Type
n/a
>VPropertyprotectedinteger $imageType
inherited
Image Type
Inherited from: \Zend_Pdf_FileParser_Image::$$imageType
Details
Type
integer
Inherited_from
\Zend_Pdf_FileParser_Image::$$imageType  

Methods

methodpublic__construct(\Zend_Pdf_FileParserDataSource $dataSource) : void
inherited

Object constructor.

Inherited from: \Zend_Pdf_FileParser_Image::__construct()

Validates the data source and enables debug logging if so configured.

Parameters
NameTypeDescription
$dataSource\Zend_Pdf_FileParserDataSource
Throws
ExceptionDescription
\Zend_Pdf_Exception
methodpublic__destruct() : void

Discards the data source object.

methodprotected_checkSignature() : void

methodprotected_parseChunks() : void

methodprotected_parseIDATChunk( $chunkOffset,  $chunkLength) : void

Parameters
NameTypeDescription
$chunkOffset
$chunkLength
methodprotected_parseIHDRChunk() : void

methodprotected_parsePLTEChunk( $chunkOffset,  $chunkLength) : void

Parameters
NameTypeDescription
$chunkOffset
$chunkLength
methodprotected_parseSignature() : void

methodprotected_parseTRNSChunk( $chunkOffset,  $chunkLength) : void

Parameters
NameTypeDescription
$chunkOffset
$chunkLength
methodpublicgetBitDepth() : void

methodpublicgetColorSpace() : void

methodpublicgetCompressionStrategy() : void

methodpublicgetDataSource() : \Zend_Pdf_FileParserDataSource
inherited

Returns the data source object representing the file being parsed.

Inherited from: \Zend_Pdf_FileParser::getDataSource()\Zend_Pdf_FileParser_Image::getDataSource()
Returns
TypeDescription
\Zend_Pdf_FileParserDataSource
methodpublicgetHeight() : void

methodpublicgetInterlacingMode() : void

methodpublicgetPaethFilter() : void

methodpublicgetRawImageData() : void

methodpublicgetRawPaletteData() : void

methodpublicgetRawTransparencyData() : void

methodpublicgetWidth() : void

methodpublicisBitSet(integer $bit, integer $bitField) : boolean
inherited

Returns true if the specified bit is set in the integer bitfield.

Inherited from: \Zend_Pdf_FileParser::isBitSet()\Zend_Pdf_FileParser_Image::isBitSet()
Parameters
NameTypeDescription
$bitinteger

Bit number to test (i.e. - 0-31)

$bitFieldinteger
Returns
TypeDescription
boolean
methodpublicisParsed() : boolean
inherited

Returns true if the file has been successfully parsed.

Inherited from: \Zend_Pdf_FileParser::isParsed()\Zend_Pdf_FileParser_Image::isParsed()
Returns
TypeDescription
boolean
methodpublicisScreened() : boolean
inherited

Returns true if the file has passed a cursory validation check.

Inherited from: \Zend_Pdf_FileParser::isScreened()\Zend_Pdf_FileParser_Image::isScreened()
Returns
TypeDescription
boolean
methodpublicmoveToOffset(integer $offset) : void
inherited

Convenience wrapper for the data source object's moveToOffset() method.

Inherited from: \Zend_Pdf_FileParser::moveToOffset()\Zend_Pdf_FileParser_Image::moveToOffset()
Parameters
NameTypeDescription
$offsetinteger

Destination byte offset.

Throws
ExceptionDescription
\Zend_Pdf_Exception
methodpublicparse() : void

Reads and parses the image data from the file on disk.

Must set $this->_isParsed to true if successful.

Throws
ExceptionDescription
\Zend_Pdf_Exception
methodpublicreadBytes(integer $byteCount) : string
inherited

Convenience wrapper for the data source object's readBytes() method.

Inherited from: \Zend_Pdf_FileParser::readBytes()\Zend_Pdf_FileParser_Image::readBytes()
Parameters
NameTypeDescription
$byteCountinteger

Number of bytes to read.

Returns
TypeDescription
string
Throws
ExceptionDescription
\Zend_Pdf_Exception
methodpublicreadFixed(integer $mantissaBits, integer $fractionBits, integer $byteOrder = \Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN) : float
inherited

Reads the signed fixed-point number from the binary file at the current byte offset.

Inherited from: \Zend_Pdf_FileParser::readFixed()\Zend_Pdf_FileParser_Image::readFixed()

Common fixed-point sizes are 2.14 and 16.16.

Advances the offset by the number of bytes read. Throws an exception if an error occurs.

Parameters
NameTypeDescription
$mantissaBitsinteger

Number of bits in the mantissa

$fractionBitsinteger

Number of bits in the fraction

$byteOrderinteger

(optional) Big- or little-endian byte order. Use the BYTE_ORDER_ constants defined in {@link Zend_Pdf_FileParser}. If omitted, uses big-endian.

Returns
TypeDescription
float
Throws
ExceptionDescription
\Zend_Pdf_Exception
methodpublicreadInt(integer $size, integer $byteOrder = \Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN) : integer
inherited

Reads the signed integer value from the binary file at the current byte offset.

Inherited from: \Zend_Pdf_FileParser::readInt()\Zend_Pdf_FileParser_Image::readInt()

Advances the offset by the number of bytes read. Throws an exception if an error occurs.

Parameters
NameTypeDescription
$sizeinteger

Size of integer in bytes: 1-4

$byteOrderinteger

(optional) Big- or little-endian byte order. Use the BYTE_ORDER_ constants defined in {@link Zend_Pdf_FileParser}. If omitted, uses big-endian.

Returns
TypeDescription
integer
Throws
ExceptionDescription
\Zend_Pdf_Exception
methodpublicreadStringMacRoman(integer $byteCount, string $characterSet = '') : string
inherited

Reads the Mac Roman-encoded string from the binary file at the current byte offset.

Inherited from: \Zend_Pdf_FileParser::readStringMacRoman()\Zend_Pdf_FileParser_Image::readStringMacRoman()

You must supply the desired resulting character set.

Advances the offset by the number of bytes read. Throws an exception if an error occurs.

Parameters
NameTypeDescription
$byteCountinteger

Number of bytes (characters) to return.

$characterSetstring

(optional) Desired resulting character set. You may use any character set supported by {@link iconv()}. If omitted, uses 'current locale'.

Returns
TypeDescription
string
Throws
ExceptionDescription
\Zend_Pdf_Exception
methodpublicreadStringPascal(string $characterSet = '', integer $lengthBytes = 1) : string
inherited

Reads the Pascal string from the binary file at the current byte offset.

Inherited from: \Zend_Pdf_FileParser::readStringPascal()\Zend_Pdf_FileParser_Image::readStringPascal()

The length of the Pascal string is determined by reading the length bytes which preceed the character data. You must supply the desired resulting character set.

Advances the offset by the number of bytes read. Throws an exception if an error occurs.

Parameters
NameTypeDescription
$characterSetstring

(optional) Desired resulting character set. You may use any character set supported by {@link iconv()}. If omitted, uses 'current locale'.

$lengthBytesinteger

(optional) Number of bytes that make up the length. Default is 1.

Returns
TypeDescription
string
Throws
ExceptionDescription
\Zend_Pdf_Exception
methodpublicreadStringUTF16(integer $byteCount, integer $byteOrder = \Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN, string $characterSet = '') : string
inherited

Reads the Unicode UTF-16-encoded string from the binary file at the current byte offset.

Inherited from: \Zend_Pdf_FileParser::readStringUTF16()\Zend_Pdf_FileParser_Image::readStringUTF16()

The byte order of the UTF-16 string must be specified. You must also supply the desired resulting character set.

Advances the offset by the number of bytes read. Throws an exception if an error occurs.

Parameters
NameTypeDescription
$byteCountinteger

Number of bytes (characters * 2) to return.

$byteOrderinteger

(optional) Big- or little-endian byte order. Use the BYTE_ORDER_ constants defined in {@link Zend_Pdf_FileParser}. If omitted, uses big-endian.

$characterSetstring

(optional) Desired resulting character set. You may use any character set supported by {@link iconv()}. If omitted, uses 'current locale'.

Returns
TypeDescription
string
Throws
ExceptionDescription
\Zend_Pdf_Exception
methodpublicreadUInt(integer $size, integer $byteOrder = \Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN) : integer
inherited

Reads the unsigned integer value from the binary file at the current byte offset.

Inherited from: \Zend_Pdf_FileParser::readUInt()\Zend_Pdf_FileParser_Image::readUInt()

Advances the offset by the number of bytes read. Throws an exception if an error occurs.

NOTE: If you ask for a 4-byte unsigned integer on a 32-bit machine, the resulting value WILL BE SIGNED because PHP uses signed integers internally for everything. To guarantee portability, be sure to use bitwise operators operators on large unsigned integers!

Parameters
NameTypeDescription
$sizeinteger

Size of integer in bytes: 1-4

$byteOrderinteger

(optional) Big- or little-endian byte order. Use the BYTE_ORDER_ constants defined in {@link Zend_Pdf_FileParser}. If omitted, uses big-endian.

Returns
TypeDescription
integer
Throws
ExceptionDescription
\Zend_Pdf_Exception
methodpublicscreen() : void

Verifies that the image file is in the expected format.

Intended to quickly weed out obviously bogus files.

Must set $this->_isScreened to true if successful.

Throws
ExceptionDescription
\Zend_Pdf_Exception
methodpublicskipBytes(integer $byteCount) : void
inherited

Convenience wrapper for the data source object's skipBytes() method.

Inherited from: \Zend_Pdf_FileParser::skipBytes()\Zend_Pdf_FileParser_Image::skipBytes()
Parameters
NameTypeDescription
$byteCountinteger

Number of bytes to skip.

Throws
ExceptionDescription
\Zend_Pdf_Exception
Documentation was generated by phpDocumentor 2.0.0a12.