本文整理汇总了PHP中BCGBarcode1D::getMaxSize方法的典型用法代码示例。如果您正苦于以下问题:PHP BCGBarcode1D::getMaxSize方法的具体用法?PHP BCGBarcode1D::getMaxSize怎么用?PHP BCGBarcode1D::getMaxSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BCGBarcode1D
的用法示例。
在下文中一共展示了BCGBarcode1D::getMaxSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMaxSize
/**
* Returns the maximal size of a barcode
*
* @return int[]
*/
public function getMaxSize()
{
$p = parent::getMaxSize();
$array = str_split($this->text, 1);
$textlength = (array_sum($array) + count($array)) * $this->scale;
return array($p[0] + $textlength, $p[1]);
}
示例2: getMaxSize
/**
* Returns the maximal size of a barcode.
*
* @return int[]
*/
public function getMaxSize()
{
$p = parent::getMaxSize();
$textlength = 12 * strlen($this->text) * $this->scale;
$startlength = 3 * $this->scale;
$checksumlength = $this->checksum * 12 * $this->scale;
$endlength = 4 * $this->scale;
return array($p[0] + $startlength + $textlength + $checksumlength + $endlength, $p[1]);
}
示例3: getMaxSize
/**
* Returns the maximal size of a barcode.
*
* @return int[]
*/
public function getMaxSize()
{
$p = parent::getMaxSize();
$startlength = 3 * $this->scale;
$centerlength = 5 * $this->scale;
$textlength = 8 * 7 * $this->scale;
$endlength = 3 * $this->scale;
return array($p[0] + $startlength + $centerlength + $textlength + $endlength, $p[1]);
}
示例4: getMaxSize
/**
* Returns the maximal size of a barcode
*
* @return int
*/
public function getMaxSize()
{
$p = parent::getMaxSize();
$c = strlen($this->text);
$startlength = 6 * $this->scale;
$textlength = $c * 5 * 6 * $this->scale;
$checksumlength = 5 * 6 * $this->scale;
$endlength = 6 * $this->scale;
// We remove the white on the right
$removelength = -3 * $this->scale;
return array($p[0] + $startlength + $textlength + $checksumlength + $endlength + $removelength, $p[1]);
}
示例5: getMaxSize
/**
* Returns the maximal size of a barcode.
*
* @return int[]
*/
public function getMaxSize()
{
$p = parent::getMaxSize();
$textlength = 7 * strlen($this->text) * $this->scale;
$startlength = 4 * $this->scale;
$checksumlength = 0;
if ($this->checksum === true) {
$checksumlength = 7 * $this->scale;
}
$endlength = 4 * $this->scale;
return array($p[0] + $startlength + $textlength + $checksumlength + $endlength, $p[1]);
}
示例6: getMaxSize
/**
* Returns the maximal size of a barcode.
*
* @return int[]
*/
public function getMaxSize()
{
$p = parent::getMaxSize();
$c = strlen($this->text);
$startlength = 8 * $this->scale;
$textlength = $c * 14 * $this->scale;
$checksumlength = 0;
if ($c % 2 !== 0) {
$checksumlength = 14 * $this->scale;
}
$endlength = 7 * $this->scale;
return array($p[0] + $startlength + $textlength + $checksumlength + $endlength, $p[1]);
}
示例7: getMaxSize
/**
* Returns the maximal size of a barcode
*
* @return int[]
*/
public function getMaxSize()
{
$p = parent::getMaxSize();
$w = 0;
$c = strlen($this->text);
for ($i = 0; $i < $c; $i++) {
$index = $this->findIndex($this->text[$i]);
if ($index !== false) {
$w += 8;
$w += substr_count($this->code[$index], '1');
}
}
return array($p[0] + $w * $this->scale, $p[1]);
}
示例8: drawText
/**
* Overloaded method for drawing special label
*
* @param resource $im
*/
protected function drawText($im)
{
if ($this->label !== BCGBarcode1D::AUTO_LABEL && $this->label !== '') {
$pA = $this->getMaxSize();
$pB = BCGBarcode1D::getMaxSize();
$w = $pA[0] - $pB[0];
if ($this->textfont instanceof BCGFont) {
$textfont = clone $this->textfont;
$textfont->setText($this->label);
$xPosition = $w / 2 - $textfont->getWidth() / 2 + $this->offsetX * $this->scale;
$yPosition = $this->thickness * $this->scale + $textfont->getHeight() - $textfont->getUnderBaseline() + BCGBarcode1D::SIZE_SPACING_FONT + $this->offsetY * $this->scale;
$text_color = $this->colorFg->allocate($im);
$textfont->draw($im, $text_color, $xPosition, $yPosition);
} elseif ($this->textfont !== 0) {
$xPosition = $w / 2 - strlen($this->label) * imagefontwidth($this->textfont) / 2 + $this->offsetX * $this->scale;
$yPosition = $this->thickness * $this->scale + $this->offsetY * $this->scale + BCGBarcode1D::SIZE_SPACING_FONT;
$text_color = $this->colorFg->allocate($im);
imagestring($im, $this->textfont, $xPosition, $yPosition, $this->label, $text_color);
}
}
}
示例9: getMaxSize
/**
* Returns the maximal size of a barcode.
*
* @return int[]
*/
public function getMaxSize()
{
$p = parent::getMaxSize();
$w = 0;
$c = strlen($this->text);
for ($i = 0; $i < $c; $i++) {
$index = $this->findIndex($this->text[$i]);
if ($index !== false) {
$w += 6;
$w += substr_count($this->code[$index], '1');
}
}
$startlength = 8 * $this->scale;
$textlength = $w * $this->scale;
// We take the max length possible for checksums (it is 7 or 8...)
$checksumlength = 8 * $this->scale;
if ($c >= 10) {
$checksumlength += 8 * $this->scale;
}
$endlength = 7 * $this->scale;
return array($p[0] + $startlength + $textlength + $checksumlength + $endlength, $p[1]);
}
示例10: getMaxSize
/**
* Returns the maximal size of a barcode.
*
* @return int[]
*/
public function getMaxSize()
{
$p = parent::getMaxSize();
$startlength = 3 * $this->scale;
$centerlength = 5 * $this->scale;
$textlength = 6 * 7 * $this->scale;
$endlength = $this->scale;
$lastcharlength = $this->getEndPosition() + 2;
return array($p[0] + $startlength + $centerlength + $textlength + $endlength + $lastcharlength, $p[1]);
}
示例11: getMaxSize
/**
* Returns the maximal size of a barcode.
*
* @return int[]
*/
public function getMaxSize()
{
$p = parent::getMaxSize();
$startlength = 9 * $this->scale;
$textlength = 9 * count($this->data) * $this->scale;
$checksumlength = 2 * 9 * $this->scale;
$endlength = 9 * $this->scale + $this->scale;
// + final bar
return array($p[0] + $startlength + $textlength + $checksumlength + $endlength, $p[1]);
}
示例12: getMaxSize
/**
* Returns the maximal size of a barcode
*
* @return int[]
*/
function getMaxSize()
{
$p = BCGBarcode1D::getMaxSize();
$startlength = 3 * $this->scale;
$centerlength = 5 * $this->scale;
$textlength = 12 * 7 * $this->scale;
$endlength = 3 * $this->scale;
return array($p[0] + $startlength + $centerlength + $textlength + $endlength, $p[1]);
}
示例13: getMaxSize
/**
* Returns the maximal size of a barcode
*
* @return int[]
*/
public function getMaxSize()
{
$p = parent::getMaxSize();
// Contains start + text + checksum + stop
$textlength = count($this->data) * 11 * $this->scale;
$endlength = 2 * $this->scale;
// + final bar
return array($p[0] + $textlength + $endlength, $p[1]);
}
示例14: getMaxSize
public function getMaxSize()
{
$p = parent::getMaxSize();
$textlength = count($this->data) * 11 * $this->scale;
$endlength = 2 * $this->scale;
// + final bar
return array($p[0] + $textlength + $endlength, $p[1]);
}
示例15: drawText
/**
* Overloaded method for drawing special label.
*
* @param resource $im
*/
protected function drawText($im)
{
$label = $this->getLabel();
if (!empty($label)) {
$pA = $this->getMaxSize();
$pB = BCGBarcode1D::getMaxSize();
$w = $pA[0] - $pB[0];
if ($this->textfont instanceof BCGFont) {
$textfont = clone $this->textfont;
$textfont->setText($label);
$xPosition = $w / 2 - $textfont->getWidth() / 2 + $this->offsetX * $this->scale;
$yPosition = $this->offsetY * $this->scale - BCGBarcode1D::SIZE_SPACING_FONT + 1;
// +1 for anti-aliasing
$textfont->draw($im, $this->colorFg->allocate($im), $xPosition, $yPosition);
} elseif ($this->textfont !== 0) {
$xPosition = $w / 2 - strlen($label) / 2 * imagefontwidth($this->textfont) + $this->offsetX * $this->scale;
$yPosition = $this->offsetY * $this->scale - BCGBarcode1D::SIZE_SPACING_FONT - imagefontheight($this->textfont);
imagestring($im, $this->textfont, $xPosition, $yPosition, $label, $this->colorFg->allocate($im));
}
}
}