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


PHP imagepolygon函数代码示例

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


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


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