SetaPDF_Core_Filter_Lzw Class for handling LZW compression

File: /SetaPDF v2/Core/Filter/Lzw.php

Class hierarchy





protected array SetaPDF_Core_Filter_Lzw::$_andTable = array(...)


protected int SetaPDF_Core_Filter_Lzw::$_bitsPerComponent = 8


protected int SetaPDF_Core_Filter_Lzw::$_bitsToGet = 9


protected SetaPDF_Core_Filter_Lzw::$_bytePointer


protected int SetaPDF_Core_Filter_Lzw::$_colors = 1


protected int SetaPDF_Core_Filter_Lzw::$_columns = 1


protected string SetaPDF_Core_Filter_Lzw::$_data


protected int SetaPDF_Core_Filter_Lzw::$_dataLength = 0


protected int SetaPDF_Core_Filter_Lzw::$_nextBits = 0


protected int SetaPDF_Core_Filter_Lzw::$_nextData = 0


protected int SetaPDF_Core_Filter_Lzw::$_predictor = 1


protected array SetaPDF_Core_Filter_Lzw::$_sTable = array()


protected SetaPDF_Core_Filter_Lzw::$_tIdx


public bool SetaPDF_Core_Filter_Lzw::$alwaysWritePredictorByte = true

Whether or not to only write algorithm byte if predictor value is 15.

If set to true, the algorithm byte is written at the beginning of every line for all PNG predictors.

If set to false, this byte is only written for optimum png compression, which can vary the compression algorithm for each row.



public SetaPDF_Core_Filter_Predictor::__construct (
[ integer $predictor = null [, integer $colors = null [, integer $bitsPerComponent = null [, integer $columns = null ]]]]

The constructor.

$predictor : integer
$colors : integer
$bitsPerComponent : integer
$columns : integer


protected SetaPDF_Core_Filter_Lzw::_addStringToTable (
string $oldString [, string $newString = '' ]
): void

Add a new string to the string table.

$oldString : string
$newString : string


protected SetaPDF_Core_Filter_Lzw::_getNextCode (
): integer

Returns the next 9, 10, 11 or 12 bits.


protected SetaPDF_Core_Filter_Lzw::_initsTable (
): void

Initialize the string table.


protected SetaPDF_Core_Filter_Predictor::_paethPredictor (
int|float $left, int|float $above, int|float $upperLeft
): int|float

Value prediction using the Alan W. Paeth algorithm.

$left : int|float

The value to the left of the processed data entry.

$above : int|float

The value above the processed data entry.

$upperLeft : int|float

The value to the upper left of the processed data entry.

Return Values

Returns the prediction value according to the Peath algorithm


public SetaPDF_Core_Filter_Lzw::decode (
string $data
): string

Method to decode LZW compressed data.

$data : string

The compressed data

Return Values

The uncompressed data


Throws SetaPDF_Core_Filter_Exception