Zend Framework  1.12
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Zend_Barcode_Object_ObjectAbstract Class Reference

Public Member Functions

 __construct ($options=null)
 Constructor.
 
 setOptions ($options)
 Set barcode state from options array.
 
 setConfig (Zend_Config $config)
 Set barcode state from config object.
 
 setBarcodeNamespace ($namespace)
 Set barcode namespace for autoloading.
 
 getBarcodeNamespace ()
 Retrieve barcode namespace.
 
 getType ()
 Retrieve type of barcode.
 
 setBarHeight ($value)
 Set height of the barcode bar.
 
 getBarHeight ()
 Get height of the barcode bar.
 
 setBarThinWidth ($value)
 Set thickness of thin bar.
 
 getBarThinWidth ()
 Get thickness of thin bar.
 
 setBarThickWidth ($value)
 Set thickness of thick bar.
 
 getBarThickWidth ()
 Get thickness of thick bar.
 
 setFactor ($value)
 Set factor applying to thinBarWidth - thickBarWidth - barHeight - fontSize.
 
 getFactor ()
 Get factor applying to thinBarWidth - thickBarWidth - barHeight - fontSize.
 
 setForeColor ($value)
 Set color of the barcode and text.
 
 getForeColor ()
 Retrieve color of the barcode and text.
 
 setBackgroundColor ($value)
 Set the color of the background.
 
 getBackgroundColor ()
 Retrieve background color of the image.
 
 setWithBorder ($value)
 Activate/deactivate drawing of the bar.
 
 getWithBorder ()
 Retrieve if border are draw or not.
 
 setWithQuietZones ($value)
 Activate/deactivate drawing of the quiet zones.
 
 getWithQuietZones ()
 Retrieve if quiet zones are draw or not.
 
 setReverseColor ()
 Allow fast inversion of font/bars color and background color.
 
 setOrientation ($value)
 Set orientation of barcode and text.
 
 getOrientation ()
 Retrieve orientation of barcode and text.
 
 setText ($value)
 Set text to encode.
 
 getText ()
 Retrieve text to encode.
 
 getRawText ()
 Retrieve text to encode.
 
 getTextToDisplay ()
 Retrieve text to display.
 
 setDrawText ($value)
 Activate/deactivate drawing of text to encode.
 
 getDrawText ()
 Retrieve if drawing of text to encode is enabled.
 
 setStretchText ($value)
 Activate/deactivate the adjustment of the position of the characters to the position of the bars.
 
 getStretchText ()
 Retrieve if the adjustment of the position of the characters to the position of the bars is enabled.
 
 setWithChecksum ($value)
 Activate/deactivate the automatic generation of the checksum character added to the barcode text.
 
 getWithChecksum ()
 Retrieve if the checksum character is automatically added to the barcode text.
 
 setWithChecksumInText ($value)
 Activate/deactivate the automatic generation of the checksum character added to the barcode text.
 
 getWithChecksumInText ()
 Retrieve if the checksum character is automatically added to the barcode text.
 
 setFont ($value)
 Set the font:
 
 getFont ()
 Retrieve the font.
 
 setFontSize ($value)
 Set the size of the font in case of TTF.
 
 getFontSize ()
 Retrieve the size of the font in case of TTF.
 
 getQuietZone ()
 Quiet zone before first bar and after the last bar.
 
 getInstructions ()
 Retrieve the set of drawing instructions.
 
 checkParams ()
 Checking of parameters after all settings.
 
 getHeight ($recalculate=false)
 Get height of the result object.
 
 getWidth ($recalculate=false)
 Get width of the result object.
 
 getOffsetLeft ($recalculate=false)
 Calculate the offset from the left of the object if an orientation is activated.
 
 getOffsetTop ($recalculate=false)
 Calculate the offset from the top of the object if an orientation is activated.
 
 draw ()
 Complete drawing of the barcode.
 
 validateText ($value)
 Check for invalid characters.
 

Static Public Member Functions

static setBarcodeFont ($font)
 Set the font for all instances of barcode.
 

