當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。