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


PHP GenericFormattedBox::get_left_background方法代码示例

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


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

示例1: show

 /**
  * Renders the backgroung image using the specified output driver.
  * 
  * @param OutputDriver $driver an output driver object
  * @param GenericFormattedBox $box an box owning this background image
  * @param int $repeat the 'background-repeat' value
  * @param BackgroundPosition $position the 'background-position' value
  *
  * @uses BackgroundPosition
  * @uses OutputDriver
  */
 function show(&$driver, $box, $repeat, $position, $attachment)
 {
     /**
      * If no image should be rendered, just return
      * @see BackgroundImage::$_url
      */
     if (is_null($this->_url)) {
         return;
     }
     if (is_null($this->_image)) {
         return;
     }
     if ($attachment == BACKGROUND_ATTACHMENT_FIXED && $box->getCSSProperty(CSS_DISPLAY) == '-body') {
         $media =& $driver->get_media();
         $left = $box->get_left_background();
         $right = $box->get_right_background();
         $top = $driver->offset + mm2pt($media->margins['bottom']) + mm2pt($media->real_height());
         $bottom = $driver->offset + mm2pt($media->margins['bottom']);
     } else {
         $left = $box->get_left_background();
         $right = $box->get_right_background();
         $top = $box->get_top_background();
         $bottom = $box->get_bottom_background();
     }
     /**
      * Setup clipping region for padding area. Note that background image is drawn in the padding 
      * area which in generic case is greater than content area.
      * 
      * @see OutputDriver::clip()
      *
      * @link http://www.w3.org/TR/CSS21/box.html#box-padding-area CSS 2.1 definition of padding area
      */
     $driver->save();
     $driver->moveto($left, $top);
     $driver->lineto($right, $top);
     $driver->lineto($right, $bottom);
     $driver->lineto($left, $bottom);
     $driver->closepath();
     $driver->clip();
     /**
      * get real image size in device points
      *
      * @see pt2pt()
      * @see px2pt()
      */
     $image_height = px2pt(imagesy($this->_image));
     $image_width = px2pt(imagesx($this->_image));
     /**
      * Get dimensions of the rectangle to be filled with the background image
      */
     $padding_width = $right - $left;
     $padding_height = $top - $bottom;
     /**
      * Calculate the vertical offset from the top padding edge to the background image top edge using current 
      * 'background-position' value. 
      * 
      * @link file:///C:/docs/css/colors.html#propdef-background-position CSS 2 'background-position' description
      */
     if ($position->x_percentage) {
         $x_offset = ($padding_width - $image_width) * $position->x / 100;
     } else {
         $x_offset = $position->x;
     }
     /**
      * Calculate the horizontal offset from the left padding edge to the background image left edge using current 
      * 'background-position' value
      * 
      * @link file:///C:/docs/css/colors.html#propdef-background-position CSS 2 'background-position' description
      */
     if ($position->y_percentage) {
         $y_offset = ($padding_height - $image_height) * $position->y / 100;
     } else {
         $y_offset = $position->y;
     }
     /**
      * Output the image (probably tiling it; depends on current value of 'background-repeat') using 
      * current output driver's tiled image output functions. Note that px2pt(1) is an image scaling factor; as all
      * page element are scaled to fit the media, background images should be scaled too!
      * 
      * @see OutputDriver::image()
      * @see OutputDriver::image_rx()
      * @see OutputDriver::image_ry()
      * @see OutputDriver::image_rxry()
      *
      * @link file:///C:/docs/css/colors.html#propdef-background-repeat CSS 2.1 'background-repeat' property description
      */
     switch ($repeat) {
         case BR_NO_REPEAT:
             /**
//.........这里部分代码省略.........
开发者ID:emildev35,项目名称:processmaker,代码行数:101,代码来源:background.image.php

示例2: show

 /**
  * Renders the background for the given box object using an output driver
  *
  * @param OutputDriver $driver Output driver to be used
  * @param GenericFormattedBox $box Box the background is rendered for
  *
  * @uses GenericFormattedBox
  * @uses OutputDriver
  */
 function show(&$driver, &$box)
 {
     /**
      * Fill box with background color
      *
      * @see Color::apply
      * @see OutputDriver::moveto
      * @see OutputDriver::lineto
      * @see OutputDriver::closepath
      * @see OutputDriver::fill
      */
     if (!$this->_color->transparent) {
         $this->_color->apply($driver);
         $driver->moveto($box->get_left_background(), $box->get_top_background());
         $driver->lineto($box->get_right_background(), $box->get_top_background());
         $driver->lineto($box->get_right_background(), $box->get_bottom_background());
         $driver->lineto($box->get_left_background(), $box->get_bottom_background());
         $driver->closepath();
         $driver->fill();
     }
     /**
      * Render background image
      *
      * @see BackgroundImage::show
      */
     $this->_image->show($driver, $box, $this->_repeat, $this->_position, $this->_attachment);
 }
开发者ID:dadigo,项目名称:simpleinvoices,代码行数:36,代码来源:value.background.php


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