SetaPDF_Core_Filter_Lzw Class for handling LZW compression

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

Class hierarchy

Implements

Summary

Properties

$_andTable

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

$_bitsPerComponent

protected int SetaPDF_Core_Filter_Lzw::$_bitsPerComponent = 8

$_bitsToGet

protected int SetaPDF_Core_Filter_Lzw::$_bitsToGet = 9

$_bytePointer

protected SetaPDF_Core_Filter_Lzw::$_bytePointer

$_colors

protected int SetaPDF_Core_Filter_Lzw::$_colors = 1

$_columns

protected int SetaPDF_Core_Filter_Lzw::$_columns = 1

$_data

protected string SetaPDF_Core_Filter_Lzw::$_data

$_dataLength

protected int SetaPDF_Core_Filter_Lzw::$_dataLength = 0

$_nextBits

protected int SetaPDF_Core_Filter_Lzw::$_nextBits = 0

$_nextData

protected int SetaPDF_Core_Filter_Lzw::$_nextData = 0

$_predictor

protected int SetaPDF_Core_Filter_Lzw::$_predictor = 1

$_sTable

protected array SetaPDF_Core_Filter_Lzw::$_sTable = array()

$_tIdx

protected SetaPDF_Core_Filter_Lzw::$_tIdx

$alwaysWritePredictorByte

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.


Methods

__construct()

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

The constructor.

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

_addStringToTable()

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

Add a new string to the string table.

Parameters
$oldString : string
 
$newString : string
 

_getNextCode()

protected SetaPDF_Core_Filter_Lzw::_getNextCode (
void
): integer

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

_initsTable()

protected SetaPDF_Core_Filter_Lzw::_initsTable (
void
): void

Initialize the string table.

_paethPredictor()

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.

Parameters
$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

decode()

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

Method to decode LZW compressed data.

Parameters
$data : string

The compressed data

Return Values

The uncompressed data

Exceptions

Throws SetaPDF_Core_Filter_Exception