當前位置: 首頁>>代碼示例>>PHP>>正文


PHP float::getCenter方法代碼示例

本文整理匯總了PHP中float::getCenter方法的典型用法代碼示例。如果您正苦於以下問題:PHP float::getCenter方法的具體用法?PHP float::getCenter怎麽用?PHP float::getCenter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在float的用法示例。


在下文中一共展示了float::getCenter方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: renderText

 /**
  * Render text depending of font type and available font extensions
  * 
  * @param string $id 
  * @param string $text 
  * @param string $font 
  * @param ezcGraphColor $color 
  * @param ezcGraphCoordinate $position 
  * @param float $size 
  * @param float $rotation 
  * @return void
  */
 protected function renderText($text, $font, ezcGraphColor $color, ezcGraphCoordinate $position, $size, $rotation = null)
 {
     $this->context->selectFontFace($font, CairoFontSlant::NORMAL, CairoFontWeight::NORMAL);
     $this->context->setFontSize($size);
     // Store current state of context
     $this->context->save();
     $this->context->moveTo(0, 0);
     if ($rotation !== null) {
         // Move to the center
         $this->context->translate($rotation->getCenter()->x, $rotation->getCenter()->y);
         // Rotate around text center
         $this->context->rotate(deg2rad($rotation->getRotation()));
         // Center the text
         $this->context->translate($position->x - $rotation->getCenter()->x, $position->y - $rotation->getCenter()->y - $size * 0.15);
     } else {
         $this->context->translate($position->x, $position->y - $size * 0.15);
     }
     $this->context->newPath();
     $this->getStyle($color, true);
     $this->context->showText($text);
     $this->context->stroke();
     // Restore state of context
     $this->context->restore();
 }
開發者ID:Adeelgill,項目名稱:livehelperchat,代碼行數:36,代碼來源:cairo_oo.php

示例2: renderText

 /**
  * Render text depending of font type and available font extensions
  * 
  * @param string $id 
  * @param string $text 
  * @param string $font 
  * @param ezcGraphColor $color 
  * @param ezcGraphCoordinate $position 
  * @param float $size 
  * @param float $rotation 
  * @return void
  */
 protected function renderText($text, $font, ezcGraphColor $color, ezcGraphCoordinate $position, $size, $rotation = null)
 {
     cairo_select_font_face($this->context, $font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
     cairo_set_font_size($this->context, $size);
     // Store current state of context
     cairo_save($this->context);
     cairo_move_to($this->context, 0, 0);
     if ($rotation !== null) {
         // Move to the center
         cairo_translate($this->context, $rotation->getCenter()->x, $rotation->getCenter()->y);
         // Rotate around text center
         cairo_rotate($this->context, deg2rad($rotation->getRotation()));
         // Center the text
         cairo_translate($this->context, $position->x - $rotation->getCenter()->x, $position->y - $rotation->getCenter()->y - $size * 0.15);
     } else {
         cairo_translate($this->context, $position->x, $position->y - $size * 0.15);
     }
     cairo_new_path($this->context);
     $this->getStyle($color, true);
     cairo_show_text($this->context, $text);
     cairo_stroke($this->context);
     // Restore state of context
     cairo_restore($this->context);
 }
開發者ID:jordanmanning,項目名稱:ezpublish,代碼行數:36,代碼來源:cairo.php


注:本文中的float::getCenter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。