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


PHP Frame::get_style方法代码示例

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


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

示例1: render

 function render(Frame $frame)
 {
     $style = $frame->get_style();
     list($x, $y, $w, $h) = $frame->get_padding_box();
     $this->_set_opacity($frame->get_opacity($style->opacity));
     // Draw our background, border and content
     if (($bg = $style->background_color) !== "transparent") {
         $this->_canvas->filled_rectangle($x, $y, $w, $h, $bg);
     }
     if (($url = $style->background_image) && $url !== "none") {
         $this->_background_image($url, $x, $y, $w, $h, $style);
     }
     $this->_render_border($frame);
     $this->_render_outline($frame);
     if (DEBUG_LAYOUT && DEBUG_LAYOUT_BLOCKS) {
         $this->_debug_layout($frame->get_border_box(), "red");
         if (DEBUG_LAYOUT_PADDINGBOX) {
             $this->_debug_layout($frame->get_padding_box(), "red", array(0.5, 0.5));
         }
     }
     if (DEBUG_LAYOUT && DEBUG_LAYOUT_LINES && $frame->get_decorator()) {
         foreach ($frame->get_decorator()->get_lines() as $line) {
             $frame->_debug_layout(array($line["x"], $line["y"], $line["w"], $line["h"]), "orange");
         }
     }
 }
开发者ID:snehakumavat,项目名称:thar,代码行数:26,代码来源:block_renderer.cls.php

示例2: render

 function render(Frame $frame)
 {
     $style = $frame->get_style();
     list($x, $y, $w, $h) = $frame->get_border_box();
     $this->_set_opacity($frame->get_opacity($style->opacity));
     if ($frame->get_node()->nodeName === "body") {
         $h = $frame->get_containing_block("h") - $style->length_in_pt(array($style->margin_top, $style->padding_top, $style->border_top_width, $style->border_bottom_width, $style->padding_bottom, $style->margin_bottom), $style->width);
     }
     // Draw our background, border and content
     if (($bg = $style->background_color) !== "transparent") {
         $this->_canvas->filled_rectangle($x, $y, $w, $h, $bg);
     }
     if (($url = $style->background_image) && $url !== "none") {
         $this->_background_image($url, $x, $y, $w, $h, $style);
     }
     $this->_render_border($frame);
     $this->_render_outline($frame);
     if (DEBUG_LAYOUT && DEBUG_LAYOUT_BLOCKS) {
         $this->_debug_layout($frame->get_border_box(), "red");
         if (DEBUG_LAYOUT_PADDINGBOX) {
             $this->_debug_layout($frame->get_padding_box(), "red", array(0.5, 0.5));
         }
     }
     if (DEBUG_LAYOUT && DEBUG_LAYOUT_LINES && $frame->get_decorator()) {
         foreach ($frame->get_decorator()->get_line_boxes() as $line) {
             $frame->_debug_layout(array($line->x, $line->y, $line->w, $line->h), "orange");
         }
     }
 }
开发者ID:DaveNascimento,项目名称:civicrm-packages,代码行数:29,代码来源:block_renderer.cls.php

示例3:

 function apply_page_style(Frame $frame, $page_number)
 {
     $style = $frame->get_style();
     $page_styles = $style->get_stylesheet()->get_page_styles();
     if (count($page_styles) > 1) {
         $odd = $page_number % 2 == 1;
         $first = $page_number == 1;
         $style = clone $page_styles["base"];
         if ($odd && isset($page_styles[":right"])) {
             $style->merge($page_styles[":right"]);
         }
         if ($odd && isset($page_styles[":odd"])) {
             $style->merge($page_styles[":odd"]);
         }
         if (!$odd && isset($page_styles[":left"])) {
             $style->merge($page_styles[":left"]);
         }
         if (!$odd && isset($page_styles[":even"])) {
             $style->merge($page_styles[":even"]);
         }
         if ($first && isset($page_styles[":first"])) {
             $style->merge($page_styles[":first"]);
         }
         $frame->set_style($style);
     }
 }
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:26,代码来源:page_frame_reflower.cls.php

示例4: list

 /**
  * Class constructor
  *
  * @param Frame $frame the bullet frame to decorate
  * @param DOMPDF $dompdf the document's dompdf object
  */
 function __construct(Frame $frame, DOMPDF $dompdf)
 {
     $style = $frame->get_style();
     $url = $style->list_style_image;
     $frame->get_node()->setAttribute("src", $url);
     $this->_img = new Image_Frame_Decorator($frame, $dompdf);
     parent::__construct($this->_img, $dompdf);
     list($width, $height) = dompdf_getimagesize($this->_img->get_image_url());
     // Resample the bullet image to be consistent with 'auto' sized images
     // See also Image_Frame_Reflower::get_min_max_width
     // Tested php ver: value measured in px, suffix "px" not in value: rtrim unnecessary.
     $this->_width = (double) rtrim($width, "px") * 72 / DOMPDF_DPI;
     $this->_height = (double) rtrim($height, "px") * 72 / DOMPDF_DPI;
     //If an image is taller as the containing block/box, the box should be extended.
     //Neighbour elements are overwriting the overlapping image areas.
     //Todo: Where can the box size be extended?
     //Code below has no effect.
     //See block_frame_reflower _calculate_restricted_height
     //See generated_frame_reflower, Dompdf:render() "list-item", "-dompdf-list-bullet"S.
     //Leave for now
     //if ($style->min_height < $this->_height ) {
     //  $style->min_height = $this->_height;
     //}
     //$style->height = "auto";
 }
开发者ID:agashish,项目名称:test_new,代码行数:31,代码来源:list_bullet_image_frame_decorator.cls.php

示例5: array

 function get_min_max_width()
 {
     if (!is_null($this->_min_max_cache)) {
         return $this->_min_max_cache;
     }
     $style = $this->_frame->get_style();
     // Account for margins & padding
     $dims = array($style->padding_left, $style->padding_right, $style->border_left_width, $style->border_right_width, $style->margin_left, $style->margin_right);
     $cb_w = $this->_frame->get_containing_block("w");
     $delta = $style->length_in_pt($dims, $cb_w);
     // Handle degenerate case
     if (!$this->_frame->get_first_child()) {
         return $this->_min_max_cache = array($delta, $delta, "min" => $delta, "max" => $delta);
     }
     $low = array();
     $high = array();
     for ($iter = $this->_frame->get_children()->getIterator(); $iter->valid(); $iter->next()) {
         $inline_min = 0;
         $inline_max = 0;
         // Add all adjacent inline widths together to calculate max width
         while ($iter->valid() && in_array($iter->current()->get_style()->display, Style::$INLINE_TYPES)) {
             $child = $iter->current();
             $minmax = $child->get_min_max_width();
             if (in_array($iter->current()->get_style()->white_space, array("pre", "nowrap"))) {
                 $inline_min += $minmax["min"];
             } else {
                 $low[] = $minmax["min"];
             }
             $inline_max += $minmax["max"];
             $iter->next();
         }
         if ($inline_max > 0) {
             $high[] = $inline_max;
         }
         if ($inline_min > 0) {
             $low[] = $inline_min;
         }
         if ($iter->valid()) {
             list($low[], $high[]) = $iter->current()->get_min_max_width();
             continue;
         }
     }
     $min = count($low) ? max($low) : 0;
     $max = count($high) ? max($high) : 0;
     // Use specified width if it is greater than the minimum defined by the
     // content.  If the width is a percentage ignore it for now.
     $width = $style->width;
     if ($width !== "auto" && !is_percent($width)) {
         $width = $style->length_in_pt($width, $cb_w);
         if ($min < $width) {
             $min = $width;
         }
         if ($max < $width) {
             $max = $width;
         }
     }
     $min += $delta;
     $max += $delta;
     return $this->_min_max_cache = array($min, $max, "min" => $min, "max" => $max);
 }
开发者ID:rifaiaja,项目名称:orpsystem,代码行数:60,代码来源:frame_reflower.cls.php

示例6: count

 function add_frame_to_line(Frame $frame)
 {
     if (!$frame->is_in_flow()) {
         return;
     }
     $style = $frame->get_style();
     $frame->set_containing_line($this->_line_boxes[$this->_cl]);
     if ($frame instanceof Inline_Frame_Decorator) {
         if ($frame->get_node()->nodeName === "br") {
             $this->maximize_line_height($style->length_in_pt($style->line_height), $frame);
             $this->add_line(true);
         }
         return;
     }
     if ($this->get_current_line_box()->w == 0 && $frame->is_text_node() && !$frame->is_pre()) {
         $frame->set_text(ltrim($frame->get_text()));
         $frame->recalculate_width();
     }
     $w = $frame->get_margin_width();
     if ($w == 0) {
         return;
     }
     $line = $this->_line_boxes[$this->_cl];
     if ($line->left + $line->w + $line->right + $w > $this->get_containing_block("w")) {
         $this->add_line();
     }
     $frame->position();
     $current_line = $this->_line_boxes[$this->_cl];
     $current_line->add_frame($frame);
     if ($frame->is_text_node()) {
         $current_line->wc += count(preg_split("/\\s+/", trim($frame->get_text())));
     }
     $this->increase_line_width($w);
     $this->maximize_line_height($frame->get_margin_height(), $frame);
 }
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:35,代码来源:block_frame_decorator.cls.php

示例7: render

 function render(Frame $frame)
 {
     $style = $frame->get_style();
     $bullet_style = $style->list_style_type;
     $bullet_size = List_Bullet_Frame_Decorator::BULLET_SIZE;
     $line_height = $style->length_in_pt($style->line_height, $frame->get_containing_block("w"));
     $fill = false;
     switch ($bullet_style) {
         default:
         case "disc":
             $fill = true;
         case "circle":
             if (!$fill) {
                 $fill = false;
             }
             list($x, $y) = $frame->get_position();
             $x += $bullet_size / 2;
             $y += $line_height / 2 + $bullet_size / 4;
             $r = $bullet_size / 4;
             $this->_canvas->circle($x, $y, $r, $style->color, null, null, $fill);
             break;
         case "square":
             list($x, $y) = $frame->get_position();
             $w = $bullet_size / 2;
             $x += $bullet_size / 2 - $w / 2;
             $y += $line_height / 2;
             $this->_canvas->filled_rectangle($x, $y, $w, $w, $style->color);
             break;
     }
 }
开发者ID:andrewroth,项目名称:c4c_intranet,代码行数:30,代码来源:list_bullet_renderer.cls.php

示例8: render

 function render(Frame $frame)
 {
     $style = $frame->get_style();
     list($x, $y) = $frame->get_position();
     $cb = $frame->get_containing_block();
     if (($ml = $style->margin_left) == "auto" || $ml == "none") {
         $ml = 0;
     }
     if (($pl = $style->padding_left) == "auto" || $pl == "none") {
         $pl = 0;
     }
     if (($bl = $style->border_left_width) == "auto" || $bl == "none") {
         $bl = 0;
     }
     $x += $style->length_in_pt(array($ml, $pl, $bl), $cb["w"]);
     $text = $frame->get_text();
     $font = $style->font_family;
     $size = $style->font_size;
     $height = $style->height;
     $spacing = $frame->get_text_spacing() + $style->word_spacing;
     if (preg_replace("/[\\s]+/", "", $text) == "") {
         return;
     }
     $this->_canvas->text($x, $y, $text, $font, $size, $style->color, $spacing);
     // Handle text decoration:
     // http://www.w3.org/TR/CSS21/text.html#propdef-text-decoration
     // Draw all applicable text-decorations.  Start with the root and work
     // our way down.
     $p = $frame;
     $stack = array();
     while ($p = $p->get_parent()) {
         $stack[] = $p;
     }
     while (count($stack) > 0) {
         $f = array_pop($stack);
         $deco_y = $y;
         if (($text_deco = $f->get_style()->text_decoration) === "none") {
             continue;
         }
         $color = $f->get_style()->color;
         switch ($text_deco) {
             default:
                 continue;
             case "underline":
                 $deco_y += $height * (1 + self::UNDERLINE_OFFSET);
                 break;
             case "overline":
                 $deco_y += $height * self::OVERLINE_OFFSET;
                 break;
             case "line-through":
                 $deco_y -= $height * (0.25 + self::LINETHROUGH_OFFSET);
                 break;
         }
         $dx = 0;
         $x1 = $x - self::DECO_EXTENSION;
         $x2 = $x + $style->width + $dx + self::DECO_EXTENSION;
         $this->_canvas->line($x1, $deco_y, $x2, $deco_y, $color, 0.5);
     }
 }
开发者ID:artre,项目名称:study,代码行数:59,代码来源:text_renderer.cls.php

示例9: render

 /**
  * Render frames recursively
  *
  * @param Frame $frame the frame to render
  */
 function render(Frame $frame)
 {
     global $_dompdf_debug;
     if ($_dompdf_debug) {
         echo $frame;
         flush();
     }
     $display = $frame->get_style()->display;
     switch ($display) {
         case "block":
         case "list-item":
         case "inline-block":
         case "table":
         case "table-row-group":
         case "table-header-group":
         case "table-footer-group":
         case "inline-table":
             $this->_render_frame("block", $frame);
             break;
         case "inline":
             if ($frame->get_node()->nodeName === "#text") {
                 $this->_render_frame("text", $frame);
             } else {
                 $this->_render_frame("inline", $frame);
             }
             break;
         case "table-cell":
             $this->_render_frame("table-cell", $frame);
             break;
         case "-dompdf-list-bullet":
             $this->_render_frame("list-bullet", $frame);
             break;
         case "-dompdf-image":
             $this->_render_frame("image", $frame);
             break;
         case "none":
             $node = $frame->get_node();
             if ($node->nodeName === "script") {
                 if ($node->getAttribute("type") === "text/php" || $node->getAttribute("language") === "php") {
                     // Evaluate embedded php scripts
                     $this->_render_frame("php", $frame);
                 } elseif ($node->getAttribute("type") === "text/javascript" || $node->getAttribute("language") === "javascript") {
                     // Insert JavaScript
                     $this->_render_frame("javascript", $frame);
                 }
             }
             // Don't render children, so skip to next iter
             return;
         default:
             break;
     }
     // Check for begin frame callback
     $this->_check_callbacks("begin_frame", $frame);
     foreach ($frame->get_children() as $child) {
         $this->render($child);
     }
     // Check for end frame callback
     $this->_check_callbacks("end_frame", $frame);
 }
开发者ID:NeCkEr,项目名称:CRUDGrid,代码行数:64,代码来源:renderer.cls.php

示例10: render

  function render(Frame $frame) {
    $style = $frame->get_style();
    $node = $frame->get_node();

    list($x, $y, $w, $h) = $frame->get_border_box();

    $this->_set_opacity( $frame->get_opacity( $style->opacity ) );

    if ( $node->nodeName === "body" ) {
      $h = $frame->get_containing_block("h") - $style->length_in_pt(array(
        $style->margin_top,
        $style->border_top_width,
        $style->border_bottom_width,
        $style->margin_bottom),
      $style->width);
    }

    // Handle anchors & links
    if ( $node->nodeName === "a" && $href = $node->getAttribute("href") ) {
      $this->_canvas->add_link($href, $x, $y, $w, $h);
    }

    // Draw our background, border and content
    list($tl, $tr, $br, $bl) = $style->get_computed_border_radius($w, $h);

    if ( $tl + $tr + $br + $bl > 0 ) {
      $this->_canvas->clipping_roundrectangle( $x, $y, $w, $h, $tl, $tr, $br, $bl );
    }

    if ( ($bg = $style->background_color) !== "transparent" ) {
      $this->_canvas->filled_rectangle( $x, $y, $w, $h, $bg );
    }

    if ( ($url = $style->background_image) && $url !== "none" ) {
      $this->_background_image($url, $x, $y, $w, $h, $style);
    }

    if ( $tl + $tr + $br + $bl > 0 ) {
      $this->_canvas->clipping_end();
    }

    $border_box = array($x, $y, $w, $h);
    $this->_render_border($frame, $border_box);
    $this->_render_outline($frame, $border_box);

    if (DEBUG_LAYOUT && DEBUG_LAYOUT_BLOCKS) {
      $this->_debug_layout($frame->get_border_box(), "red");
      if (DEBUG_LAYOUT_PADDINGBOX) {
        $this->_debug_layout($frame->get_padding_box(), "red", array(0.5, 0.5));
      }
    }

    if (DEBUG_LAYOUT && DEBUG_LAYOUT_LINES && $frame->get_decorator()) {
      foreach ($frame->get_decorator()->get_line_boxes() as $line) {
        $frame->_debug_layout(array($line->x, $line->y, $line->w, $line->h), "orange");
      }
    }
  }
开发者ID:hendrosteven,项目名称:f3-template,代码行数:58,代码来源:block_renderer.cls.php

示例11: list

 function __construct(Frame $frame, DOMPDF $dompdf)
 {
     $style = $frame->get_style();
     $url = $style->list_style_image;
     $frame->get_node()->setAttribute("src", $url);
     $this->_img = new Image_Frame_Decorator($frame, $dompdf);
     parent::__construct($this->_img, $dompdf);
     list($width, $height) = dompdf_getimagesize($this->_img->get_image_url());
     $this->_width = (double) rtrim($width, "px") * 72 / DOMPDF_DPI;
     $this->_height = (double) rtrim($height, "px") * 72 / DOMPDF_DPI;
 }
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:11,代码来源:list_bullet_image_frame_decorator.cls.php

示例12: list

 /**
  * Class constructor
  *
  * @param Frame $frame the bullet frame to decorate
  * @param DOMPDF $dompdf the document's dompdf object
  */
 function __construct(Frame $frame, DOMPDF $dompdf)
 {
     $url = $frame->get_style()->list_style_image;
     $frame->get_node()->setAttribute("src", $url);
     $this->_img = new Image_Frame_Decorator($frame, $dompdf);
     parent::__construct($this->_img, $dompdf);
     list($width, $height) = getimagesize($this->_img->get_image_url());
     // Resample the bullet image to be consistent with 'auto' sized images
     $this->_width = (double) rtrim($width, "px") * 72 / DOMPDF_DPI;
     $this->_height = (double) rtrim($height, "px") * 72 / DOMPDF_DPI;
 }
开发者ID:SkMamtajuddin,项目名称:bamboo-invoice,代码行数:17,代码来源:list_bullet_image_frame_decorator.cls.php

示例13: render

 function render(Frame $frame)
 {
     $style = $frame->get_style();
     list($x, $y, $w, $h) = $frame->get_padding_box();
     // Draw our background, border and content
     if (($bg = $style->background_color) !== "transparent") {
         $this->_canvas->filled_rectangle($x, $y, $w, $h, $style->background_color);
     }
     if (($url = $style->background_image) && $url !== "none") {
         $this->_background_image($url, $x, $y, $w, $h, $style);
     }
     $this->_render_border($frame);
 }
开发者ID:emeraldstudio,项目名称:somosmaestros,代码行数:13,代码来源:block_renderer.cls.php

示例14: render

 function render(Frame $frame)
 {
     // Render background & borders
     //parent::render($frame);
     $p = $frame->get_parent();
     $style = $frame->get_style();
     $cb = $frame->get_containing_block();
     list($x, $y) = $frame->get_padding_box();
     $x += $style->length_in_pt($style->padding_left, $cb["w"]);
     $y += $style->length_in_pt($style->padding_top, $cb["h"]);
     $w = $style->length_in_pt($style->width, $cb["w"]);
     $h = $style->length_in_pt($style->height, $cb["h"]);
     $this->_canvas->image($frame->get_image_url(), $frame->get_image_ext(), $x, $y, $w, $h);
 }
开发者ID:kuwox,项目名称:buenavista,代码行数:14,代码来源:image_renderer.cls.php

示例15: render

 function render(Frame $frame)
 {
     $style = $frame->get_style();
     $font_size = $style->get_font_size();
     $line_height = $style->length_in_pt($style->line_height, $frame->get_containing_block("w"));
     // Handle list-style-image
     // If list style image is requested but missing, fall back to predefined types
     if ($style->list_style_image !== "none" && strcmp($img = $frame->get_image_url(), DOMPDF_LIB_DIR . "/res/broken_image.png") != 0) {
         list($x, $y) = $frame->get_position();
         //For expected size and aspect, instead of box size, use image natural size scaled to DPI.
         // Resample the bullet image to be consistent with 'auto' sized images
         // See also Image_Frame_Reflower::get_min_max_width
         // Tested php ver: value measured in px, suffix "px" not in value: rtrim unnecessary.
         //$w = $frame->get_width();
         //$h = $frame->get_height();
         list($width, $height) = getimagesize($img);
         $w = (double) rtrim($width, "px") * 72 / DOMPDF_DPI;
         $h = (double) rtrim($height, "px") * 72 / DOMPDF_DPI;
         $x -= $w;
         $y -= ($line_height - $font_size) / 2;
         //Reverse hinting of list_bullet_positioner
         $this->_canvas->image($img, $frame->get_image_ext(), $x, $y, $w, $h);
     } else {
         $bullet_style = $style->list_style_type;
         $fill = false;
         switch ($bullet_style) {
             default:
             case "disc":
                 $fill = true;
             case "circle":
                 list($x, $y) = $frame->get_position();
                 $r = $font_size * List_Bullet_Frame_Decorator::BULLET_SIZE / 2;
                 $x -= $font_size * (List_Bullet_Frame_Decorator::BULLET_SIZE / 2);
                 $y += $font_size * (1 - List_Bullet_Frame_Decorator::BULLET_DESCENT) / 2;
                 $o = $font_size * List_Bullet_Frame_Decorator::BULLET_THICKNESS;
                 $this->_canvas->circle($x, $y, $r, $style->color, $o, null, $fill);
                 break;
             case "square":
                 list($x, $y) = $frame->get_position();
                 $w = $font_size * List_Bullet_Frame_Decorator::BULLET_SIZE;
                 $x -= $w;
                 $y += $font_size * (1 - List_Bullet_Frame_Decorator::BULLET_DESCENT - List_Bullet_Frame_Decorator::BULLET_SIZE) / 2;
                 $this->_canvas->filled_rectangle($x, $y, $w, $w, $style->color);
                 break;
             case "none":
                 break;
         }
     }
 }
开发者ID:kuwox,项目名称:buenavista,代码行数:49,代码来源:list_bullet_renderer.cls.php


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