Protected Member Functions

 _getDefaultOptions ()
 Set default options for particular object.
 
 _addLeadingZeros ($text, $withoutChecksum=false)
 Automatically add leading zeros if barcode length is fixed.
 
 _addInstruction (array $instruction)
 Add an instruction in the array of instructions.
 
 _addPolygon (array $points, $color=null, $filled=true)
 Add a polygon drawing instruction in the set of instructions.
 
 _addText ($text, $size, $position, $font, $color, $alignment= 'center', $orientation=0)
 Add a text drawing instruction in the set of instructions.
 
 _checkText ($value=null)
 Check if a text is really provided to barcode.
 
 _checkRatio ($min=2, $max=3)
 Check the ratio between the thick and the thin bar.
 
 _checkFontAndOrientation ()
 Drawing with an angle is just allow TTF font.
 
 _calculateWidth ()
 Width of the result image (before any rotation)
 
 _calculateBarcodeWidth ()
 Calculate the width of the barcode.
 
 _calculateHeight ()
 Height of the result object.
 
 _calculateBarcodeHeight ()
 Height of the barcode.
 
 _rotate ($x1, $y1)
 Apply rotation on a point in X/Y dimensions.
 
 _drawBarcode ()
 Draw the barcode.
 
 _drawBorder ()
 Partial function to draw border.
 
 _drawText ()
 Partial function to draw text.
 
 _validateText ($value, $options=array())
 Standard validation for most of barcode objects.
 
 _prepareBarcode ()
 Each child must prepare the barcode and return a table like array( 0 => array( 0 => int (visible(black) or not(white)) 1 => int (width of the bar) 2 => float (0->1 position from the top of the beginning of the bar in %) 3 => float (0->1 position from the top of the end of the bar in %) ), 1 => ...
 
 _checkParams ()
 Checking of parameters after all settings.
 
 _preDrawBarcode ()
 Allow each child to draw something else.
 
 _postDrawBarcode ()
 Allow each child to draw something else (ex: bearer bars in interleaved 2 of 5 code)
 

Protected Attributes

 $_barcodeNamespace = 'Zend_Barcode_Object'
 
 $_instructions = array()
 
 $_type = null
 
 $_height = null
 
 $_width = null
 
 $_barHeight = 50
 
 $_barThinWidth = 1
 
 $_barThickWidth = 3
 
 $_factor = 1
 
 $_foreColor = 0x000000
 
 $_backgroundColor = 0xFFFFFF
 
 $_withBorder = false
 
 $_withQuietZones = true
 
 $_mandatoryQuietZones = false
 
 $_orientation = 0
 
 $_offsetTop = null
 
 $_offsetLeft = null
 
 $_text = null
 
 $_drawText = true
 
 $_stretchText = false
 
 $_font = null
 
 $_fontSize = 10
 
 $_withChecksum = false
 
 $_withChecksumInText = false
 
 $_barcodeLength = null
 
 $_addLeadingZeros = true
 
 $_mandatoryChecksum = false
 
 $_substituteChecksumCharacter = 0
 

Static Protected Attributes

static $_staticFont = null
 

Constructor & Destructor Documentation

__construct (   $options = null)

Constructor.

Parameters
array | Zend_Config$options
Returns
void

Member Function Documentation

_addInstruction ( array  $instruction)
protected

Add an instruction in the array of instructions.

Parameters
array$instruction
_addLeadingZeros (   $text,
  $withoutChecksum = false 
)
protected

Automatically add leading zeros if barcode length is fixed.

Parameters
string$text
boolean$withoutChecksum
_addPolygon ( array  $points,
  $color = null,
  $filled = true 
)
protected

Add a polygon drawing instruction in the set of instructions.

Parameters
array$points
integer$color
boolean$filled
_addText (   $text,
  $size,
  $position,
  $font,
  $color,
  $alignment = 'center',
  $orientation = 0 
)
protected

Add a text drawing instruction in the set of instructions.

Parameters
string$text
float$size
array$position
string$font
integer$color
string$alignment
float$orientation
_calculateBarcodeHeight ( )
protected

Height of the barcode.

Returns
integer
_calculateBarcodeWidth ( )
abstractprotected

Calculate the width of the barcode.

Returns
integer
_calculateHeight ( )
protected

Height of the result object.

Returns
integer
_calculateWidth ( )
protected

Width of the result image (before any rotation)

Returns
integer
_checkFontAndOrientation ( )
protected

Drawing with an angle is just allow TTF font.

Returns
void
Exceptions
Zend_Barcode_Object_Exception
_checkParams ( )
abstractprotected

Checking of parameters after all settings.

Returns
void
_checkRatio (   $min = 2,
  $max = 3 
)
protected

Check the ratio between the thick and the thin bar.

Parameters
integer$min
integer$max
Returns
void
Exceptions
Zend_Barcode_Object_Exception
_checkText (   $value = null)
protected

Check if a text is really provided to barcode.

Returns
void
Exceptions
Zend_Barcode_Object_Exception
_drawBarcode ( )
protected

Draw the barcode.

Returns
void
_drawBorder ( )
protected

Partial function to draw border.

Returns
void
_drawText ( )
protected

Partial function to draw text.

Returns
void
_getDefaultOptions ( )
protected

Set default options for particular object.

Returns
void
_postDrawBarcode ( )
protected

Allow each child to draw something else (ex: bearer bars in interleaved 2 of 5 code)

Returns
void
_preDrawBarcode ( )
protected

Allow each child to draw something else.

Returns
void
_prepareBarcode ( )
abstractprotected

Each child must prepare the barcode and return a table like array( 0 => array( 0 => int (visible(black) or not(white)) 1 => int (width of the bar) 2 => float (0->1 position from the top of the beginning of the bar in %) 3 => float (0->1 position from the top of the end of the bar in %) ), 1 => ...

)

Returns
array
_rotate (   $x1,
  $y1 
)
protected

Apply rotation on a point in X/Y dimensions.

Parameters
float$x1x-position before rotation
float$y1y-position before rotation
Returns
array Array of two elements corresponding to the new XY point
_validateText (   $value,
  $options = array() 
)
protected

Standard validation for most of barcode objects.

Parameters
string$value
array$options
See Also
Zend_Barcode_Object_Exception
checkParams ( )

Checking of parameters after all settings.

Returns
void
draw ( )

Complete drawing of the barcode.

Returns
array Table of instructions
getBackgroundColor ( )

Retrieve background color of the image.

Returns
integer
getBarcodeNamespace ( )

Retrieve barcode namespace.

Returns
string
getBarHeight ( )

Get height of the barcode bar.

Returns
integer
getBarThickWidth ( )

Get thickness of thick bar.

Returns
integer
getBarThinWidth ( )

Get thickness of thin bar.

Returns
integer
getDrawText ( )

Retrieve if drawing of text to encode is enabled.

Returns
boolean
getFactor ( )

Get factor applying to thinBarWidth - thickBarWidth - barHeight - fontSize.

Returns
integer
getFont ( )

Retrieve the font.

Returns
integer|string
getFontSize ( )

Retrieve the size of the font in case of TTF.

Returns
float
getForeColor ( )

Retrieve color of the barcode and text.

Returns
unknown
getHeight (   $recalculate = false)

Get height of the result object.

Returns
integer
getInstructions ( )

Retrieve the set of drawing instructions.

Returns
array
getOffsetLeft (   $recalculate = false)

Calculate the offset from the left of the object if an orientation is activated.

Parameters
boolean$recalculate
Returns
float
getOffsetTop (   $recalculate = false)

Calculate the offset from the top of the object if an orientation is activated.

Parameters
boolean$recalculate
Returns
float
getOrientation ( )

Retrieve orientation of barcode and text.

Returns
float
getQuietZone ( )

Quiet zone before first bar and after the last bar.

Returns
integer
getRawText ( )

Retrieve text to encode.

Returns
string
getStretchText ( )

Retrieve if the adjustment of the position of the characters to the position of the bars is enabled.

Returns
boolean
getText ( )

Retrieve text to encode.

Returns
string
getTextToDisplay ( )

Retrieve text to display.

Returns
string
getType ( )

Retrieve type of barcode.

Returns
string
getWidth (   $recalculate = false)

Get width of the result object.

Returns
integer
getWithBorder ( )

Retrieve if border are draw or not.

Returns
boolean
getWithChecksum ( )

Retrieve if the checksum character is automatically added to the barcode text.

Returns
boolean
getWithChecksumInText ( )

Retrieve if the checksum character is automatically added to the barcode text.

Returns
boolean
getWithQuietZones ( )

Retrieve if quiet zones are draw or not.

Returns
boolean
setBackgroundColor (   $value)

Set the color of the background.

Parameters
integer$value
Returns
Zend_Barcode_Object
Exceptions
Zend_Barcode_Object_Exception
static setBarcodeFont (   $font)
static

Set the font for all instances of barcode.

Parameters
string$font
Returns
void
setBarcodeNamespace (   $namespace)

Set barcode namespace for autoloading.

Parameters
string$namespace
Returns
Zend_Barcode_Object
setBarHeight (   $value)

Set height of the barcode bar.

Parameters
integer$value
Returns
Zend_Barcode_Object
Exceptions
Zend_Barcode_Object_Exception
setBarThickWidth (   $value)

Set thickness of thick bar.

Parameters
integer$value
Returns
Zend_Barcode_Object
Exceptions
Zend_Barcode_Object_Exception
setBarThinWidth (   $value)

Set thickness of thin bar.

Parameters
integer$value
Returns
Zend_Barcode_Object
Exceptions
Zend_Barcode_Object_Exception
setConfig ( Zend_Config  $config)

Set barcode state from config object.

Parameters
Zend_Config$config
Returns
Zend_Barcode_Object
setDrawText (   $value)

Activate/deactivate drawing of text to encode.

Parameters
boolean$value
Returns
Zend_Barcode_Object
setFactor (   $value)

Set factor applying to thinBarWidth - thickBarWidth - barHeight - fontSize.

Parameters
float$value
Returns
Zend_Barcode_Object
Exceptions
Zend_Barcode_Object_Exception
setFont (   $value)

Set the font:

  • if integer between 1 and 5, use gd built-in fonts
  • if string, $value is assumed to be the path to a TTF font
    Parameters
    integer | string$value
    Returns
    Zend_Barcode_Object
    Exceptions
    Zend_Barcode_Object_Exception
setFontSize (   $value)

Set the size of the font in case of TTF.

Parameters
float$value
Returns
Zend_Barcode_Object
Exceptions
Zend_Barcode_Object_Exception
setForeColor (   $value)

Set color of the barcode and text.

Parameters
string$value
Returns
Zend_Barcode_Object
Exceptions
Zend_Barcode_Object_Exception
setOptions (   $options)

Set barcode state from options array.

Parameters
array$options
Returns
Zend_Barcode_Object
setOrientation (   $value)

Set orientation of barcode and text.

Parameters
float$value
Returns
Zend_Barcode_Object
Exceptions
Zend_Barcode_Object_Exception
setReverseColor ( )

Allow fast inversion of font/bars color and background color.

Returns
Zend_Barcode_Object
setStretchText (   $value)

Activate/deactivate the adjustment of the position of the characters to the position of the bars.

Parameters
boolean$value
Returns
Zend_Barcode_Object
Exceptions
Zend_Barcode_Object_Exception
setText (   $value)

Set text to encode.

Parameters
string$value
Returns
Zend_Barcode_Object
setWithBorder (   $value)

Activate/deactivate drawing of the bar.

Parameters
boolean$value
Returns
Zend_Barcode_Object
setWithChecksum (   $value)

Activate/deactivate the automatic generation of the checksum character added to the barcode text.

Parameters
boolean$value
Returns
Zend_Barcode_Object
setWithChecksumInText (   $value)

Activate/deactivate the automatic generation of the checksum character added to the barcode text.

Parameters
boolean$value
Returns
Zend_Barcode_Object
Exceptions
Zend_Barcode_Object_Exception
setWithQuietZones (   $value)

Activate/deactivate drawing of the quiet zones.

Parameters
boolean$value
Returns
Zend_Barcode_Object
validateText (   $value)

Check for invalid characters.

Parameters
string$valueText to be ckecked
Returns
void

Member Data Documentation

$_addLeadingZeros = true
protected
$_backgroundColor = 0xFFFFFF
protected
$_barcodeLength = null
protected
$_barcodeNamespace = 'Zend_Barcode_Object'
protected
$_barHeight = 50
protected
$_barThickWidth = 3
protected
$_barThinWidth = 1
protected
$_drawText = true
protected
$_factor = 1
protected
$_font = null
protected
$_fontSize = 10
protected
$_foreColor = 0x000000
protected
$_height = null
protected
$_instructions = array()
protected
$_mandatoryChecksum = false
protected
$_mandatoryQuietZones = false
protected
$_offsetLeft = null
protected
$_offsetTop = null
protected
$_orientation = 0
protected
$_staticFont = null
staticprotected
$_stretchText = false
protected
$_substituteChecksumCharacter = 0
protected
$_text = null
protected
$_type = null
protected
$_width = null
protected
$_withBorder = false
protected
$_withChecksum = false
protected
$_withChecksumInText = false
protected
$_withQuietZones = true
protected