• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP fill_box函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中fill_box函数的典型用法代码示例。如果您正苦于以下问题:PHP fill_box函数的具体用法?PHP fill_box怎么用?PHP fill_box使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: sprintf

                if ($used > 0) {
                    // draw used
                    $angle_to = $used * 360 / $tsize;
                    $perc = sprintf("%.2f%%", $used * 100 / $tsize);
                    fill_arc($image, $x, $y, $size, $angle_from, $angle_from + $angle_to, $col_black, $col_red, '(' . $perc . ')');
                    $angle_from = $angle_from + $angle_to;
                }
            }
            break;
        case 2:
            // hit miss
            $hits = $memcacheStats['get_hits'] == 0 ? 1 : $memcacheStats['get_hits'];
            $misses = $memcacheStats['get_misses'] == 0 ? 1 : $memcacheStats['get_misses'];
            $total = $hits + $misses;
            fill_box($image, 30, $size, 50, -$hits * ($size - 21) / $total, $col_black, $col_green, sprintf("%.1f%%", $hits * 100 / $total));
            fill_box($image, 130, $size, 50, -max(4, ($total - $hits) * ($size - 21) / $total), $col_black, $col_red, sprintf("%.1f%%", $misses * 100 / $total));
            break;
    }
    header("Content-type: image/png");
    imagepng($image);
    exit;
}
echo getHeader();
echo getMenu();
switch ($_GET['op']) {
    case 1:
        // host stats
        $phpversion = phpversion();
        $memcacheStats = getMemcacheStats();
        $memcacheStatsSingle = getMemcacheStats(false);
        $mem_size = $memcacheStats['limit_maxbytes'];
开发者ID:hartum,项目名称:basezf,代码行数:31,代码来源:memcache.php


示例2: fill_box

                    $ptr = $block['offset'] + $block['size'];
                }
                if ($ptr < $mem['seg_size']) {
                    // memory at the end
                    $h = (GRAPH_SIZE - 5) * ($mem['seg_size'] - $ptr) / $s;
                    if ($h > 0) {
                        fill_box($image, $x, $y, 50, $h, $col_black, $col_red, bsize($mem['seg_size'] - $ptr), $j++);
                    }
                }
            }
            break;
        case 4:
            $s = $cache['num_hits'] + $cache['num_misses'];
            $a = $cache['num_hits'];
            fill_box($image, 30, $size, 50, -$a * ($size - 21) / $s, $col_black, $col_green, sprintf("%.1f%%", $cache['num_hits'] * 100 / $s));
            fill_box($image, 130, $size, 50, -max(4, ($s - $a) * ($size - 21) / $s), $col_black, $col_red, sprintf("%.1f%%", $cache['num_misses'] * 100 / $s));
            break;
    }
    header("Content-type: image/png");
    imagepng($image);
    exit;
}
// pretty printer for byte values
//
function bsize($s)
{
    foreach (array('', 'K', 'M', 'G') as $i => $k) {
        if ($s < 1024) {
            break;
        }
        $s /= 1024;
开发者ID:kaoruu,项目名称:centos-php56,代码行数:31,代码来源:apc.php


示例3: mkimageTask

 /**
  * Create graphics
  *
  * @return  void
  */
 public function mkimageTask()
 {
     if (!$this->graphics_avail()) {
         exit(0);
     }
     function block_sort($array1, $array2)
     {
         if ($array1['offset'] > $array2['offset']) {
             return 1;
         } else {
             return -1;
         }
     }
     function fill_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1, $color2, $text = '', $placeindex = 0)
     {
         $r = $diameter / 2;
         $w = deg2rad((360 + $start + ($end - $start) / 2) % 360);
         if (function_exists("imagefilledarc")) {
             // exists only if GD 2.0.1 is avaliable
             imagefilledarc($im, $centerX + 1, $centerY + 1, $diameter, $diameter, $start, $end, $color1, IMG_ARC_PIE);
             imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2, IMG_ARC_PIE);
             imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color1, IMG_ARC_NOFILL | IMG_ARC_EDGED);
         } else {
             imagearc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2);
             imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2);
             imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start + 1)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2);
             imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end - 1)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2);
             imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2);
             imagefill($im, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $color2);
         }
         if ($text) {
             if ($placeindex > 0) {
                 imageline($im, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $diameter, $placeindex * 12, $color1);
                 imagestring($im, 4, $diameter, $placeindex * 12, $text, $color1);
             } else {
                 imagestring($im, 4, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $text, $color1);
             }
         }
     }
     function text_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1, $text, $placeindex = 0)
     {
         $r = $diameter / 2;
         $w = deg2rad((360 + $start + ($end - $start) / 2) % 360);
         if ($placeindex > 0) {
             imageline($im, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $diameter, $placeindex * 12, $color1);
             imagestring($im, 4, $diameter, $placeindex * 12, $text, $color1);
         } else {
             imagestring($im, 4, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $text, $color1);
         }
     }
     function fill_box($im, $x, $y, $w, $h, $color1, $color2, $text = '', $placeindex = '')
     {
         global $col_black;
         $x1 = $x + $w - 1;
         $y1 = $y + $h - 1;
         imagerectangle($im, $x, $y1, $x1 + 1, $y + 1, $col_black);
         if ($y1 > $y) {
             imagefilledrectangle($im, $x, $y, $x1, $y1, $color2);
         } else {
             imagefilledrectangle($im, $x, $y1, $x1, $y, $color2);
         }
         imagerectangle($im, $x, $y1, $x1, $y, $color1);
         if ($text) {
             if ($placeindex > 0) {
                 if ($placeindex < 16) {
                     $px = 5;
                     $py = $placeindex * 12 + 6;
                     imagefilledrectangle($im, $px + 90, $py + 3, $px + 90 - 4, $py - 3, $color2);
                     imageline($im, $x, $y + $h / 2, $px + 90, $py, $color2);
                     imagestring($im, 2, $px, $py - 6, $text, $color1);
                 } else {
                     if ($placeindex < 31) {
                         $px = $x + 40 * 2;
                         $py = ($placeindex - 15) * 12 + 6;
                     } else {
                         $px = $x + 40 * 2 + 100 * intval(($placeindex - 15) / 15);
                         $py = $placeindex % 15 * 12 + 6;
                     }
                     imagefilledrectangle($im, $px, $py + 3, $px - 4, $py - 3, $color2);
                     imageline($im, $x + $w, $y + $h / 2, $px, $py, $color2);
                     imagestring($im, 2, $px + 2, $py - 6, $text, $color1);
                 }
             } else {
                 imagestring($im, 4, $x + 5, $y1 - 16, $text, $color1);
             }
         }
     }
     $MYREQUEST = $this->MYREQUEST;
     $mem = $this->mem;
     $cache = $this->cache;
     $size = GRAPH_SIZE;
     // image size
     if ($MYREQUEST['IMG'] == 3) {
         $image = imagecreate(2 * $size + 150, $size + 10);
     } else {
//.........这里部分代码省略.........
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:101,代码来源:apc.php


示例4: fill_box

                    fill_box($image, $y, $x, $h, 50, $col_black, $col_red);
                }
                $y += $h;
            }
            $h = ($size - 5) * $block['size'] / $s;
            if ($h > 0) {
                fill_box($image, $y, $x, $h, 50, $col_black, $col_green);
            }
            $y += $h;
            $ptr = $block['offset'] + $block['size'];
        }
        if ($ptr < $mem['seg_size']) {
            // memory at the end
            $h = ($size - 5) * ($mem['seg_size'] - $ptr) / $s;
            if ($h > 0) {
                fill_box($image, $y, $x, $h, 50, $col_black, $col_red, bsize($mem['seg_size'] - $ptr), $j++);
            }
        }
    }
    header("Content-type: image/png");
    imagepng($image);
    exit;
}
function graphics_avail()
{
    return extension_loaded('gd');
}
// pretty printer for byte values
//
function bsize($s)
{
开发者ID:asemen,项目名称:Froxlor,代码行数:31,代码来源:admin_apcuinfo.php


示例5: indexAction


//.........这里部分代码省略.........
                            }
                            $angle_to = $angle_from + $block['size'] / $s;
                            if ($angle_to + $fuzz > 1) {
                                $angle_to = 1;
                            }
                            if ($angle_to * 360 - $angle_from * 360 >= 1) {
                                fill_arc($image, $x, $y, $size, $angle_from * 360, $angle_to * 360, $col_black, $col_green);
                                if ($angle_to - $angle_from > 0.05) {
                                    array_push($string_placement, array($angle_from, $angle_to));
                                }
                            }
                            $angle_from = $angle_to;
                            $ptr = $block['offset'] + $block['size'];
                        }
                        if ($ptr < $mem['seg_size']) {
                            // memory at the end
                            $angle_to = $angle_from + ($mem['seg_size'] - $ptr) / $s;
                            if ($angle_to + $fuzz > 1) {
                                $angle_to = 1;
                            }
                            fill_arc($image, $x, $y, $size, $angle_from * 360, $angle_to * 360, $col_black, $col_red);
                            if ($angle_to - $angle_from > 0.05) {
                                array_push($string_placement, array($angle_from, $angle_to));
                            }
                        }
                    }
                    foreach ($string_placement as $angle) {
                        text_arc($image, $x, $y, $size, $angle[0] * 360, $angle[1] * 360, $col_black, bsize($s * ($angle[1] - $angle[0])));
                    }
                    break;
                case 2:
                    $s = $cache['num_hits'] + $cache['num_misses'];
                    $a = $cache['num_hits'];
                    fill_box($image, 30, $size, 50, -$a * ($size - 21) / $s, $col_black, $col_green, sprintf("%.1f%%", $cache['num_hits'] * 100 / $s));
                    fill_box($image, 130, $size, 50, -max(4, ($s - $a) * ($size - 21) / $s), $col_black, $col_red, sprintf("%.1f%%", $cache['num_misses'] * 100 / $s));
                    break;
                case 3:
                    $s = $mem['num_seg'] * $mem['seg_size'];
                    $a = $mem['avail_mem'];
                    $x = 130;
                    $y = 1;
                    $j = 1;
                    // This block of code creates the bar chart.  It is a lot more complex than you
                    // would expect because we try to visualize any memory fragmentation as well.
                    for ($i = 0; $i < $mem['num_seg']; $i++) {
                        $ptr = 0;
                        $free = $mem['block_lists'][$i];
                        foreach ($free as $block) {
                            if ($block['offset'] != $ptr) {
                                // Used block
                                $h = (GRAPH_SIZE - 5) * ($block['offset'] - $ptr) / $s;
                                if ($h > 0) {
                                    $j++;
                                    if ($j < 75) {
                                        fill_box($image, $x, $y, 50, $h, $col_black, $col_red, bsize($block['offset'] - $ptr), $j);
                                    } else {
                                        fill_box($image, $x, $y, 50, $h, $col_black, $col_red);
                                    }
                                }
                                $y += $h;
                            }
                            $h = (GRAPH_SIZE - 5) * $block['size'] / $s;
                            if ($h > 0) {
                                $j++;
                                if ($j < 75) {
                                    fill_box($image, $x, $y, 50, $h, $col_black, $col_green, bsize($block['size']), $j);
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:67,代码来源:ApcController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP filled_out函数代码示例发布时间:2022-05-15
下一篇:
PHP fill_arc函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap