com-tecnick-tcpdf

# Class: QRcode

Source Location: /qrcode.php

### Class Overview

Class to create QR-code arrays for TCPDF class.

#### Author(s):

- Nicola Asuni

#### Version:

- 1.0.004

#### Copyright:

- 2010-2010 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com

### Variables

- $alignmentPattern
- $anTable
- $b1
- $barcode_array
- $bit
- $blocks
- $capacity
- $casesensitive
- $count
- $data
- $datacode
- $dataLength
- $dataStr
- $dir
- $ecccode
- $eccLength
- $eccTable
- $formatInfo
- $frame
- $frames
- $hint
- $items
- $lengthTableBits
- $level
- $rsblocks
- $rsitems
- $runLength
- $structured
- $version
- $versionPattern
- $width
- $x
- $y

### Methods

- __construct
- allocate
- appendBitstream
- appendBytes
- appendNewInputItem
- appendNum
- appendPaddingBit
- binarize
- bitstreamToByte
- calcN1N3
- calcParity
- check
- checkModeAn
- checkModeKanji
- checkModeNum
- convertData
- createBitStream
- createFrame
- eat8
- eatAn
- eatKanji
- eatNum
- encodeBitStream
- encodeMask
- encodeMode8
- encodeModeAn
- encodeModeKanji
- encodeModeNum
- encodeModeStructure
- encodeString
- encode_rs_char
- estimateBitsMode8
- estimateBitsModeAn
- estimateBitsModeKanji
- estimateBitsModeNum
- estimateBitStreamSize
- estimateVersion
- evaluateSymbol
- generateMaskNo
- getBarcodeArray
- getBitStream
- getByteStream
- getCode
- getDataLength
- getECCLength
- getEccSpec
- getFormatInfo
- getFrameAt
- getMinimumVersion
- getNextPosition
- getRemainder
- getVersionPattern
- getWidth
- identifyMode
- init
- init_rs
- init_rs_char
- insertStructuredAppendHeader
- isalnumat
- isdigitat
- lengthIndicator
- lengthOfCode
- lookAnTable
- makeMask
- makeMaskNo
- mask
- mask0
- mask1
- mask2
- mask3
- mask4
- mask5
- mask6
- mask7
- maximumWords
- mergeBitStream
- modnn
- newFrame
- newFromBytes
- newFromNum
- newInputItem
- putAlignmentMarker
- putAlignmentPattern
- putFinderPattern
- qrstrset
- rsBlockNum
- rsBlockNum1
- rsBlockNum2
- rsDataCodes1
- rsDataCodes2
- rsDataLength
- rsEccCodes1
- rsEccCodes2
- rsEccLength
- setFrameAt
- splitString
- toUpper
- writeFormatInformation

### Class Details

[line 300]
Class to create QR-code arrays for TCPDF class.

QR Code symbol is a 2D barcode that can be scanned by handy terminals such as a mobile phone with CCD. The capacity of QR Code is up to 7000 digits or 4000 characters, and has high robustness. This class supports QR Code model 2, described in JIS (Japanese Industrial Standards) X0510:2004 or ISO/IEC 18004. Currently the following features are not supported: ECI and FNC1 mode, Micro QR Code, QR Code model 1, Structured mode.

This class is derived from "PHP QR Code encoder" by Dominik Dzienia (http://phpqrcode.sourceforge.net/) based on "libqrencode C library 3.1.1." by Kentaro Fukuchi (http://megaui.net/fukuchi/works/qrencode/index.en.html), contains Reed-Solomon code written by Phil Karn, KA9Q. QR Code is registered trademark of DENSO WAVE INCORPORATED (http://www.denso-wave.com/qrcode/index-e.html). Please read comments on this class source file for full copyright and license information.

#### Tags:

author: | Nicola Asuni
version: | 1.0.004
copyright: | 2010-2010 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
link: | http://www.tcpdf.org
abstract: | Class for generating QR-code array for TCPDF.
name: | QRcode
license: | LGPL

[ Top ]

### Class Variables

#### $alignmentPattern = array(
array( 0, 0),array(0,0),array(18,0),array(22,0),array(26,0),array(30,0),// 1- 5
array(34,0),array(22,38),array(24,42),array(26,46),array(28,50),// 6-10
array(30,54),array(32,58),array(34,62),array(26,46),array(26,48),// 11-15
array(26,50),array(30,54),array(30,56),array(30,58),array(34,62),// 16-20
array(28,50),array(26,50),array(30,54),array(28,54),array(32,58),// 21-25
array(30,58),array(34,62),array(26,50),array(30,54),array(26,52),// 26-30
array(30,56),array(34,60),array(30,58),array(34,62),array(30,54),// 31-35
array(24,50),array(28,54),array(32,58),array(26,54),array(30,58)// 35-40
)

[line 598]

#### Tags:

var: | Positions of alignment patterns. This array includes only the second and the third position of the alignment patterns. Rest of them can be calculated from the distance between them. See Table 1 in Appendix E (pp.71) of JIS X0510:2004.
access: | protected

Type: | array

[ Top ]

#### $anTable = array(
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //
36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, //
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, //
-1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, //
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, //
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 //
)

[line 472]

#### Tags:

var: | convesion table
access: | protected

Type: | alphabet-numeric

[ Top ]

#### $b1 =

[line 430]

#### Tags:

access: | protected

Type: | b1

[ Top ]

#### $barcode_array = array()

[line 306]

#### Tags:

var: | array to be returned which is readable by TCPDF
access: | protected

Type: | barcode

[ Top ]

#### $bit =

[line 380]

#### Tags:

var: | bit
access: | protected

Type: | single

[ Top ]

#### $blocks =

[line 400]

#### Tags:

access: | protected

Type: | blocks

[ Top ]

#### $capacity = array(
array( 0, 0, 0, array( 0, 0, 0, 0)),//
array(21,26,0,array(7,10,13,17)),// 1
array(25,44,7,array(10,16,22,28)),//
array(29,70,7,array(15,26,36,44)),//
array(33,100,7,array(20,36,52,64)),//
array(37,134,7,array(26,48,72,88)),// 5
array(41,172,7,array(36,64,96,112)),//
array(45,196,0,array(40,72,108,130)),//
array(49,242,0,array(48,88,132,156)),//
array(53,292,0,array(60,110,160,192)),//
array(57,346,0,array(72,130,192,224)),// 10
array(61,404,0,array(80,150,224,264)),//
array(65,466,0,array(96,176,260,308)),//
array(69,532,0,array(104,198,288,352)),//
array(73,581,3,array(120,216,320,384)),//
array(77,655,3,array(132,240,360,432)),// 15
array(81,733,3,array(144,280,408,480)),//
array(85,815,3,array(168,308,448,532)),//
array(89,901,3,array(180,338,504,588)),//
array(93,991,3,array(196,364,546,650)),//
array(97,1085,3,array(224,416,600,700)),// 20
array(101,1156,4,array(224,442,644,750)),//
array(105,1258,4,array(252,476,690,816)),//
array(109,1364,4,array(270,504,750,900)),//
array(113,1474,4,array(300,560,810,960)),//
array(117,1588,4,array(312,588,870,1050)),// 25
array(121,1706,4,array(336,644,952,1110)),//
array(125,1828,4,array(360,700,1020,1200)),//
array(129,1921,3,array(390,728,1050,1260)),//
array(133,2051,3,array(420,784,1140,1350)),//
array(137,2185,3,array(450,812,1200,1440)),// 30
array(141,2323,3,array(480,868,1290,1530)),//
array(145,2465,3,array(510,924,1350,1620)),//
array(149,2611,3,array(540,980,1440,1710)),//
array(153,2761,3,array(570,1036,1530,1800)),//
array(157,2876,0,array(570,1064,1590,1890)),// 35
array(161,3034,0,array(600,1120,1680,1980)),//
array(165,3196,0,array(630,1204,1770,2100)),//
array(169,3362,0,array(660,1260,1860,2220)),//
array(173,3532,0,array(720,1316,1950,2310)),//
array(177,3706,0,array(750,1372,2040,2430))// 40
)

[line 488]

#### Tags:

var: | Table of the capacity of symbols See Table 1 (pp.13) and Table 12-16 (pp.30-36), JIS X0510:2004.
access: | protected

Type: | array

[ Top ]

#### $casesensitive = true

[line 330]

#### Tags:

var: | true the input string will be converted to uppercase
access: | protected

Type: | if

[ Top ]

#### $count =

[line 412]

#### Tags:

access: | protected

Type: | counter

[ Top ]

#### $data =

[line 342]

#### Tags:

var: | data
access: | protected

Type: | mask

[ Top ]

#### $datacode = array()

[line 388]

#### Tags:

var: | code
access: | protected

Type: | data

[ Top ]

#### $dataLength =

[line 418]

#### Tags:

var: | length
access: | protected

Type: | data

[ Top ]

#### $dataStr = ''

[line 446]

#### Tags:

var: | data string
access: | protected

Type: | input

[ Top ]

#### $dir =

[line 374]

#### Tags:

access: | protected

Type: | direction

[ Top ]

#### $ecccode = array()

[line 394]

#### Tags:

var: | correction code
access: | protected

Type: | error

[ Top ]

#### $eccLength =

[line 424]

#### Tags:

var: | correction length
access: | protected

Type: | error

[ Top ]

#### $eccTable = array(
array(array( 0, 0),array(0,0),array(0,0),array(0,0)),//
array(array(1,0),array(1,0),array(1,0),array(1,0)),// 1
array(array(1,0),array(1,0),array(1,0),array(1,0)),//
array(array(1,0),array(1,0),array(2,0),array(2,0)),//
array(array(1,0),array(2,0),array(2,0),array(4,0)),//
array(array(1,0),array(2,0),array(2,2),array(2,2)),// 5
array(array(2,0),array(4,0),array(4,0),array(4,0)),//
array(array(2,0),array(4,0),array(2,4),array(4,1)),//
array(array(2,0),array(2,2),array(4,2),array(4,2)),//
array(array(2,0),array(3,2),array(4,4),array(4,4)),//
array(array(2,2),array(4,1),array(6,2),array(6,2)),// 10
array(array(4,0),array(1,4),array(4,4),array(3,8)),//
array(array(2,2),array(6,2),array(4,6),array(7,4)),//
array(array(4,0),array(8,1),array(8,4),array(12,4)),//
array(array(3,1),array(4,5),array(11,5),array(11,5)),//
array(array(5,1),array(5,5),array(5,7),array(11,7)),// 15
array(array(5,1),array(7,3),array(15,2),array(3,13)),//
array(array(1,5),array(10,1),array(1,15),array(2,17)),//
array(array(5,1),array(9,4),array(17,1),array(2,19)),//
array(array(3,4),array(3,11),array(17,4),array(9,16)),//
array(array(3,5),array(3,13),array(15,5),array(15,10)),// 20
array(array(4,4),array(17,0),array(17,6),array(19,6)),//
array(array(2,7),array(17,0),array(7,16),array(34,0)),//
array(array(4,5),array(4,14),array(11,14),array(16,14)),//
array(array(6,4),array(6,14),array(11,16),array(30,2)),//
array(array(8,4),array(8,13),array(7,22),array(22,13)),// 25
array(array(10,2),array(19,4),array(28,6),array(33,4)),//
array(array(8,4),array(22,3),array(8,26),array(12,28)),//
array(array(3,10),array(3,23),array(4,31),array(11,31)),//
array(array(7,7),array(21,7),array(1,37),array(19,26)),//
array(array(5,10),array(19,10),array(15,25),array(23,25)),// 30
array(array(13,3),array(2,29),array(42,1),array(23,28)),//
array(array(17,0),array(10,23),array(10,35),array(19,35)),//
array(array(17,1),array(14,21),array(29,19),array(11,46)),//
array(array(13,6),array(14,23),array(44,7),array(59,1)),//
array(array(12,7),array(12,26),array(39,14),array(22,41)),// 35
array(array(6,14),array(6,34),array(46,10),array(2,64)),//
array(array(17,4),array(29,14),array(49,10),array(24,46)),//
array(array(4,18),array(13,32),array(48,14),array(42,32)),//
array(array(20,4),array(40,7),array(43,22),array(10,67)),//
array(array(19,6),array(18,31),array(34,34),array(20,61))// 40
)

[line 548]

#### Tags:

var: | Table of the error correction code (Reed-Solomon block) See Table 12-16 (pp.30-36), JIS X0510:2004.
access: | protected

Type: | array

[ Top ]

#### $formatInfo = array(
array(0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976),//
array(0x5412,0x5125,0x5e7c,0x5b4b,0x45f9,0x40ce,0x4f97,0x4aa0),//
array(0x355f,0x3068,0x3f31,0x3a06,0x24b4,0x2183,0x2eda,0x2bed),//
array(0x1689,0x13be,0x1ce7,0x19d0,0x0762,0x0255,0x0d0c,0x083b)//
)

[line 628]

#### Tags:

var: | Format information
access: | protected

Type: | array

[ Top ]

#### $frame =

[line 356]

#### Tags:

access: | protected

Type: | frame

[ Top ]

#### $frames = array()

[line 466]

#### Tags:

var: | of frames
access: | protected

Type: | array

[ Top ]

#### $hint = QR_MODE_8B

[line 324]

#### Tags:

var: | mode
access: | protected

Type: | Encoding

[ Top ]

#### $items =

[line 452]

#### Tags:

var: | items
access: | protected

Type: | input

[ Top ]

#### $lengthTableBits = array(
array(10, 12, 14),array(9,11,13),array(8,16,16),array(8,10,12))

[line 536]

#### Tags:

var: | Length indicator
access: | protected

Type: | array

[ Top ]

#### $level = QR_ECLEVEL_L

[line 318]

#### Tags:

var: | of error correction. See definitions for possible values.
access: | protected

Type: | Levels

[ Top ]

#### $rsblocks = array()

[line 406]

#### Tags:

var: | blocks
access: | protected

Type: | Reed-Solomon

[ Top ]

#### $rsitems = array()

[line 460]

#### Tags:

var: | items
access: | protected

Type: | Reed-Solomon

[ Top ]

#### $runLength = array()

[line 438]

#### Tags:

var: | length
access: | protected

Type: | run

[ Top ]

#### $structured = 0

[line 336]

#### Tags:

var: | QR code (not supported yet)
access: | protected

Type: | structured

[ Top ]

#### $version = 0

[line 312]

#### Tags:

var: | code version. Size of QRcode is defined as version. Version is from 1 to 40. Version 1 is 21*21 matrix. And 4 modules increases whenever 1 version increases. So version 40 is 177*177 matrix.
access: | protected

Type: | QR

[ Top ]

#### $versionPattern = array(
0x07c94, 0x085bc, 0x09a99, 0x0a4d3, 0x0bbf6, 0x0c762, 0x0d847, 0x0e60d, //
0x0f928, 0x10b78, 0x1145d, 0x12a17, 0x13532, 0x149a6, 0x15683, 0x168c9, //
0x177ec, 0x18ec4, 0x191e1, 0x1afab, 0x1b08e, 0x1cc1a, 0x1d33f, 0x1ed75, //
0x1f250, 0x209d5, 0x216f0, 0x228ba, 0x2379f, 0x24b0b, 0x2542e, 0x26a64, //
0x27541, 0x28c69
)

