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


PHP BCGBarcode1D::drawText方法代码示例

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


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

示例1: 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

示例2: drawText

 /**
  * Overloaded method for drawing special label
  *
  * @param resource $im
  */
 protected function drawText($im)
 {
     if ($this->label !== BCGBarcode1D::AUTO_LABEL) {
         parent::drawText($im);
     } elseif ($this->label !== '') {
         $temp_text = $this->text . $this->keys[$this->checksumValue];
         if ($this->textfont instanceof 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 and one starting
             $text0 = substr($temp_text, 0, 1);
             $text1 = substr($temp_text, 1, 6);
             $text2 = substr($temp_text, 7, 6);
             $font0 = clone $this->textfont;
             $font1 = clone $this->textfont;
             $font2 = clone $this->textfont;
             $font0->setText($text0);
             $font1->setText($text1);
             $font2->setText($text2);
             $xPosition0 = $this->offsetX * $this->scale - $font0->getWidth() - 4;
             // -4 is just for beauty
             $yPosition0 = $this->thickness * $this->scale + $font0->getHeight() / 2 + $this->offsetY * $this->scale;
             $xPosition1 = ($this->scale * 44 - $font1->getWidth()) / 2 + $code1 * $this->scale + $this->offsetX * $this->scale;
             $xPosition2 = ($this->scale * 44 - $font1->getWidth()) / 2 + $code2 * $this->scale + $this->offsetX * $this->scale;
             $yPosition = $this->thickness * $this->scale + $this->textfont->getHeight() + self::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);
         } elseif ($this->textfont !== 0) {
             $code1 = 0;
             $code2 = 0;
             $this->drawExtendedBars($im, 9, $code1, $code2);
             $startPosition = 10;
             $xPosition0 = $this->offsetX * $this->scale - imagefontwidth($this->textfont);
             $yPosition0 = $this->thickness * $this->scale - imagefontheight($this->textfont) / 2 + $this->offsetY * $this->scale;
             $xPosition1 = ($this->scale * 44 - imagefontwidth($this->textfont) * 6) / 2 + $code1 * $this->scale + $this->offsetX * $this->scale;
             $xPosition2 = ($this->scale * 44 - imagefontwidth($this->textfont) * 6) / 2 + $code2 * $this->scale + $this->offsetX * $this->scale;
             $yPosition = $this->thickness * $this->scale + 1 * $this->scale + $this->offsetY * $this->scale;
             $text_color = $this->colorFg->allocate($im);
             imagechar($im, $this->textfont, $xPosition0, $yPosition0, $temp_text[0], $text_color);
             imagestring($im, $this->textfont, $xPosition1, $yPosition, substr($temp_text, 1, 6), $text_color);
             imagestring($im, $this->textfont, $xPosition2, $yPosition, substr($temp_text, 7, 6), $text_color);
         }
     }
 }
开发者ID:lincome,项目名称:wechat-O2O-hyk,代码行数:53,代码来源:BCGean13.barcode.php

示例3: drawText

 /**
  * Overloaded method for drawing special label.
  *
  * @param resource $im
  */
 protected function drawText($im)
 {
     if ($this->label !== BCGBarcode1D::AUTO_LABEL) {
         parent::drawText($im);
     } elseif ($this->label !== '') {
         $temp_text = $this->text . $this->keys[$this->checksumValue];
         if ($this->textfont instanceof 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
             $text1 = substr($temp_text, 0, 4);
             $text2 = substr($temp_text, 4, 4);
             $font1 = clone $this->textfont;
             $font2 = clone $this->textfont;
             $font1->setText($text1);
             $font2->setText($text2);
             // The $this->res offset is to center without thinking of the white space in the guard
             $xPosition1 = ($this->scale * 30 - $font1->getWidth()) / 2 + $code1 * $this->scale + $this->offsetX * $this->scale;
             $xPosition2 = ($this->scale * 30 - $font2->getWidth()) / 2 + $code2 * $this->scale + $this->offsetX * $this->scale;
             $yPosition = $this->thickness * $this->scale + $this->textfont->getHeight() + BCGBarcode1D::SIZE_SPACING_FONT + $this->offsetY * $this->scale;
             $text_color = $this->colorFg->allocate($im);
             $font1->draw($im, $text_color, $xPosition1, $yPosition);
             $font2->draw($im, $text_color, $xPosition2, $yPosition);
         } elseif ($this->textfont !== 0) {
             $code1 = 0;
             $code2 = 0;
             $this->drawExtendedBars($im, 9, $code1, $code2);
             $xPosition1 = ($this->scale * 30 - imagefontwidth($this->textfont) * 4) / 2 + $code1 * $this->scale + $this->offsetX * $this->scale;
             $xPosition2 = ($this->scale * 30 - imagefontwidth($this->textfont) * 4) / 2 + $code2 * $this->scale + $this->offsetX * $this->scale;
             $yPosition = $this->thickness * $this->scale + 1 * $this->scale + $this->offsetY * $this->scale;
             $text_color = $this->colorFg->allocate($im);
             imagestring($im, $this->textfont, $xPosition1, $yPosition, substr($temp_text, 0, 4), $text_color);
             imagestring($im, $this->textfont, $xPosition2, $yPosition, substr($temp_text, 4, 4), $text_color);
         }
     }
 }
开发者ID:marsa1985,项目名称:kazabiz,代码行数:43,代码来源:BCGean8.barcode.php


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