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


PHP Frame::get_opacity方法代码示例

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


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

示例4: render

 function render(Frame $frame)
 {
     $style = $frame->get_style();
     $this->_set_opacity($frame->get_opacity($style->opacity));
     $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:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:18,代码来源:table_row_group_renderer.cls.php

示例5: render

 function render(Frame $frame)
 {
     // Render background & borders
     $style = $frame->get_style();
     $cb = $frame->get_containing_block();
     list($x, $y, $w, $h) = $frame->get_border_box();
     $this->_set_opacity($frame->get_opacity($style->opacity));
     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);
     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"]);
     $src = $frame->get_image_url();
     if (Image_Cache::is_broken($src) && ($alt = $frame->get_node()->getAttribute("alt"))) {
         $font = $style->font_family;
         $size = $style->font_size;
         $spacing = $style->word_spacing;
         $this->_canvas->text($x, $y, $alt, $font, $size, $style->color, $spacing);
     } else {
         $this->_canvas->image($src, $x, $y, $w, $h, $style->image_resolution);
     }
     if ($msg = $frame->get_image_msg()) {
         $parts = preg_split("/\\s*\n\\s*/", $msg);
         $height = 10;
         $_y = $alt ? $y + $h - count($parts) * $height : $y;
         foreach ($parts as $i => $_part) {
             $this->_canvas->text($x, $_y + $i * $height, $_part, "times", $height * 0.8, array(0.5, 0.5, 0.5));
         }
     }
     if (DEBUG_LAYOUT && DEBUG_LAYOUT_BLOCKS) {
         $this->_debug_layout($frame->get_border_box(), "blue");
         if (DEBUG_LAYOUT_PADDINGBOX) {
             $this->_debug_layout($frame->get_padding_box(), "blue", array(0.5, 0.5));
         }
     }
 }
开发者ID:DaveNascimento,项目名称:civicrm-packages,代码行数:44,代码来源:image_renderer.cls.php

示例6: render

 function render(Frame $frame)
 {
     // Render background & borders
     $style = $frame->get_style();
     $cb = $frame->get_containing_block();
     list($x, $y, $w, $h) = $frame->get_border_box();
     $this->_set_opacity($frame->get_opacity($style->opacity));
     // Handle the last child
     if (($bg = $style->background_color) !== "transparent") {
         $this->_canvas->filled_rectangle($x + $widths[3], $y + $widths[0], $w, $h, $bg);
     }
     if (($url = $style->background_image) && $url !== "none") {
         $this->_background_image($url, $x + $widths[3], $y + $widths[0], $w, $h, $style);
     }
     $this->_render_border($frame);
     $this->_render_outline($frame);
     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"]);
     if (strrpos($frame->get_image_url(), DOMPDF_LIB_DIR . "/res/broken_image.png", 0) !== false && ($alt = $frame->get_node()->getAttribute("alt"))) {
         $font = $style->font_family;
         $size = $style->font_size;
         $spacing = $style->word_spacing;
         $this->_canvas->text($x, $y, $alt, $font, $size, $style->color, $spacing);
     } else {
         $this->_canvas->image($frame->get_image_url(), $frame->get_image_ext(), $x, $y, $w, $h);
     }
     if (DEBUG_LAYOUT && DEBUG_LAYOUT_BLOCKS) {
         $this->_debug_layout($frame->get_border_box(), "blue");
         if (DEBUG_LAYOUT_PADDINGBOX) {
             $this->_debug_layout($frame->get_padding_box(), "blue", array(0.5, 0.5));
         }
     }
 }
开发者ID:eyumay,项目名称:srms.psco,代码行数:36,代码来源:image_renderer.cls.php

示例7: render

 function render(Frame $frame)
 {
     $style = $frame->get_style();
     if (trim($frame->get_node()->nodeValue) === "" && $style->empty_cells === "hide") {
         return;
     }
     $this->_set_opacity($frame->get_opacity($style->opacity));
     list($x, $y, $w, $h) = $frame->get_border_box();
     // 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);
     }
     $table = Table_Frame_Decorator::find_parent_table($frame);
     if ($table->get_style()->border_collapse !== "collapse") {
         $this->_render_border($frame);
         $this->_render_outline($frame);
         return;
     }
     // The collapsed case is slightly complicated...
     // @todo Add support for outlines here
     $cellmap = $table->get_cellmap();
     $cells = $cellmap->get_spanned_cells($frame);
     $num_rows = $cellmap->get_num_rows();
     $num_cols = $cellmap->get_num_cols();
     // Determine the top row spanned by this cell
     $i = $cells["rows"][0];
     $top_row = $cellmap->get_row($i);
     // Determine if this cell borders on the bottom of the table.  If so,
     // then we draw its bottom border.  Otherwise the next row down will
     // draw its top border instead.
     if (in_array($num_rows - 1, $cells["rows"])) {
         $draw_bottom = true;
         $bottom_row = $cellmap->get_row($num_rows - 1);
     } else {
         $draw_bottom = false;
     }
     // Draw the horizontal borders
     foreach ($cells["columns"] as $j) {
         $bp = $cellmap->get_border_properties($i, $j);
         $y = $top_row["y"] - $bp["top"]["width"] / 2;
         $col = $cellmap->get_column($j);
         $x = $col["x"] - $bp["left"]["width"] / 2;
         $w = $col["used-width"] + ($bp["left"]["width"] + $bp["right"]["width"]) / 2;
         if ($bp["top"]["style"] !== "none" && $bp["top"]["width"] > 0) {
             $widths = array($bp["top"]["width"], $bp["right"]["width"], $bp["bottom"]["width"], $bp["left"]["width"]);
             $method = "_border_" . $bp["top"]["style"];
             $this->{$method}($x, $y, $w, $bp["top"]["color"], $widths, "top", "square");
         }
         if ($draw_bottom) {
             $bp = $cellmap->get_border_properties($num_rows - 1, $j);
             if ($bp["bottom"]["style"] === "none" || $bp["bottom"]["width"] <= 0) {
                 continue;
             }
             $y = $bottom_row["y"] + $bottom_row["height"] + $bp["bottom"]["width"] / 2;
             $widths = array($bp["top"]["width"], $bp["right"]["width"], $bp["bottom"]["width"], $bp["left"]["width"]);
             $method = "_border_" . $bp["bottom"]["style"];
             $this->{$method}($x, $y, $w, $bp["bottom"]["color"], $widths, "bottom", "square");
         }
     }
     $j = $cells["columns"][0];
     $left_col = $cellmap->get_column($j);
     if (in_array($num_cols - 1, $cells["columns"])) {
         $draw_right = true;
         $right_col = $cellmap->get_column($num_cols - 1);
     } else {
         $draw_right = false;
     }
     // Draw the vertical borders
     foreach ($cells["rows"] as $i) {
         $bp = $cellmap->get_border_properties($i, $j);
         $x = $left_col["x"] - $bp["left"]["width"] / 2;
         $row = $cellmap->get_row($i);
         $y = $row["y"] - $bp["top"]["width"] / 2;
         $h = $row["height"] + ($bp["top"]["width"] + $bp["bottom"]["width"]) / 2;
         if ($bp["left"]["style"] !== "none" && $bp["left"]["width"] > 0) {
             $widths = array($bp["top"]["width"], $bp["right"]["width"], $bp["bottom"]["width"], $bp["left"]["width"]);
             $method = "_border_" . $bp["left"]["style"];
             $this->{$method}($x, $y, $h, $bp["left"]["color"], $widths, "left", "square");
         }
         if ($draw_right) {
             $bp = $cellmap->get_border_properties($i, $num_cols - 1);
             if ($bp["right"]["style"] === "none" || $bp["right"]["width"] <= 0) {
                 continue;
             }
             $x = $right_col["x"] + $right_col["used-width"] + $bp["right"]["width"] / 2;
             $widths = array($bp["top"]["width"], $bp["right"]["width"], $bp["bottom"]["width"], $bp["left"]["width"]);
             $method = "_border_" . $bp["right"]["style"];
             $this->{$method}($x, $y, $h, $bp["right"]["color"], $widths, "right", "square");
         }
     }
 }
开发者ID:skyosev,项目名称:OpenCart-Overclocked,代码行数:94,代码来源:table_cell_renderer.cls.php

示例8: render

 function render(Frame $frame)
 {
     $style = $frame->get_style();
     if (!$frame->get_first_child()) {
         return;
     }
     // No children, no service
     // Draw the left border if applicable
     $bp = $style->get_border_properties();
     $widths = array($style->length_in_pt($bp["top"]["width"]), $style->length_in_pt($bp["right"]["width"]), $style->length_in_pt($bp["bottom"]["width"]), $style->length_in_pt($bp["left"]["width"]));
     // Draw the background & border behind each child.  To do this we need
     // to figure out just how much space each child takes:
     list($x, $y) = $frame->get_first_child()->get_position();
     $w = null;
     $h = 0;
     //     $x += $widths[3];
     //     $y += $widths[0];
     $this->_set_opacity($frame->get_opacity($style->opacity));
     $first_row = true;
     foreach ($frame->get_children() as $child) {
         list($child_x, $child_y, $child_w, $child_h) = $child->get_padding_box();
         if (!is_null($w) && $child_x < $x + $w) {
             //This branch seems to be supposed to being called on the first part
             //of an inline html element, and the part after the if clause for the
             //parts after a line break.
             //But because $w initially mostly is 0, and gets updated only on the next
             //round, this seem to be never executed and the common close always.
             // The next child is on another line.  Draw the background &
             // borders on this line.
             // Background:
             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 this is the first row, draw the left border
             if ($first_row) {
                 if ($bp["left"]["style"] !== "none" && $bp["left"]["color"] !== "transparent" && $bp["left"]["width"] > 0) {
                     $method = "_border_" . $bp["left"]["style"];
                     $this->{$method}($x, $y, $h + $widths[0] + $widths[2], $bp["left"]["color"], $widths, "left");
                 }
                 $first_row = false;
             }
             // Draw the top & bottom borders
             if ($bp["top"]["style"] !== "none" && $bp["top"]["color"] !== "transparent" && $bp["top"]["width"] > 0) {
                 $method = "_border_" . $bp["top"]["style"];
                 $this->{$method}($x, $y, $w + $widths[1] + $widths[3], $bp["top"]["color"], $widths, "top");
             }
             if ($bp["bottom"]["style"] !== "none" && $bp["bottom"]["color"] !== "transparent" && $bp["bottom"]["width"] > 0) {
                 $method = "_border_" . $bp["bottom"]["style"];
                 $this->{$method}($x, $y + $h + $widths[0] + $widths[2], $w + $widths[1] + $widths[3], $bp["bottom"]["color"], $widths, "bottom");
             }
             // Handle anchors & links
             $link_node = null;
             if ($frame->get_node()->nodeName === "a") {
                 $link_node = $frame->get_node();
             } else {
                 if ($frame->get_parent()->get_node()->nodeName === "a") {
                     $link_node = $frame->get_parent()->get_node();
                 }
             }
             if ($link_node && ($href = $link_node->getAttribute("href"))) {
                 $this->_canvas->add_link($href, $x, $y, $w, $h);
             }
             $x = $child_x;
             $y = $child_y;
             $w = $child_w;
             $h = $child_h;
             continue;
         }
         if (is_null($w)) {
             $w = $child_w;
         } else {
             $w += $child_w;
         }
         $h = max($h, $child_h);
         if (DEBUG_LAYOUT && DEBUG_LAYOUT_INLINE) {
             $this->_debug_layout($child->get_border_box(), "blue");
             if (DEBUG_LAYOUT_PADDINGBOX) {
                 $this->_debug_layout($child->get_padding_box(), "blue", array(0.5, 0.5));
             }
         }
     }
     // Handle the last child
     if (($bg = $style->background_color) !== "transparent") {
         $this->_canvas->filled_rectangle($x + $widths[3], $y + $widths[0], $w, $h, $bg);
     }
     //On continuation lines (after line break) of inline elements, the style got copied.
     //But a non repeatable background image should not be repeated on the next line.
     //But removing the background image above has never an effect, and removing it below
     //removes it always, even on the initial line.
     //Need to handle it elsewhere, e.g. on certain ...clone()... usages.
     // Repeat not given: default is Style::__construct
     // ... && (!($repeat = $style->background_repeat) || $repeat === "repeat" ...
     //different position? $this->_background_image($url, $x, $y, $w, $h, $style);
     if (($url = $style->background_image) && $url !== "none") {
         $this->_background_image($url, $x + $widths[3], $y + $widths[0], $w, $h, $style);
     }
     // Add the border widths
//.........这里部分代码省略.........
开发者ID:darshanmodi2010,项目名称:dompdf,代码行数:101,代码来源:inline_renderer.cls.php

示例9: 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"));
     $this->_set_opacity($frame->get_opacity($style->opacity));
     // 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) = dompdf_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 "decimal-leading-zero":
             case "decimal":
             case "lower-alpha":
             case "lower-latin":
             case "lower-roman":
             case "lower-greek":
             case "upper-alpha":
             case "upper-latin":
             case "upper-roman":
             case "1":
                 // HTML 4.0 compatibility
             // HTML 4.0 compatibility
             case "a":
             case "i":
             case "A":
             case "I":
                 list($x, $y) = $frame->get_position();
                 $pad = null;
                 if ($bullet_style === "decimal-leading-zero") {
                     $pad = strlen($frame->get_parent()->get_parent()->get_node()->getAttribute("dompdf-children-count"));
                 }
                 $index = $frame->get_node()->getAttribute("dompdf-counter");
                 $text = $this->make_counter($index, $bullet_style, $pad);
                 $font_family = $style->font_family;
                 $spacing = 0;
                 //$frame->get_text_spacing() + $style->word_spacing;
                 if (trim($text) == "") {
                     return;
                 }
                 $x -= Font_Metrics::get_text_width($text, $font_family, $font_size, $spacing);
                 $this->_canvas->text($x, $y, $text, $font_family, $font_size, $style->color, $spacing);
             case "none":
                 break;
         }
     }
 }
开发者ID:rapsody,项目名称:HeartwebApp,代码行数:81,代码来源:list_bullet_renderer.cls.php

示例10: render

  function render(Frame $frame) {
    // Render background & borders
    $style = $frame->get_style();
    $cb = $frame->get_containing_block();
    list($x, $y, $w, $h) = $frame->get_border_box();

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

    list($tl, $tr, $br, $bl) = $style->get_computed_border_radius($w, $h);

    $has_border_radius = $tl + $tr + $br + $bl > 0;

    if ( $has_border_radius ) {
      $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 ( $has_border_radius ) {
      $this->_canvas->clipping_end();
    }

    $this->_render_border($frame);
    $this->_render_outline($frame);

    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"]);

    if ( $has_border_radius ) {
      list($wt, $wr, $wb, $wl) = array(
        $style->border_top_width,
        $style->border_right_width,
        $style->border_bottom_width,
        $style->border_left_width,
      );

      // we have to get the "inner" radius
      if ( $tl > 0 ) {
        $tl -= ($wt + $wl) / 2;
      }
      if ( $tr > 0 ) {
        $tr -= ($wt + $wr) / 2;
      }
      if ( $br > 0 ) {
        $br -= ($wb + $wr) / 2;
      }
      if ( $bl > 0 ) {
        $bl -= ($wb + $wl) / 2;
      }

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

    $src = $frame->get_image_url();
    $alt = null;

    if ( Image_Cache::is_broken($src) &&
      $alt = $frame->get_node()->getAttribute("alt") ) {
      $font = $style->font_family;
      $size = $style->font_size;
      $spacing = $style->word_spacing;
      $this->_canvas->text($x, $y, $alt,
                           $font, $size,
                           $style->color, $spacing);
    }
    else {
      $this->_canvas->image( $src, $x, $y, $w, $h, $style->image_resolution);
    }

    if ( $has_border_radius ) {
      $this->_canvas->clipping_end();
    }

    if ( $msg = $frame->get_image_msg() ) {
      $parts = preg_split("/\s*\n\s*/", $msg);
      $height = 10;
      $_y = $alt ? $y+$h-count($parts)*$height : $y;

      foreach($parts as $i => $_part) {
        $this->_canvas->text($x, $_y + $i*$height, $_part, "times", $height*0.8, array(0.5, 0.5, 0.5));
      }
    }

    if (DEBUG_LAYOUT && DEBUG_LAYOUT_BLOCKS) {
      $this->_debug_layout($frame->get_border_box(), "blue");
      if (DEBUG_LAYOUT_PADDINGBOX) {
        $this->_debug_layout($frame->get_padding_box(), "blue", array(0.5, 0.5));
      }
    }
//.........这里部分代码省略.........
开发者ID:hendrosteven,项目名称:f3-template,代码行数:101,代码来源:image_renderer.cls.php

示例11: render

 function render(Frame $frame)
 {
     $style = $frame->get_style();
     if (!$frame->get_first_child()) {
         return;
     }
     $bp = $style->get_border_properties();
     $widths = array($style->length_in_pt($bp["top"]["width"]), $style->length_in_pt($bp["right"]["width"]), $style->length_in_pt($bp["bottom"]["width"]), $style->length_in_pt($bp["left"]["width"]));
     list($x, $y) = $frame->get_first_child()->get_position();
     $w = null;
     $h = 0;
     $this->_set_opacity($frame->get_opacity($style->opacity));
     $first_row = true;
     foreach ($frame->get_children() as $child) {
         list($child_x, $child_y, $child_w, $child_h) = $child->get_padding_box();
         if (!is_null($w) && $child_x < $x + $w) {
             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 ($first_row) {
                 if ($bp["left"]["style"] !== "none" && $bp["left"]["color"] !== "transparent" && $bp["left"]["width"] > 0) {
                     $method = "_border_" . $bp["left"]["style"];
                     $this->{$method}($x, $y, $h + $widths[0] + $widths[2], $bp["left"]["color"], $widths, "left");
                 }
                 $first_row = false;
             }
             if ($bp["top"]["style"] !== "none" && $bp["top"]["color"] !== "transparent" && $bp["top"]["width"] > 0) {
                 $method = "_border_" . $bp["top"]["style"];
                 $this->{$method}($x, $y, $w + $widths[1] + $widths[3], $bp["top"]["color"], $widths, "top");
             }
             if ($bp["bottom"]["style"] !== "none" && $bp["bottom"]["color"] !== "transparent" && $bp["bottom"]["width"] > 0) {
                 $method = "_border_" . $bp["bottom"]["style"];
                 $this->{$method}($x, $y + $h + $widths[0] + $widths[2], $w + $widths[1] + $widths[3], $bp["bottom"]["color"], $widths, "bottom");
             }
             $link_node = null;
             if ($frame->get_node()->nodeName === "a") {
                 $link_node = $frame->get_node();
             } else {
                 if ($frame->get_parent()->get_node()->nodeName === "a") {
                     $link_node = $frame->get_parent()->get_node();
                 }
             }
             if ($link_node && ($href = $link_node->getAttribute("href"))) {
                 $this->_canvas->add_link($href, $x, $y, $w, $h);
             }
             $x = $child_x;
             $y = $child_y;
             $w = $child_w;
             $h = $child_h;
             continue;
         }
         if (is_null($w)) {
             $w = $child_w;
         } else {
             $w += $child_w;
         }
         $h = max($h, $child_h);
     }
     if (($bg = $style->background_color) !== "transparent") {
         $this->_canvas->filled_rectangle($x + $widths[3], $y + $widths[0], $w, $h, $bg);
     }
     if (($url = $style->background_image) && $url !== "none") {
         $this->_background_image($url, $x + $widths[3], $y + $widths[0], $w, $h, $style);
     }
     $w += $widths[1] + $widths[3];
     $h += $widths[0] + $widths[2];
     $left_margin = $style->length_in_pt($style->margin_left);
     $x += $left_margin;
     if ($first_row && $bp["left"]["style"] !== "none" && $bp["left"]["color"] !== "transparent" && $widths[3] > 0) {
         $method = "_border_" . $bp["left"]["style"];
         $this->{$method}($x, $y, $h, $bp["left"]["color"], $widths, "left");
     }
     if ($bp["top"]["style"] !== "none" && $bp["top"]["color"] !== "transparent" && $widths[0] > 0) {
         $method = "_border_" . $bp["top"]["style"];
         $this->{$method}($x, $y, $w, $bp["top"]["color"], $widths, "top");
     }
     if ($bp["bottom"]["style"] !== "none" && $bp["bottom"]["color"] !== "transparent" && $widths[2] > 0) {
         $method = "_border_" . $bp["bottom"]["style"];
         $this->{$method}($x, $y + $h, $w, $bp["bottom"]["color"], $widths, "bottom");
     }
     if ($bp["right"]["style"] !== "none" && $bp["right"]["color"] !== "transparent" && $widths[1] > 0) {
         $method = "_border_" . $bp["right"]["style"];
         $this->{$method}($x + $w, $y, $h, $bp["right"]["color"], $widths, "right");
     }
     $link_node = null;
     if ($frame->get_node()->nodeName === "a") {
         $link_node = $frame->get_node();
         if (($name = $link_node->getAttribute("name")) || ($name = $link_node->getAttribute("id"))) {
             $this->_canvas->add_named_dest($name);
         }
     }
     if ($frame->get_parent() && $frame->get_parent()->get_node()->nodeName === "a") {
         $link_node = $frame->get_parent()->get_node();
     }
     if ($link_node) {
         if ($href = $link_node->getAttribute("href")) {
             $this->_canvas->add_link($href, $x, $y, $w, $h);
//.........这里部分代码省略.........
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:101,代码来源:inline_renderer.cls.php

示例12: 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"));

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

    $li = $frame->get_parent();

    // Don't render bullets twice if if was split
    if ($li->_splitted) {
      return;
    }

    // Handle list-style-image
    // If list style image is requested but missing, fall back to predefined types
    if ( $style->list_style_image !== "none" &&
         !Image_Cache::is_broken($img = $frame->get_image_url())) {

      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) = dompdf_getimagesize($img);
      $dpi = $this->_dompdf->get_option("dpi");
      $w = ((float)rtrim($width, "px") * 72) / $dpi;
      $h = ((float)rtrim($height, "px") * 72) / $dpi;

      $x -= $w;
      $y -= ($line_height - $font_size)/2; //Reverse hinting of list_bullet_positioner

      $this->_canvas->image( $img, $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 /*-List_Bullet_Frame_Decorator::BULLET_THICKNESS*/ ))/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 "decimal-leading-zero":
      case "decimal":
      case "lower-alpha":
      case "lower-latin":
      case "lower-roman":
      case "lower-greek":
      case "upper-alpha":
      case "upper-latin":
      case "upper-roman":
      case "1": // HTML 4.0 compatibility
      case "a":
      case "i":
      case "A":
      case "I":
        $pad = null;
        if ( $bullet_style === "decimal-leading-zero" ) {
          $pad = strlen($li->get_parent()->get_node()->getAttribute("dompdf-children-count"));
        }

        $node = $frame->get_node();

        if ( !$node->hasAttribute("dompdf-counter") ) {
          return;
        }

        $index = $node->getAttribute("dompdf-counter");
        $text = $this->make_counter($index, $bullet_style, $pad);

        if ( trim($text) == "" ) {
          return;
        }

        $spacing = 0;
        $font_family = $style->font_family;
//.........这里部分代码省略.........
开发者ID:hendrosteven,项目名称:f3-template,代码行数:101,代码来源:list_bullet_renderer.cls.php

示例13: 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"));
     $this->_set_opacity($frame->get_opacity($style->opacity));
     if ($style->list_style_image !== "none" && !Image_Cache::is_broken($img = $frame->get_image_url())) {
         list($x, $y) = $frame->get_position();
         list($width, $height) = dompdf_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;
         $this->_canvas->image($img, $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 "decimal-leading-zero":
             case "decimal":
             case "lower-alpha":
             case "lower-latin":
             case "lower-roman":
             case "lower-greek":
             case "upper-alpha":
             case "upper-latin":
             case "upper-roman":
             case "1":
             case "a":
             case "i":
             case "A":
             case "I":
                 $li = $frame->get_parent();
                 $pad = null;
                 if ($bullet_style === "decimal-leading-zero") {
                     $pad = strlen($li->get_parent()->get_node()->getAttribute("dompdf-children-count"));
                 }
                 $index = $frame->get_node()->getAttribute("dompdf-counter");
                 $text = $this->make_counter($index, $bullet_style, $pad);
                 if (trim($text) == "") {
                     return;
                 }
                 $spacing = 0;
                 $font_family = $style->font_family;
                 $line = $li->get_containing_line();
                 list($x, $y) = array($frame->get_position("x"), $line->y);
                 $x -= Font_Metrics::get_text_width($text, $font_family, $font_size, $spacing);
                 $line_height = $style->line_height;
                 $y += ($line_height - $font_size) / 4;
                 $this->_canvas->text($x, $y, $text, $font_family, $font_size, $style->color, $spacing);
             case "none":
                 break;
         }
     }
 }
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:73,代码来源:list_bullet_renderer.cls.php


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