当前位置: 首页>>代码示例>>PHP>>正文


PHP BCGBarcode1D类代码示例

本文整理汇总了PHP中BCGBarcode1D的典型用法代码示例。如果您正苦于以下问题:PHP BCGBarcode1D类的具体用法?PHP BCGBarcode1D怎么用?PHP BCGBarcode1D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BCGBarcode1D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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);
         }
     }
 }
开发者ID:roquebrasilia,项目名称:sgdoc-codigo,代码行数:26,代码来源:BCGothercode.barcode.php

示例2: getMaxSize

 /**
  * Returns the maximal size of a barcode
  *
  * @return int[]
  */
 function getMaxSize()
 {
     $p = BCGBarcode1D::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]);
 }
开发者ID:blasiuscosa,项目名称:manobo-2008,代码行数:17,代码来源:BCGi25.barcode.php

示例3: drawText

 /**
  * Draws the label under the barcode
  *
  * @param resource $im
  */
 function drawText(&$im)
 {
     // protected
     $label = $this->getLabel();
     if (!empty($label)) {
         $pA = $this->getMaxSize();
         $pB = BCGBarcode1D::getMaxSize();
         $w = $pA[0] - $pB[0];
         if (is_a($this->textfont, 'BCGFont')) {
             $textfont = $this->textfont;
             // clone
             $textfont->setText($label);
             $xPosition = $w / 2 - $textfont->getWidth() / 2 + $this->offsetX * $this->scale;
             $yPosition = $this->thickness * $this->scale + $textfont->getHeight() - $textfont->getUnderBaseline() + $this->SIZE_SPACING_FONT + $this->offsetY * $this->scale;
             $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->thickness * $this->scale + $this->SIZE_SPACING_FONT + $this->offsetY * $this->scale;
             imagestring($im, $this->textfont, $xPosition, $yPosition, $label, $this->colorFg->allocate($im));
         }
     }
 }
开发者ID:blasiuscosa,项目名称:manobo-2008,代码行数:27,代码来源:BCGBarcode1D.php

示例4: drawText

 /**
  * Overloaded method for drawing special label
  *
  * @param resource $im
  */
 protected function drawText($im)
 {
     parent::drawText($im);
     if (strlen($this->isbn_created) > 0) {
         $pA = $this->getMaxSize();
         $pB = BCGBarcode1D::getMaxSize();
         $w = $pA[0] - $pB[0];
         if ($this->isbn_textfont instanceof BCGFont) {
             $textfont = clone $this->isbn_textfont;
             $textfont->setText($this->isbn_created);
             $xPosition = $w / 2 - $textfont->getWidth() / 2 + $this->offsetX * $this->scale;
             $yPosition = $this->offsetY * $this->scale - BCGBarcode1D::SIZE_SPACING_FONT;
             $textfont->draw($im, $this->colorFg->allocate($im), $xPosition, $yPosition);
         } elseif ($this->isbn_textfont !== 0) {
             $xPosition = $w / 2 - strlen($this->isbn_created) / 2 * imagefontwidth($this->isbn_textfont) + $this->offsetX * $this->scale;
             $yPosition = $this->offsetY * $this->scale - BCGBarcode1D::SIZE_SPACING_FONT - imagefontheight($this->isbn_textfont);
             imagestring($im, $this->isbn_textfont, $xPosition, $yPosition, $this->isbn_created, $this->colorFg->allocate($im));
         }
     }
 }
开发者ID:CHAIUganda,项目名称:ViralLoad,代码行数:25,代码来源:BCGisbn.barcode.php

示例5: drawText

 /**
  * Overloaded method for drawing special label
  *
  * @param resource $im
  */
 function drawText(&$im)
 {
     if ($this->label !== $this->AUTO_LABEL) {
         BCGBarcode1D::drawText($im);
     } elseif ($this->label !== '') {
         $temp_text = $this->text . $this->keys[$this->checksumValue];
         if (is_a($this->textfont, 'BCGFont')) {
             $code1 = 0;
             $code2 = 0;
             $this->textfont->setText($temp_text);
             $this->drawExtendedBars($im, $this->textfont->getHeight(), $code1, $code2);
             // We need to separate the text, one on the left and one on the right, one starting and one ending
             $text0 = substr($temp_text, 1, 1);
             $text1 = substr($temp_text, 2, 5);
             $text2 = substr($temp_text, 7, 5);
             $text3 = substr($temp_text, 12, 1);
             $font0 = $this->textfont;
             // clone
             $font1 = $this->textfont;
             // clone
             $font2 = $this->textfont;
             // clone
             $font3 = $this->textfont;
             // clone
             $font0->setText($text0);
             $font1->setText($text1);
             $font2->setText($text2);
             $font3->setText($text3);
             $xPosition0 = $this->offsetX * $this->scale - $font0->getWidth() - 4;
             // -4 is just for beauty;
             $xPosition3 = $this->offsetX * $this->scale + $this->positionX * $this->scale + 2;
             $yPosition0 = $this->thickness * $this->scale + $font0->getHeight() / 2 + $this->offsetY * $this->scale;
             $xPosition1 = ($this->scale * 36 - $font1->getWidth()) / 2 + $code1 * $this->scale + $this->offsetX * $this->scale;
             $xPosition2 = ($this->scale * 37 - $font2->getWidth()) / 2 + $code2 * $this->scale + $this->offsetX * $this->scale;
             $yPosition = $this->thickness * $this->scale + $this->textfont->getHeight() + $this->SIZE_SPACING_FONT + $this->offsetY * $this->scale;
             $text_color = $this->colorFg->allocate($im);
             $font0->draw($im, $text_color, $xPosition0, $yPosition0);
             $font1->draw($im, $text_color, $xPosition1, $yPosition);
             $font2->draw($im, $text_color, $xPosition2, $yPosition);
             $font3->draw($im, $text_color, $xPosition3, $yPosition0);
         } elseif ($this->textfont !== 0) {
             $code1 = 0;
             $code2 = 0;
             $this->drawExtendedBars($im, 9, $code1, $code2);
             $xPosition0 = $this->offsetX * $this->scale - imagefontwidth($this->textfont);
             $xPosition3 = $this->offsetX * $this->scale + $this->positionX * $this->scale + 2;
             $yPosition0 = $this->thickness * $this->scale - imagefontheight($this->textfont) / 2 + $this->offsetY * $this->scale;
             $xPosition1 = ($this->scale * 36 - imagefontwidth($this->textfont) * 5) / 2 + $code1 * $this->scale + $this->offsetX * $this->scale;
             $xPosition2 = ($this->scale * 37 - imagefontwidth($this->textfont) * 5) / 2 + $code2 * $this->scale + $this->offsetX * $this->scale;
             $yPosition = $this->thickness * $this->scale + $this->offsetY * $this->scale;
             $text_color = $this->colorFg->allocate($im);
             imagechar($im, $this->textfont, $xPosition0, $yPosition0, $temp_text[1], $text_color);
             imagestring($im, $this->textfont, $xPosition1, $yPosition, substr($temp_text, 2, 5), $text_color);
             imagestring($im, $this->textfont, $xPosition2, $yPosition, substr($temp_text, 7, 5), $text_color);
             imagechar($im, $this->textfont, $xPosition3, $yPosition0, $temp_text[12], $text_color);
         }
     }
 }
开发者ID:blasiuscosa,项目名称:manobo-2008,代码行数:63,代码来源:BCGupca.barcode.php

示例6: 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]);
 }
开发者ID:viktoredz,项目名称:bpom-spkp,代码行数:12,代码来源:BCGothercode.barcode.php

示例7: validate

 /**
  * Validates the input.
  */
 protected function validate()
 {
     $c = strlen($this->text);
     if ($c === 0) {
         throw new BCGParseException('othercode', 'No data has been entered.');
     }
     parent::validate();
 }
开发者ID:hscomp2002,项目名称:superp,代码行数:11,代码来源:BCGothercode.barcode.php

示例8: 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]);
 }
开发者ID:marsa1985,项目名称:kazabiz,代码行数:14,代码来源:BCGmsi.barcode.php

示例9: getDimension

 /**
  * Returns the maximal size of a barcode.
  *
  * @param int $w
  * @param int $h
  * @return int[]
  */
 public function getDimension($w, $h)
 {
     $textlength = 12 * strlen($this->text);
     $startlength = 3;
     $checksumlength = $this->checksum * 12;
     $endlength = 4;
     $w += $startlength + $textlength + $checksumlength + $endlength;
     $h += $this->thickness;
     return parent::getDimension($w, $h);
 }
开发者ID:rajarshc,项目名称:Rooja,代码行数:17,代码来源:BCGmsi.barcode.php

示例10: 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]);
 }
开发者ID:roquebrasilia,项目名称:sgdoc-codigo,代码行数:17,代码来源:BCGpostnet.barcode.php

示例11: validate

 /**
  * Validates the input.
  */
 protected function validate()
 {
     $c = strlen($this->text);
     if ($c === 0) {
         throw new BCGParseException('othercode', 'No data has been entered.');
     }
     // Checking if all chars are allowed
     for ($i = 0; $i < $c; $i++) {
         if (array_search($this->text[$i], $this->keys) === false) {
             throw new BCGParseException('othercode', 'The character \'' . $this->text[$i] . '\' is not allowed.');
         }
     }
     parent::validate();
 }
开发者ID:sea129,项目名称:kbay,代码行数:17,代码来源:BCGothercode.barcode.php

示例12: 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]);
 }
开发者ID:lincome,项目名称:wechat-O2O-hyk,代码行数:19,代码来源:BCGcodabar.barcode.php

示例13: 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]);
 }
开发者ID:roquebrasilia,项目名称:sgdoc-codigo,代码行数:27,代码来源:BCGcode11.barcode.php

示例14: validate

 /**
  * Validates the input.
  */
 protected function validate()
 {
     $c = count($this->data);
     if ($c === 0) {
         throw new BCGParseException('code128', 'No data has been entered.');
     }
     parent::validate();
 }
开发者ID:hscomp2002,项目名称:superp,代码行数:11,代码来源:BCGcode128.barcode.php

示例15: 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]);
 }
开发者ID:shojibflamon,项目名称:Bar-Code-example,代码行数:14,代码来源:BCGcode128.barcode.php


注:本文中的BCGBarcode1D类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。