| [ PHPXref.com ] | [ Generated: Sun Jul 20 17:19:34 2008 ] | [ dompdf 0.5 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * DOMPDF - PHP5 HTML to PDF renderer 4 * 5 * File: $RCSfile: block_renderer.cls.php,v $ 6 * Created on: 2004-06-03 7 * 8 * Copyright (c) 2004 - Benj Carson <benjcarson@digitaljunkies.ca> 9 * 10 * This library is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU Lesser General Public 12 * License as published by the Free Software Foundation; either 13 * version 2.1 of the License, or (at your option) any later version. 14 * 15 * This library is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * Lesser General Public License for more details. 19 * 20 * You should have received a copy of the GNU Lesser General Public License 21 * along with this library in the file LICENSE.LGPL; if not, write to the 22 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 23 * 02111-1307 USA 24 * 25 * Alternatively, you may distribute this software under the terms of the 26 * PHP License, version 3.0 or later. A copy of this license should have 27 * been distributed with this file in the file LICENSE.PHP . If this is not 28 * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. 29 * 30 * The latest version of DOMPDF might be available at: 31 * http://www.digitaljunkies.ca/dompdf 32 * 33 * @link http://www.digitaljunkies.ca/dompdf 34 * @copyright 2004 Benj Carson 35 * @author Benj Carson <benjcarson@digitaljunkies.ca> 36 * @package dompdf 37 * @version 0.3 38 */ 39 40 /* $Id: block_renderer.cls.php,v 1.2 2006/04/06 19:30:46 benjcarson Exp $ */ 41 42 /** 43 * Renders block frames 44 * 45 * @access private 46 * @package dompdf 47 */ 48 class Block_Renderer extends Abstract_Renderer { 49 50 //........................................................................ 51 52 function render(Frame $frame) { 53 $style = $frame->get_style(); 54 list($x, $y, $w, $h) = $frame->get_padding_box(); 55 56 // Draw our background, border and content 57 if ( ($bg = $style->background_color) !== "transparent" ) { 58 $this->_canvas->filled_rectangle( $x, $y, $w, $h, $style->background_color ); 59 } 60 61 if ( ($url = $style->background_image) && $url !== "none" ) { 62 list($bg_x, $bg_y) = $style->background_position; 63 $repeat = $style->background_repeat; 64 65 if ( !is_percent($bg_x) ) 66 $bg_x = $style->length_in_pt($bg_x); 67 if ( !is_percent($bg_y) ) 68 $bg_y = $style->length_in_pt($bg_y); 69 70 $this->_background_image($url, $x, $y, $w, $h, $repeat, array($bg_x,$bg_y), $style->background_color); 71 } 72 73 $this->_render_border($frame); 74 75 } 76 77 protected function _render_border(Frame_Decorator $frame, $corner_style = "bevel") { 78 $cb = $frame->get_containing_block(); 79 $style = $frame->get_style(); 80 81 $bbox = $frame->get_border_box(); 82 $bp = $frame->get_style()->get_border_properties(); 83 84 $widths = array($style->length_in_pt($bp["top"]["width"]), 85 $style->length_in_pt($bp["right"]["width"]), 86 $style->length_in_pt($bp["bottom"]["width"]), 87 $style->length_in_pt($bp["left"]["width"])); 88 89 foreach ($bp as $side => $props) { 90 list($x, $y, $w, $h) = $bbox; 91 92 if ( !$props["style"] || $props["style"] == "none" || $props["width"] <= 0 ) 93 continue; 94 95 96 switch($side) { 97 case "top": 98 $length = $w; 99 break; 100 101 case "bottom": 102 $length = $w; 103 $y += $h; 104 break; 105 106 case "left": 107 $length = $h; 108 break; 109 110 case "right": 111 $length = $h; 112 $x += $w; 113 break; 114 default: 115 break; 116 } 117 $method = "_border_" . $props["style"]; 118 119 $this->$method($x, $y, $length, $props["color"], $widths, $side, $corner_style); 120 } 121 } 122 } 123 124 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |