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

PHP imagepolygon函数代码示例

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

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



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

示例1: leftPointer

 function leftPointer($image, $xpoint, $ypoint, $colour)
 {
     $black = imagecolorallocate($image, 0x0, 0x0, 0x0);
     $values = array($xpoint + 13, $ypoint - 1, $xpoint + 10, $ypoint - 1, $xpoint + 10, $ypoint - 5, $xpoint + 3, $ypoint + 2, $xpoint + 10, $ypoint + 9, $xpoint + 10, $ypoint + 5, $xpoint + 13, $ypoint + 5);
     imagefilledpolygon($image, $values, 7, $colour);
     imagepolygon($image, $values, 7, $black);
 }
开发者ID:RoneilZA,项目名称:dashboards,代码行数:7,代码来源:maxgraphdrawer.php


示例2: _drawLine

 private function _drawLine($image, $x1, $y1, $x2, $y2)
 {
     $thick = $this->_thickness->getThickness();
     $color = $this->_getDrawColor($image);
     if ($thick == 1) {
         return imageline($image, $x1, $y1, $x2, $y2, $color);
     }
     if ($this->hasTransparency() && $this->_transparency->getTransparency() != ParamTransparency::$minAlpha) {
         $t = $thick / 2 - 0.5;
         if ($x1 == $x2 || $y1 == $y2) {
             return imagefilledrectangle($image, round(min($x1, $x2) - $t), round(min($y1, $y2) - $t), round(max($x1, $x2) + $t), round(max($y1, $y2) + $t), $color);
         }
         $k = ($y2 - $y1) / ($x2 - $x1);
         //y = kx + q
         $a = $t / sqrt(1 + pow($k, 2));
         $points = array(round($x1 - (1 + $k) * $a), round($y1 + (1 - $k) * $a), round($x1 - (1 - $k) * $a), round($y1 - (1 + $k) * $a), round($x2 + (1 + $k) * $a), round($y2 - (1 - $k) * $a), round($x2 + (1 - $k) * $a), round($y2 + (1 + $k) * $a));
         imagefilledpolygon($image, $points, 4, $color);
         imagepolygon($image, $points, 4, $color);
     } else {
         imagesetthickness($image, $thick);
         imageline($image, $x1, $y1, $x2, $y2, $color);
         imagesetthickness($image, 1);
         imagefilledellipse($image, $x1, $y1, $thick, $thick, $color);
         imagefilledellipse($image, $x2, $y2, $thick, $thick, $color);
         imageellipse($image, $x1, $y1, $thick, $thick, $color);
         imageellipse($image, $x2, $y2, $thick, $thick, $color);
     }
 }
开发者ID:pafciu17,项目名称:gsoc-os-static-maps-api,代码行数:28,代码来源:Line.php


示例3: draw

 /**
  * Draws this object onto an image
  *
  * @param   img.Image image
  * @return  var
  */
 public function draw($image)
 {
     if ($this->fill) {
         return imagefilledpolygon($image->handle, $this->points, sizeof($this->points) / 2, $this->col->handle);
     } else {
         return imagepolygon($image->handle, $this->points, sizeof($this->points) / 2, $this->col->handle);
     }
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:14,代码来源:Polygon.class.php


示例4: drawPolygon

 /**
  * Draw polygon.
  * 
  * @param array $points An array containing the polygon's vertices.
  * @param null|array $options
  */
 public function drawPolygon(array $points, array $options = null)
 {
     $this->setOptions($options);
     $colorRgb = Utility::htmlToRgb($this->optionStrokeColor);
     $color = $this->allocateColor($this->Resource, $colorRgb['r'], $colorRgb['g'], $colorRgb['b']);
     imagesetthickness($this->Resource, $this->optionStrokeWidth);
     $numPoints = count($points) / 2;
     imagepolygon($this->Resource, $points, $numPoints, $color);
 }
开发者ID:kunjara,项目名称:jyotish-draw,代码行数:15,代码来源:Image.php


示例5: renderStroke

 protected function renderStroke($image, array $params, $color, $strokeWidth)
 {
     imagesetthickness($image, $strokeWidth);
     if ($params['open']) {
         $this->renderStrokeOpen($image, $params['points'], $color);
         return;
     }
     imagepolygon($image, $params['points'], $params['numpoints'], $color);
 }
开发者ID:JangoBrick,项目名称:php-svg,代码行数:9,代码来源:SVGPolygonRenderer.php


示例6: wmDrawMarkerPolygon

 /**
  * @param $gdImage
  * @param $colour
  * @param $point
  * @param $size
  * @param $relative_moves
  */
 public static function wmDrawMarkerPolygon($gdImage, $colour, $point, $size, $relative_moves)
 {
     $points = array();
     foreach ($relative_moves as $move) {
         $point->translate($move[0] * $size, $move[1] * $size);
         $points[] = $point->x;
         $points[] = $point->y;
     }
     imagepolygon($gdImage, $points, count($relative_moves), $colour);
 }
开发者ID:jiangxilong,项目名称:network-weathermap,代码行数:17,代码来源:WMImageUtility.php


示例7: draw_fill

function draw_fill($x1, $y1, $x2, $y2)
{
    global $im, $orange;
    $x1 = transform_x($x1);
    $x2 = transform_x($x2);
    $y1 = transform_y($y1);
    $y2 = transform_y($y2);
    imagepolygon($im, array($x1, $y1, $x2, $y2, $x2, transform_y(0), $x1, transform_y(0)), 4, $orange);
    imagefill($im, ($x1 + $x2) / 2, ($y1 + $y2 + 2 * transform_y(0)) / 4, $orange);
}
开发者ID:Hepic,项目名称:web-class,代码行数:10,代码来源:plot.php


示例8: applyToImage

 /**
  * Draw polygon on given image
  *
  * @param  Image   $image
  * @param  integer $x
  * @param  integer $y
  * @return boolean
  */
 public function applyToImage(Image $image, $x = 0, $y = 0)
 {
     $background = new Color($this->background);
     imagefilledpolygon($image->getCore(), $this->points, intval(count($this->points) / 2), $background->getInt());
     if ($this->hasBorder()) {
         $border_color = new Color($this->border_color);
         imagesetthickness($image->getCore(), $this->border_width);
         imagepolygon($image->getCore(), $this->points, intval(count($this->points) / 2), $border_color->getInt());
     }
     return true;
 }
开发者ID:hilmysyarif,项目名称:sic,代码行数:19,代码来源:PolygonShape.php


示例9: applyToResource

 /**
  * Draw polygon on given GD resource
  *
  * @param  resource $resource
  * @param  integer  $x
  * @param  interger $y
  * @return boolean
  */
 private function applyToResource($resource, $x, $y)
 {
     $background = new Color($this->background);
     imagefilledpolygon($resource, $this->points, intval(count($this->points) / 2), $background->getInt());
     if ($this->hasBorder()) {
         $border_color = new Color($this->border_color);
         imagesetthickness($resource, $this->border_width);
         imagepolygon($resource, $this->points, intval(count($this->points) / 2), $border_color->getInt());
     }
     return true;
 }
开发者ID:EdgarPost,项目名称:image,代码行数:19,代码来源:PolygonShape.php


示例10: setTitle

	function setTitle() {
		$title = $this->title ."";
		$this->drawText($title, 24, 0, 1.9, 32.2, "hitam", "trebuc.ttf");
		imagepolygon($this->gambar, array(
			0,0,
			0,898,
			598,898,
			598,0), 4, $this->getColor("hitam"));
		//tantos
		//$this->drawText("http://tantos.web.id/grafik_barber_johnson/", 10, 0, 5, 0.1, "hitam", "ariali.ttf");
	}
开发者ID:reekoheek,项目名称:srmis,代码行数:11,代码来源:bj.php


示例11: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(array $arguments)
 {
     $success = TRUE;
     if ($arguments['fill_color']) {
         $color = $this->allocateColorFromRgba($arguments['fill_color']);
         $success = imagefilledpolygon($this->getToolkit()->getResource(), $this->getRectangleCorners($arguments['rectangle']), 4, $color);
     }
     if ($success && $arguments['border_color']) {
         $color = $this->allocateColorFromRgba($arguments['border_color']);
         $success = imagepolygon($this->getToolkit()->getResource(), $this->getRectangleCorners($arguments['rectangle']), 4, $color);
     }
     return $success;
 }
开发者ID:andrewl,项目名称:andrewlnet,代码行数:16,代码来源:DrawRectangle.php


示例12: line

 function line($x1, $y1, $x2, $y2, $Color, $Thickness = 1)
 {
     if ($Thickness == 1) {
         return imageline($this->Image, $x1, $y1, $x2, $y2, $Color);
     }
     $t = $Thickness / 2 - 0.5;
     if ($x1 == $x2 || $y1 == $y2) {
         return imagefilledrectangle($this->Image, round(min($x1, $x2) - $t), round(min($y1, $y2) - $t), round(max($x1, $x2) + $t), round(max($y1, $y2) + $t), $color);
     }
     $k = ($y2 - $y1) / ($x2 - $x1);
     //y = kx + q
     $a = $t / sqrt(1 + pow($k, 2));
     $Points = array(round($x1 - (1 + $k) * $a), round($y1 + (1 - $k) * $a), round($x1 - (1 - $k) * $a), round($y1 - (1 + $k) * $a), round($x2 + (1 + $k) * $a), round($y2 - (1 - $k) * $a), round($x2 + (1 - $k) * $a), round($y2 + (1 + $k) * $a));
     imagefilledpolygon($this->Image, $Points, 4, $Color);
     return imagepolygon($this->Image, $Points, 4, $Color);
 }
开发者ID:Kufirc,项目名称:Gazelle,代码行数:16,代码来源:image.class.php


示例13: drawDataPoint

 function drawDataPoint($image, $x, $y)
 {
     if (DEBUG) {
         print "Drawing data point for {$image} at [{$x}, {$y}] in {$color}.\n";
     }
     $points = polygon_points(array('x' => $x, 'y' => $y), $this->vertices, $this->radius);
     //var_dump(count($points));
     if (DEBUG) {
         var_dump($points);
     }
     if (DEBUG) {
         var_dump($this->vertices);
     }
     imagefilledpolygon($image, $points, $this->vertices, $this->color[0]);
     if (!empty($this->color[1])) {
         imagepolygon($image, $points, $this->vertices, $this->color[1]);
     }
 }
开发者ID:xanthakita,项目名称:toque,代码行数:18,代码来源:StylePolyPoint.php


示例14: draw

 static function draw(&$image, $color, $param, $name = "line")
 {
     switch ($name) {
         case 'point':
             //像素点
             return imagesetpixel($image, $param[0], $param[1], $color);
         case 'arc':
             //弧(中心点/宽度-高度/起始角度-结束角度(0-360))
             return imagearc($image, $param[0], $param[1], $param[2], $param[3], $param[4], $param[5], $color);
         case 'polygon':
             //多边形$param:各顶点坐标(一维数组),顶点数
             return imagepolygon($image, $param, count($param) / 2, $color);
         default:
             //线(起点/终点)、椭圆(中心点/宽度-高度)、矩形(左顶点/右底点)
             $draw = 'image' . $name;
             //line,ellipse,rectangle
             return $draw($image, $param[0], $param[1], $param[2], $param[3], $color);
     }
 }
开发者ID:mjiong,项目名称:framework,代码行数:19,代码来源:image.php


示例15: draw

 static function draw(&$image, $color, $param, $name = "line")
 {
     //像素点
     if ($name == 'point') {
         return imagesetpixel($image, $param[0], $param[1], $color);
     }
     //线(起点/终点)、椭圆(中心点/宽度-高度)、矩形(左顶点/右底点)
     if ($name == 'line' || $name == 'ellipse' || $name == 'rectangle') {
         $draw = 'image' . $name;
         return $draw($image, $param[0], $param[1], $param[2], $param[3], $color);
     }
     //弧(中心点/宽度-高度/起始角度-结束角度(0-360))
     if ($name == 'arc') {
         return imagearc($image, $param[0], $param[1], $param[2], $param[3], $param[4], $param[5], $color);
     }
     //多边形$param:各顶点坐标(一维数组),顶点数
     if ($name == 'polygon') {
         return imagepolygon($image, $param, count($param) / 2, $color);
     }
 }
开发者ID:art-youth,项目名称:framework,代码行数:20,代码来源:img.php


示例16: imagelinethick

 function imagelinethick($image, $x1, $y1, $x2, $y2, $color, $thick = 1)
 {
     /* this way it works well only for orthogonal lines
     			imagesetthickness($image, $thick);
     			return imageline($image, $x1, $y1, $x2, $y2, $color);
     			*/
     if ($thick == 1) {
         return imageline($image, $x1, $y1, $x2, $y2, $color);
     }
     $t = $thick / 2 - 0.5;
     if ($x1 == $x2 || $y1 == $y2) {
         return imagefilledrectangle($image, round(min($x1, $x2) - $t), round(min($y1, $y2) - $t), round(max($x1, $x2) + $t), round(max($y1, $y2) + $t), $color);
     }
     $k = ($y2 - $y1) / ($x2 - $x1);
     //y = kx + q
     $a = $t / sqrt(1 + pow($k, 2));
     $points = array(round($x1 - (1 + $k) * $a), round($y1 + (1 - $k) * $a), round($x1 - (1 - $k) * $a), round($y1 - (1 + $k) * $a), round($x2 + (1 + $k) * $a), round($y2 - (1 - $k) * $a), round($x2 + (1 - $k) * $a), round($y2 + (1 + $k) * $a));
     imagefilledpolygon($image, $points, 4, $color);
     return imagepolygon($image, $points, 4, $color);
 }
开发者ID:DookTibs,项目名称:games,代码行数:20,代码来源:hex.php


示例17: imagelinethick

 public static function imagelinethick($image, $x1, $y1, $x2, $y2, $color, $thick = 1)
 {
     /* 下面两行只在线段直角相交时好使
        imagesetthickness($image, $thick);
        return imageline($image, $x1, $y1, $x2, $y2, $color);
        */
     if ($thick == 1) {
         return imageline($image, $x1, $y1, $x2, $y2, $color);
     }
     $t = $thick / 2 - 0.5;
     if ($x1 == $x2 || $y1 == $y2) {
         return imagefilledrectangle($image, round(min($x1, $x2) - $t), round(min($y1, $y2) - $t), round(max($x1, $x2) + $t), round(max($y1, $y2) + $t), $color);
     }
     $k = ($y2 - $y1) / ($x2 - $x1);
     //y = kx + q
     $a = $t / sqrt(1 + pow($k, 2));
     $points = array(round($x1 - (1 + $k) * $a), round($y1 + (1 - $k) * $a), round($x1 - (1 - $k) * $a), round($y1 - (1 + $k) * $a), round($x2 + (1 + $k) * $a), round($y2 - (1 - $k) * $a), round($x2 + (1 - $k) * $a), round($y2 + (1 + $k) * $a));
     imagefilledpolygon($image, $points, 4, $color);
     return imagepolygon($image, $points, 4, $color);
 }
开发者ID:xiaomingplus,项目名称:scuinfoText2pic,代码行数:20,代码来源:Common.php


示例18: imagelinethick

function imagelinethick($image, $x1, $y1, $x2, $y2, $color, $thick = 1)
{
    /* de cette manière, ca ne marche bien que pour les lignes orthogonales
       imagesetthickness($image, $thick);
       return imageline($image, $x1, $y1, $x2, $y2, $color);
       */
    if ($thick == 1) {
        return imageline($image, $x1, $y1, $x2, $y2, $color);
    }
    $t = $thick / 2 - 0.5;
    if ($x1 == $x2 || $y1 == $y2) {
        return imagefilledrectangle($image, round(min($x1, $x2) - $t), round(min($y1, $y2) - $t), round(max($x1, $x2) + $t), round(max($y1, $y2) + $t), $color);
    }
    $k = ($y2 - $y1) / ($x2 - $x1);
    //y = kx + q
    $a = $t / sqrt(1 + pow($k, 2));
    $points = array(round($x1 - (1 + $k) * $a), round($y1 + (1 - $k) * $a), round($x1 - (1 - $k) * $a), round($y1 - (1 + $k) * $a), round($x2 + (1 + $k) * $a), round($y2 - (1 - $k) * $a), round($x2 + (1 - $k) * $a), round($y2 + (1 + $k) * $a));
    imagefilledpolygon($image, $points, 4, $color);
    return imagepolygon($image, $points, 4, $color);
}
开发者ID:athimel,项目名称:zoryazilla-php,代码行数:20,代码来源:carte_trajet.php


示例19: draw

 public function draw($image)
 {
     if (function_exists('imageantialias')) {
         imageantialias($image->getCore(), true);
     }
     $points = $this->points();
     $count = count($this->points);
     // Create filled polygon
     if (null !== $this->fillColor) {
         list($r, $g, $b, $alpha) = $this->getFillColor()->getRgba();
         $fillColorResource = imagecolorallocatealpha($image->getCore(), $r, $g, $b, Editor::gdAlpha($alpha));
         imagefilledpolygon($image->getCore(), $points, $count, $fillColorResource);
     }
     // Create polygon borders. It will be placed on top of the filled polygon (if present)
     if (0 < $this->getBorderSize() and null !== $this->borderColor) {
         // With border > 0 AND borderColor !== null
         list($r, $g, $b, $alpha) = $this->getBorderColor()->getRgba();
         $borderColorResource = imagecolorallocatealpha($image->getCore(), $r, $g, $b, Editor::gdAlpha($alpha));
         imagepolygon($image->getCore(), $points, $count, $borderColorResource);
     }
     return $image;
 }
开发者ID:kosinix,项目名称:grafika,代码行数:22,代码来源:Polygon.php


示例20: render

 public function render($pDatas)
 {
     $im = @imagecreatetruecolor(300, 300);
     imageantialias($im, true);
     imagefilledrectangle($im, 0, 0, 300, 300, imagecolorallocate($im, 255, 255, 255));
     //Affichage Camenbert
     foreach ($pDatas as $data) {
         if ($data->value == 0) {
             continue;
         }
         $color = imagecolorallocate($im, 255, 0, 0);
         $polygon = iterator_to_array(new \RecursiveIteratorIterator(new \RecursiveArrayIterator($data->polygons)), false);
         imagefilledpolygon($im, $polygon, count($polygon) / 2, $color);
         $black = imagecolorallocate($im, 0, 0, 0);
         imagepolygon($im, $polygon, count($polygon) / 2, $black);
         imagestring($im, '3', $data->center['x'], $data->center['y'], $data->value, $black);
     }
     ob_start();
     imagepng($im);
     $toReturn = ob_get_clean();
     imagedestroy($im);
     return $toReturn;
 }
开发者ID:Juliens,项目名称:JuliensCharts,代码行数:23,代码来源:index.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP imagerectangle函数代码示例发布时间:2022-05-15
下一篇:
PHP imageloadfont函数代码示例发布时间: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