Constants

COLOR_BG

COLOR_BG = 0

COLOR_FG

COLOR_FG = 1

Properties

$colorFg

$colorFg

$colorBg

$colorBg

$scale

$scale

$offsetX

$offsetX

$offsetY

$offsetY

$labels

$labels

$pushLabel

$pushLabel

$scaleX

$scaleX

$scaleY

$scaleY

Methods

parse()

parse(mixed  $text) : mixed

Parses the text before displaying it.

Parameters

mixed $text

Returns

mixed —

getForegroundColor()

getForegroundColor() : \BarcodeBakery\Common\BCGColor

Gets the foreground color of the barcode.

Returns

\BarcodeBakery\Common\BCGColor —

setForegroundColor()

setForegroundColor(mixed  $code) : mixed

Sets the foreground color of the barcode. It could be a BCGColor value or simply a language code (white, black, yellow...) or hex value.

Parameters

mixed $code

Returns

mixed —

getBackgroundColor()

getBackgroundColor() : \BarcodeBakery\Common\BCGColor

Gets the background color of the barcode.

Returns

\BarcodeBakery\Common\BCGColor —

setBackgroundColor()

setBackgroundColor(mixed  $code) : mixed

Sets the background color of the barcode. It could be a BCGColor value or simply a language code (white, black, yellow...) or hex value.

Parameters

mixed $code

Returns

mixed —

setColor()

setColor(mixed  $fg, mixed  $bg) : mixed

Sets the color.

Parameters

mixed $fg
mixed $bg

Returns

mixed —

getScale()

getScale() : int

Gets the scale of the barcode.

Returns

int —

setScale()

setScale(int  $scale) : mixed

Sets the scale of the barcode in pixel.

If the scale is lower than 1, an exception is raised.

Parameters

int $scale

Returns

mixed —

draw()

draw(resource  $im) : mixed

Abstract method that draws the barcode on the resource.

Parameters

resource $im

Returns

mixed —

getDimension()

getDimension(int  $w, int  $h) : int[]

Returns the maximal size of a barcode.

Parameters

int $w
int $h

Returns

int[] —

getOffsetX()

getOffsetX() : int

Gets the X offset.

Returns

int —

setOffsetX()

setOffsetX(int  $offsetX) : mixed

Sets the X offset.

Parameters

int $offsetX

Returns

mixed —

getOffsetY()

getOffsetY() : int

Gets the Y offset.

Returns

int —

setOffsetY()

setOffsetY(int  $offsetY) : mixed

Sets the Y offset.

Parameters

int $offsetY

Returns

mixed —

addLabel()

addLabel(\BarcodeBakery\Common\BCGLabel  $label) : mixed

Adds the label to the drawing.

Parameters

\BarcodeBakery\Common\BCGLabel $label

Returns

mixed —

removeLabel()

removeLabel(\BarcodeBakery\Common\BCGLabel  $label) : mixed

Removes the label from the drawing.

Parameters

\BarcodeBakery\Common\BCGLabel $label

Returns

mixed —

getLabels()

getLabels() : \BarcodeBakery\Common\BCGLabel[]

Gets the labels.

Returns

\BarcodeBakery\Common\BCGLabel[] —

clearLabels()

clearLabels() : mixed

Clears the labels.

Returns

mixed —

__construct()

__construct() : mixed

Constructor.

Returns

mixed —

drawText()

drawText(resource  $im, int  $x1, int  $y1, int  $x2, int  $y2) : mixed

Draws the text.

The coordinate passed are the positions of the barcode. $x1 and $y1 represent the top left corner. $x2 and $y2 represent the bottom right corner.

Parameters

resource $im
int $x1
int $y1
int $x2
int $y2

Returns

mixed —

drawPixel()

drawPixel(resource  $im, int  $x, int  $y, int  $color = self::COLOR_FG) : mixed

Draws 1 pixel on the resource at a specific position with a determined color.

Parameters

resource $im
int $x
int $y
int $color

Returns

mixed —

drawRectangle()

drawRectangle(resource  $im, int  $x1, int  $y1, int  $x2, int  $y2, int  $color = BCGBarcode::COLOR_FG) : mixed

Draws an empty rectangle on the resource at a specific position with a determined color.

Parameters

resource $im
int $x1
int $y1
int $x2
int $y2
int $color

Returns

mixed —

drawFilledRectangle()

drawFilledRectangle(resource  $im, int  $x1, int  $y1, int  $x2, int  $y2, int  $color = BCGBarcode::COLOR_FG) : mixed

Draws a filled rectangle on the resource at a specific position with a determined color.

Parameters

resource $im
int $x1
int $y1
int $x2
int $y2
int $color

Returns

mixed —

getColor()

getColor(resource  $im, int  $color) : resource

Allocates the color based on the integer.

Parameters

resource $im
int $color

Returns

resource —

setScaleX()

setScaleX(int  $scaleX) : mixed

Sets the scale of the barcode in pixel for X.

If the scale is lower than 1, an exception is raised.

Parameters

int $scaleX

Returns

mixed —

setScaleY()

setScaleY(int  $scaleY) : mixed

Sets the scale of the barcode in pixel for Y.

If the scale is lower than 1, an exception is raised.

Parameters

int $scaleY

Returns

mixed —

getBiggestLabels()

getBiggestLabels(bool  $reversed = false) : \BarcodeBakery\Common\BCGLabel[]

Returning the biggest label widths for LEFT/RIGHT and heights for TOP/BOTTOM.

Parameters

bool $reversed

Returns

\BarcodeBakery\Common\BCGLabel[] —