[line 616]

#### Tags:

var: | Version information pattern (BCH coded). See Table 1 in Appendix D (pp.68) of JIS X0510:2004. size: [QRSPEC_VERSION_MAX - 6]
access: | protected

Type: | array

[ Top ]

#### $width =

[line 350]

#### Tags:

access: | protected

Type: | width

[ Top ]

#### $x =

[line 362]

#### Tags:

var: | position of bit
access: | protected

Type: | X

[ Top ]

#### $y =

[line 368]

#### Tags:

var: | position of bit
access: | protected

Type: | Y

[ Top ]

### Class Methods

### constructor __construct [line 648]

`QRcode __construct( string $code, [string $eclevel = 'L'])`

This is the class constructor.

Creates a QRcode object

#### Tags:

since: | 1.0.000
access: | public

#### Parameters:

string | $code | code to represent using QRcode

string

$eclevel

error level:

- L : About 7% or less errors can be corrected.
- M : About 15% or less errors can be corrected.
- Q : About 25% or less errors can be corrected.
- H : About 30% or less errors can be corrected.

[ Top ]

### method allocate [line 2130]

`array allocate( int $setLength)`

Return an array with zeros

#### Tags:

access: | protected

#### Parameters:

int | $setLength | array size

[ Top ]

### method appendBitstream [line 2184]

`array appendBitstream( array $bitstream, array $append)`

Append one bitstream to another

#### Tags:

return: | bitstream
access: | protected

#### Parameters:

array | $bitstream | original bitstream
array | $append | bitstream to append

[ Top ]

### method appendBytes [line 2216]

`array appendBytes( array $bitstream, int $size, array $data)`

Append one bitstream created from bytes to another

#### Tags:

return: | bitstream
access: | protected

#### Parameters:

array | $bitstream | original bitstream
int | $size | size
array | $data | bytes

[ Top ]

### method appendNewInputItem [line 1702]

`items appendNewInputItem( array $items, int $mode, int $size, array $data)`

Append data to an input object.

The data is copied and appended to the input object.

#### Tags:

access: | protected

#### Parameters:

int | $mode | encoding mode.
int | $size | size of data (byte).
array | $data | array of input data.
array | $items | items input items

[ Top ]

### method appendNum [line 2201]

`array appendNum( array $bitstream, int $bits, int $num)`

Append one bitstream created from number to another

#### Tags:

return: | bitstream
access: | protected

#### Parameters:

array | $bitstream | original bitstream
int | $bits | number of bits
int | $num | number

[ Top ]

### method appendPaddingBit [line 2062]

`array appendPaddingBit( array $bstream)`

Append Padding Bit to bitstream

#### Tags:

return: | bitstream
access: | protected

#### Parameters:

array | $bstream |

[ Top ]

### method binarize [line 695]

`array binarize( array $frame)`

Convert the frame in binary form

#### Tags:

return: | frame in binary form
access: | protected

#### Parameters:

array | $frame | array to binarize

[ Top ]

### method bitstreamToByte [line 2229]

`array bitstreamToByte( $bstream, array $bitstream)`

Convert bitstream to bytes

#### Tags:

return: | of bytes
access: | protected

#### Parameters:

array | $bitstream | original bitstream
| $bstream |

[ Top ]

### method calcN1N3 [line 1132]

`int calcN1N3( int $length)`

calcN1N3

#### Tags:

return: | demerit
access: | protected

#### Parameters:

int | $length |

[ Top ]

### method calcParity [line 1733]

`int calcParity( array $items)`

calcParity

#### Tags:

return: | parity
access: | protected

#### Parameters:

array | $items |

[ Top ]

### method check [line 1866]

`boolean check( int $mode, int $size, array $data)`

Validate the input data.

#### Tags:

return: | true in case of valid data, false otherwise
access: | protected

#### Parameters:

int | $mode | encoding mode.
int | $size | size of data (byte).
array | $data | data data to validate

[ Top ]

### method checkModeAn [line 1799]

`boolean checkModeAn( int $size, array $data)`

checkModeAn

#### Tags:

return: | true or false
access: | protected

#### Parameters:

int | $size |
array | $data |

[ Top ]

### method checkModeKanji [line 1846]

`boolean checkModeKanji( int $size, array $data)`

checkModeKanji

#### Tags:

return: | true or false
access: | protected

#### Parameters:

int | $size |
array | $data |

[ Top ]

### method checkModeNum [line 1751]

`boolean checkModeNum( int $size, array $data)`

checkModeNum

#### Tags:

return: | true or false
access: | protected

#### Parameters:

int | $size |
array | $data |

[ Top ]

### method convertData [line 2033]

`array convertData( array $items)`

convertData

#### Tags:

return: | items
access: | protected

#### Parameters:

array | $items |

[ Top ]

### method createBitStream [line 2018]

`array createBitStream( array $items)`

createBitStream

#### Tags:

return: | of items and total bits
access: | protected

#### Parameters:

array | $items |

[ Top ]

### method createFrame [line 2529]

`Array createFrame( int $version)`

Return a copy of initialized frame.

#### Tags:

return: | of unsigned char.
access: | protected

#### Parameters:

int | $version | version

[ Top ]

### method eat8 [line 1401]

`int eat8( )`

eat8

#### Tags:

return: | run
access: | protected

[ Top ]

### method eatAn [line 1349]

`int eatAn( )`

eatAn

#### Tags:

return: | run
access: | protected

[ Top ]

### method eatKanji [line 1388]

`int eatKanji( )`

eatKanji

#### Tags:

return: | run
access: | protected

[ Top ]

### method eatNum [line 1317]

`int eatNum( )`

eatNum

#### Tags:

return: | run
access: | protected

[ Top ]

### method encodeBitStream [line 1647]

`array encodeBitStream( array $inputitem, int $version)`

encodeBitStream

#### Tags:

return: | input item
access: | protected

#### Parameters:

array | $inputitem |
int | $version |

[ Top ]

### method encodeMask [line 726]

`void encodeMask( int $mask)`

Encode mask

#### Tags:

access: | protected

#### Parameters:

int | $mask | masking mode

[ Top ]

### method encodeMode8 [line 1593]

`array encodeMode8( array $inputitem, int $version)`

encodeMode8

#### Tags:

return: | input item
access: | protected

#### Parameters:

array | $inputitem |
int | $version |

[ Top ]

### method encodeModeAn [line 1570]

`array encodeModeAn( array $inputitem, int $version)`

encodeModeAn

#### Tags:

return: | input item
access: | protected

#### Parameters:

array | $inputitem |
int | $version |

[ Top ]

### method encodeModeKanji [line 1609]

`array encodeModeKanji( array $inputitem, int $version)`

encodeModeKanji

#### Tags:

return: | input item
access: | protected

#### Parameters:

array | $inputitem |
int | $version |

[ Top ]

### method encodeModeNum [line 1541]

`array encodeModeNum( array $inputitem, int $version)`

encodeModeNum

#### Tags:

return: | input item
access: | protected

#### Parameters:

array | $inputitem |
int | $version |

[ Top ]

### method encodeModeStructure [line 1632]

`array encodeModeStructure( array $inputitem)`

encodeModeStructure

#### Tags:

return: | input item
access: | protected

#### Parameters:

array | $inputitem |

[ Top ]

### method encodeString [line 710]

`void encodeString( string $string)`

Encode the input string to QR code

#### Tags:

access: | protected

#### Parameters:

string | $string | input string to encode

[ Top ]

### method encode_rs_char [line 2827]

`parity encode_rs_char( array $rs, array $data, array $parity)`

Encode a Reed-Solomon codec and returns the parity array

#### Tags:

return: | array
access: | protected

#### Parameters:

array | $rs | RS values
array | $data | data
array | $parity | parity

[ Top ]

### method estimateBitsMode8 [line 1827]

`int estimateBitsMode8( int $size)`

estimateBitsMode8

#### Tags:

return: | number of bits
access: | protected

#### Parameters:

int | $size |

[ Top ]

### method estimateBitsModeAn [line 1813]

`int estimateBitsModeAn( int $size)`

estimateBitsModeAn

#### Tags:

return: | number of bits
access: | protected

#### Parameters:

int | $size |

[ Top ]

### method estimateBitsModeKanji [line 1836]

`int estimateBitsModeKanji( int $size)`

estimateBitsModeKanji

#### Tags:

return: | number of bits
access: | protected

#### Parameters:

int | $size |

[ Top ]

### method estimateBitsModeNum [line 1765]

`int estimateBitsModeNum( int $size)`

estimateBitsModeNum

#### Tags:

return: | number of bits
access: | protected

#### Parameters:

int | $size |

[ Top ]

### method estimateBitStreamSize [line 1899]

`int estimateBitStreamSize( array $items, int $version)`

estimateBitStreamSize

#### Tags:

return: | bits
access: | protected

#### Parameters:

array | $items |
int | $version |

[ Top ]

### method estimateVersion [line 1942]

`int estimateVersion( array $items)`

estimateVersion

#### Tags:

return: | version
access: | protected

#### Parameters:

array | $items |

[ Top ]

### method evaluateSymbol [line 1163]

`int evaluateSymbol( int $width, array $frame)`

evaluateSymbol

#### Tags:

return: | demerit
access: | protected

#### Parameters:

int | $width |
array | $frame |

[ Top ]

### method generateMaskNo [line 1069]

`array generateMaskNo( int $maskNo, int $width, array $frame)`

Return bitmask

#### Tags:

return: | bitmask
access: | protected

#### Parameters:

int | $maskNo | mask number
int | $width | width
array | $frame | frame

[ Top ]

### method getBarcodeArray [line 686]

`array getBarcodeArray( )`

Returns a barcode array which is readable by TCPDF

#### Tags:

return: | barcode array readable by TCPDF;
access: | public

[ Top ]

### method getBitStream [line 2106]

`array getBitStream( int $items)`

Returns a stream of bits.

#### Tags:

return: | padded merged byte stream
access: | protected

#### Parameters:

int | $items |

[ Top ]

### method getByteStream [line 2116]

`array getByteStream( int $items)`

Pack all bit streams padding bits into a byte array.

#### Tags:

return: | padded merged byte stream
access: | protected

#### Parameters:

int | $items |

[ Top ]

### method getCode [line 915]

`array getCode( )`

Return Reed-Solomon block code.

#### Tags:

return: | rsblocks
access: | protected

[ Top ]

### method getDataLength [line 2282]

`int getDataLength( int $version, int $level)`

Return maximum data code length (bytes) for the version.

#### Tags:

return: | maximum size (bytes)
access: | protected

#### Parameters:

int | $version | version
int | $level | error correction level

[ Top ]

### method getECCLength [line 2292]

`int getECCLength( int $version, int $level)`

Return maximum error correction code length (bytes) for the version.

#### Tags:

return: | ECC size (bytes)
access: | protected

#### Parameters:

int | $version | version
int | $level | error correction level

[ Top ]

### method getEccSpec [line 2382]

`array getEccSpec( int $version, int $level, array $spec)`

Return an array of ECC specification.

#### Tags:

return: | spec
access: | protected

#### Parameters:

int | $version | version
int | $level | error correction level
array | $spec | an array of ECC specification contains as following: {# of type1 blocks, # of data code, # of ecc code, # of type2 blocks, # of data code}

[ Top ]

### method getFormatInfo [line 2490]

`BCH getFormatInfo( array $mask, int $level)`

Return BCH encoded format information pattern.

#### Tags:

return: | encoded format information pattern
access: | protected

#### Parameters:

array | $mask |
int | $level | error correction level

[ Top ]

### method getFrameAt [line 800]

`value getFrameAt( array $at)`

Get frame value at specified position

#### Tags:

return: | at specified position
access: | protected

#### Parameters:

array | $at | x,y position

[ Top ]

### method getMinimumVersion [line 2320]

`int getMinimumVersion( int $size, int $level)`

Return a version number that satisfies the input code length.

#### Tags:

return: | version number
access: | protected

#### Parameters:

int | $size | input code length (byte)
int | $level | error correction level

[ Top ]

### method getNextPosition [line 808]

`array getNextPosition( )`

Return the next frame position

#### Tags:

return: | of x,y coordinates
access: | protected

[ Top ]

### method getRemainder [line 2310]

`int getRemainder( int $version)`

Return the numer of remainder bits.

#### Tags:

return: | number of remainder bits
access: | protected

#### Parameters:

int | $version | version

[ Top ]

### method getVersionPattern [line 2477]

`BCH getVersionPattern( int $version)`

Return BCH encoded version information pattern that is used for the symbol of version 7 or greater. Use lower 18 bits.

#### Tags:

return: | encoded version information pattern
access: | protected

#### Parameters:

int | $version | version

[ Top ]

### method getWidth [line 2301]

`int getWidth( int $version)`

Return the width of the symbol for the version.

#### Tags:

return: | width
access: | protected

#### Parameters:

int | $version | version

[ Top ]

### method identifyMode [line 1292]

`int identifyMode( int $pos)`

identifyMode

#### Tags:

return: | mode
access: | protected

#### Parameters:

int | $pos |

[ Top ]

### method init [line 864]

`0 init( array $spec)`

Initialize code.

#### Tags:

return: | in case of success, -1 in case of error
access: | protected

#### Parameters:

array | $spec | array of ECC specification

[ Top ]

### method init_rs [line 2702]

`array init_rs( int $symsize, int $gfpoly, int $fcr, int $prim, int $nroots, int $pad)`

Initialize a Reed-Solomon codec and add it to existing rsitems

#### Tags:

return:

Array of RS values:

- mm = Bits per symbol;
- nn = Symbols per block;
- alpha_to = log lookup table array;
- index_of = Antilog lookup table array;
- genpoly = Generator polynomial array;
- nroots = Number of generator;
- roots = number of parity symbols;
- fcr = First consecutive root, index form;
- prim = Primitive element, index form;
- iprim = prim-th root of 1, index form;
- pad = Padding bytes in shortened block;
- gfpoly

.

access: | protected

#### Parameters:

int | $symsize | symbol size, bits
int | $gfpoly | Field generator polynomial coefficients
int | $fcr | first root of RS code generator polynomial, index form
int | $prim | primitive element to generate polynomial roots
int | $nroots | RS code generator polynomial degree (number of roots)
int | $pad | padding bytes at front of shortened block

[ Top ]

### method init_rs_char [line 2743]

`array init_rs_char( int $symsize, int $gfpoly, int $fcr, int $prim, int $nroots, int $pad)`

Initialize a Reed-Solomon codec and returns an array of values.

#### Tags:

return:

Array of RS values:

- mm = Bits per symbol;
- nn = Symbols per block;
- alpha_to = log lookup table array;
- index_of = Antilog lookup table array;
- genpoly = Generator polynomial array;
- nroots = Number of generator;
- roots = number of parity symbols;
- fcr = First consecutive root, index form;
- prim = Primitive element, index form;
- iprim = prim-th root of 1, index form;
- pad = Padding bytes in shortened block;
- gfpoly

.

access: | protected

#### Parameters:

int | $symsize | symbol size, bits
int | $gfpoly | Field generator polynomial coefficients
int | $fcr | first root of RS code generator polynomial, index form
int | $prim | primitive element to generate polynomial roots
int | $nroots | RS code generator polynomial degree (number of roots)
int | $pad | padding bytes at front of shortened block

[ Top ]

### method insertStructuredAppendHeader [line 1715]

`array insertStructuredAppendHeader( array $items, int $size, int $index, int $parity)`

insertStructuredAppendHeader

#### Tags:

return: | items
access: | protected

#### Parameters:

array | $items |
int | $size |
int | $index |
int | $parity |

[ Top ]

### method isalnumat [line 1280]

`boolean isalnumat( string $str, int $pos)`

Return true if the character at specified position is an alphanumeric character

#### Tags:

return: | true of false
access: | protected

#### Parameters:

string | $str | string
int | $pos | characted position

[ Top ]

### method isdigitat [line 1267]

`boolean isdigitat( string $str, int $pos)`

Return true if the character at specified position is a number

#### Tags:

return: | true of false
access: | protected

#### Parameters:

string | $str | string
int | $pos | characted position

[ Top ]

### method lengthIndicator [line 2336]

`int lengthIndicator( int $mode, int $version)`

Return the size of length indicator for the mode and version.

#### Tags:

return: | the size of the appropriate length indicator (bits).
access: | protected

#### Parameters:

int | $mode | encoding mode
int | $version | version

[ Top ]

### method lengthOfCode [line 1963]

`int lengthOfCode( int $mode, int $version, int $bits)`

lengthOfCode

#### Tags:

return: | size
access: | protected

#### Parameters:

int | $mode |
int | $version |
int | $bits |

[ Top ]

### method lookAnTable [line 1789]

`value lookAnTable( int $c)`

Look up the alphabet-numeric convesion table (see JIS X0510:2004, pp.19).

#### Tags:

access: | protected

#### Parameters:

int | $c | character value

[ Top ]

### method makeMask [line 1120]

`array makeMask( int $width, array $frame, int $maskNo, int $level)`

makeMask

#### Tags:

return: | mask
access: | protected

#### Parameters:

int | $width |
array | $frame |
int | $maskNo |
int | $level |

[ Top ]

### method makeMaskNo [line 1093]

`int makeMaskNo( int $maskNo, int $width, int $s, &$d, [boolean $maskGenOnly = false], int $d)`

makeMaskNo

#### Tags:

return: | b
access: | protected

#### Parameters:

int | $maskNo |
int | $width |
int | $s |
int | $d |
boolean | $maskGenOnly |
| &$d |

[ Top ]

### method mask [line 1225]

`array mask( int $width, array $frame, int $level)`

mask

#### Tags:

return: | best mask
access: | protected

#### Parameters:

int | $width |
array | $frame |
int | $level |

[ Top ]

### method mask0 [line 988]

`int mask0( int $x, int $y)`

mask0

#### Tags:

return: | mask
access: | protected

#### Parameters:

int | $x | X position
int | $y | Y position

[ Top ]

### method mask1 [line 998]

`int mask1( int $x, int $y)`

mask1

#### Tags:

return: | mask
access: | protected

#### Parameters:

int | $x | X position
int | $y | Y position

[ Top ]

### method mask2 [line 1008]

`int mask2( int $x, int $y)`

mask2

#### Tags:

return: | mask
access: | protected

#### Parameters:

int | $x | X position
int | $y | Y position

[ Top ]

### method mask3 [line 1018]

`int mask3( int $x, int $y)`

mask3

#### Tags:

return: | mask
access: | protected

#### Parameters:

int | $x | X position
int | $y | Y position

[ Top ]

### method mask4 [line 1028]

`int mask4( int $x, int $y)`

mask4

#### Tags:

return: | mask
access: | protected

#### Parameters:

int | $x | X position
int | $y | Y position

[ Top ]

### method mask5 [line 1038]

`int mask5( int $x, int $y)`

mask5

#### Tags:

return: | mask
access: | protected

#### Parameters:

int | $x | X position
int | $y | Y position

[ Top ]

### method mask6 [line 1048]

`int mask6( int $x, int $y)`

mask6

#### Tags:

return: | mask
access: | protected

#### Parameters:

int | $x | X position
int | $y | Y position

[ Top ]

### method mask7 [line 1058]

`int mask7( int $x, int $y)`

mask7

#### Tags:

return: | mask
access: | protected

#### Parameters:

int | $x | X position
int | $y | Y position

[ Top ]

### method maximumWords [line 2356]

`int maximumWords( int $mode, int $version)`

Return the maximum length for the mode and version.

#### Tags:

return: | the maximum length (bytes)
access: | protected

#### Parameters:

int | $mode | encoding mode
int | $version | version

[ Top ]

### method mergeBitStream [line 2092]

`array mergeBitStream( $items, array $bstream)`

mergeBitStream

#### Tags:

return: | bitstream
access: | protected

#### Parameters:

array | $bstream |
| $items |

[ Top ]

### method modnn [line 2725]

`int modnn( array $rs, int $x)`

modnn

#### Tags:

return: | X osition
access: | protected

#### Parameters:

int | $x | X position
array | $rs | RS values

[ Top ]

### method newFrame [line 2594]

`Array newFrame( int $version)`

Set new frame for the specified version.

#### Tags:

return: | of unsigned char.
access: | protected

#### Parameters:

int | $version | version

[ Top ]

### method newFromBytes [line 2160]

`array newFromBytes( int $size, array $data)`

Return new bitstream from bytes

#### Tags:

return: | bitstream
access: | protected

#### Parameters:

int | $size | size
array | $data | bytes

[ Top ]

### method newFromNum [line 2140]

`array newFromNum( int $bits, int $num)`

Return new bitstream from number

#### Tags:

return: | bitstream
access: | protected

#### Parameters:

int | $bits | number of bits
int | $num | number

[ Top ]

### method newInputItem [line 1519]

`array newInputItem( int $mode, int $size, array $data, [array $bstream = null])`

newInputItem

#### Tags:

return: | input item
access: | protected

#### Parameters:

int | $mode |
int | $size |
array | $data |
array | $bstream |

[ Top ]

### method putAlignmentMarker [line 2414]

`array putAlignmentMarker( array $frame, int $ox, int $oy, int $width)`

Put an alignment marker.

#### Tags:

return: | frame
access: | protected

#### Parameters:

array | $frame | frame
int | $width | width
int | $ox | X center coordinate of the pattern
int | $oy | Y center coordinate of the pattern

[ Top ]

### method putAlignmentPattern [line 2437]

`array putAlignmentPattern( int $version, $frame, int $width, array $fram)`

Put an alignment pattern.

#### Tags:

return: | frame
access: | protected

#### Parameters:

int | $version | version
array | $fram | frame
int | $width | width
| $frame |

[ Top ]

### method putFinderPattern [line 2508]

`array putFinderPattern( array $frame, int $ox, int $oy, int $width)`

Put a finder pattern.

#### Tags:

return: | frame
access: | protected

#### Parameters:

array | $frame | frame
int | $width | width
int | $ox | X center coordinate of the pattern
int | $oy | Y center coordinate of the pattern

[ Top ]

### method qrstrset [line 2271]

`array qrstrset( array $srctab, int $x, int $y, string $repl, [int $replLen = false])`

Replace a value on the array at the specified position

#### Tags:

return: | srctab
access: | protected

#### Parameters:

array | $srctab |
int | $x | X position
int | $y | Y position
string | $repl | value to replace
int | $replLen | length of the repl string

[ Top ]

### method rsBlockNum [line 2612]

`int rsBlockNum( array $spec)`

Return block number 0

#### Tags:

return: | value
access: | protected

#### Parameters:

array | $spec |

[ Top ]

### method rsBlockNum1 [line 2621]

`int rsBlockNum1( array $spec)`

Return block number 1

#### Tags:

return: | value
access: | protected

#### Parameters:

array | $spec |

[ Top ]

### method rsBlockNum2 [line 2648]

`int rsBlockNum2( array $spec)`

Return block number 2

#### Tags:

return: | value
access: | protected

#### Parameters:

array | $spec |

[ Top ]

### method rsDataCodes1 [line 2630]

`int rsDataCodes1( array $spec)`

Return data codes 1

#### Tags:

return: | value
access: | protected

#### Parameters:

array | $spec |

[ Top ]

### method rsDataCodes2 [line 2657]

`int rsDataCodes2( array $spec)`

Return data codes 2

#### Tags:

return: | value
access: | protected

#### Parameters:

array | $spec |

[ Top ]

### method rsDataLength [line 2675]

`int rsDataLength( array $spec)`

Return data length

#### Tags:

return: | value
access: | protected

#### Parameters:

array | $spec |

[ Top ]

### method rsEccCodes1 [line 2639]

`int rsEccCodes1( array $spec)`

Return ecc codes 1

#### Tags:

return: | value
access: | protected

#### Parameters:

array | $spec |

[ Top ]

### method rsEccCodes2 [line 2666]

`int rsEccCodes2( array $spec)`

Return ecc codes 2

#### Tags:

return: | value
access: | protected

#### Parameters:

array | $spec |

[ Top ]

### method rsEccLength [line 2684]

`int rsEccLength( array $spec)`

Return ecc length

#### Tags:

return: | value
access: | protected

#### Parameters:

array | $spec |

[ Top ]

### method setFrameAt [line 791]

`void setFrameAt( array $at, int $val)`

Set frame value at specified position

#### Tags:

access: | protected

#### Parameters:

array | $at | x,y position
int | $val | value of the character to set

[ Top ]

### method splitString [line 1449]

`void splitString( )`

splitString

#### Tags:

access: | protected

[ Top ]

### method toUpper [line 1490]

`void toUpper( )`

toUpper

#### Tags:

access: | protected

[ Top ]

### method writeFormatInformation [line 946]

`int writeFormatInformation( int $width, &$frame, array $mask, int $level, array $frame)`

Write Format Information on frame and returns the number of black bits

#### Tags:

return: | blacks
access: | protected

#### Parameters:

int | $width | frame width
array | $frame | frame
array | $mask | masking mode
int | $level | error correction level
| &$frame |

[ Top ]

Documentation generated on Sat, 31 Jul 2010 14:40:11 +0200 by phpDocumentor 1.4.3