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


PHP imagefilledpolygon函数代码示例

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


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

示例1: draw

 /**
  * draw point on map
  *
  * @param Map $map
  */
 public function draw(Map $map)
 {
     parent::draw($map);
     $point = $map->getPixelPointFromCoordinates($this->getLon(), $this->getLat());
     $vertices = array($point['x'], $point['y'], $point['x'] - 10, $point['y'] - 20, $point['x'] + 10, $point['y'] - 20);
     imagefilledpolygon($map->getImage(), $vertices, 3, imagecolorallocate($map->getImage(), 200, 0, 0));
 }
开发者ID:pafciu17,项目名称:gsoc-os-static-maps-api,代码行数:12,代码来源:MarkPoint.php

示例2: CreatePolygon

 function CreatePolygon($strconn, $schema, $table, $column, $srid, $largo, $ancho, $r, $g, $b, $trans, $zoom, $despX, $despY)
 {
     $conn = pg_connect($strconn) or die("Error de Conexion con la base de datos");
     $imagen = imagecreatetruecolor($largo, $ancho);
     $transparencia = imagecolorallocatealpha($imagen, 0, 0, 0, 127);
     imagefilltoborder($imagen, 50, 50, $transparencia, $transparencia);
     imagesavealpha($imagen, true);
     $color = imagecolorallocatealpha($imagen, $r, $g, $b, $trans);
     $query = "\n        SELECT gid, ((geometria.x - medidas.xinicial)/medidas.factor) x, ({$ancho} - ((geometria.y - medidas.yinicial)/medidas.factor)) y \n        FROM \n           (SELECT gid, st_x((ST_DumpPoints(geom)).geom) x, st_y((ST_DumpPoints(geom)).geom) y \n            FROM \n               (SELECT gid, tab.{$column} geom FROM {$schema}.\"{$table}\" tab\n                WHERE st_intersects(\n                        (SELECT st_setsrid(Box2D(st_buffer(p.centroide,((375336.1936-(375336.1936 * {$zoom} ))/2))), {$srid}) geom FROM \n                            (SELECT ST_GeomFROMText(st_astext(st_point( 470971.458311897-((470971.458311897 * {$despX} )/2) , 1072807.08034292-((470971.458311897 * {$despY} )/2) )), {$srid}) centroide) p\n                        ), tab.{$column})\n                ) s \n           ) geometria,\n           (SELECT min(st_xmin(geom)) xinicial, (max(st_xmax(geom))-min(st_xmin(geom)))/{$ancho} factor,min(st_ymin(geom)) yinicial \n            FROM \n               (SELECT st_setsrid(Box2D(st_buffer(p.centroide,((375336.1936-(375336.1936 * {$zoom} ))/2))), {$srid}) geom FROM \n                    (SELECT ST_GeomFROMText(st_astext(st_point( 470971.458311897-((470971.458311897 * {$despX} )/2) , 1072807.08034292-((470971.458311897 * {$despY} )/2) )), {$srid}) centroide) p\n               ) c \n           ) medidas";
     $result = pg_query($conn, $query) or die("Error al ejecutar la consulta");
     $gid = '';
     $pointPolygonArray = array();
     while ($row = pg_fetch_row($result)) {
         if ($gid == '') {
             $gid = $row[0];
             array_push($pointPolygonArray, $row[1], $row[2]);
         } else {
             if ($gid == $row[0]) {
                 array_push($pointPolygonArray, $row[1], $row[2]);
             } else {
                 imagefilledpolygon($imagen, $pointPolygonArray, count($pointPolygonArray) / 2, $color);
                 $pointPolygonArray = array();
                 $gid = $row[0];
                 array_push($pointPolygonArray, $row[1], $row[2]);
             }
         }
     }
     imagefilledpolygon($imagen, $pointPolygonArray, count($pointPolygonArray) / 2, $color);
     return $imagen;
 }
开发者ID:fauricioRojas,项目名称:MultiVisorMapas,代码行数:30,代码来源:graficos.php

示例3: getCodeColorImage

 /**
  * 获得彩色的验证码图片
  * @param array $paramArr 
  */
 public static function getCodeColorImage($paramArr)
 {
     $options = array('width' => 80, 'height' => 30, 'numCnt' => 4, 'inCode' => 'ABCD');
     if (is_array($paramArr)) {
         $options = array_merge($options, $paramArr);
     }
     extract($options);
     $img = imagecreate($width, $height);
     $bgcolor = self::getRandColor($img, 200);
     //背景色
     $fontCnt = 6;
     $numCnt = 4;
     $authCode = self::getAuthCode($inCode);
     for ($i = 0; $i < $numCnt; $i++) {
         $padding_left = rand(5, 10);
         $left = $padding_left + ($width - 10) * $i / $numCnt;
         //加入多边形色块干扰
         imagefilledpolygon($img, array(rand($left, $left + 20), rand(0, $height), rand($left, $left + 20), rand(0, $height), rand($left, $left + 20), rand(0, $height), rand($left, $left + 20), rand(0, $height), rand($left, $left + 20), rand(0, $height), rand($left, $left + 20), rand(0, $height), rand($left, $left + 20), rand(0, $height), rand($left, $left + 20), rand(0, $height), rand($left, $left + 20), rand(0, $height), rand($left, $left + 20), rand(0, $height)), 10, self::getRandColor($img, 180));
         $fontFile = SYSTEM_VAR . 'fonts/' . rand(1, $fontCnt) . '.ttf';
         imagettftext($img, rand(18, 24), rand(-30, 30), $left, rand(22, 26), self::getRandColor($img, 0, 120), $fontFile, $authCode[$i]);
     }
     //干扰像素,随机位置,随机颜色
     for ($i = 0; $i < 300; $i++) {
         $rand_x = rand(0, $width - 1);
         $rand_y = rand(0, $height - 1);
         imagesetpixel($img, $rand_x, $rand_y, self::getRandColor($img));
     }
     header("Content-type:image/png");
     imagepng($img);
     imagedestroy($img);
     exit;
 }
开发者ID:dalinhuang,项目名称:andyou,代码行数:36,代码来源:CheckCode.php

示例4: genterate_flag

function genterate_flag($hex)
{
    $r = hexdec(substr($hex, 0, 2));
    $g = hexdec(substr($hex, 2, 2));
    $b = hexdec(substr($hex, 4, 2));
    // create a true colour, transparent image
    // turn blending OFF and draw a background rectangle in our transparent colour
    $default_size = 30;
    $size = $_REQUEST["size"];
    if ($size == '') {
        $size = $default_size;
    }
    $iwidth = $size;
    $iheight = $size;
    $image = imagecreatetruecolor($iwidth, $iheight);
    //
    imagealphablending($image, false);
    $col = imagecolorallocatealpha($image, 255, 255, 255, 127);
    $newc = imagecolorallocate($image, $r, $g, $b);
    $black = imagecolorallocatealpha($image, 0, 0, 0, 50);
    imagefilledrectangle($image, 0, 0, $iwidth, $iheight, $col);
    //imagefilledrectangle($image,10,10,($iwidth -10) ,($iheight-10),$newc);
    $values = array(0, $size / 10, 0, $size / 2, $size / 2, $size, $size, $size / 2, $size / 2, 0, $size / 10, 0);
    imagefilledpolygon($image, $values, 6, $newc);
    //imagefilledellipse($image, $size / 5, $size / 5 , $size / 8 , $size / 8, $black);
    imagefilledellipse($image, $size / 5, $size / 5, $size / 6, $size / 6, $col);
    //imagefilledpolygon($image , $values , 4 , $col );
    // imagealphablending($image,true);
    // ^^ Alpha blanding is back on.
    // insert image manipulation stuff in here
    // output the results...
    imagealphablending($image, true);
    // imagesavealpha($image,true);
    return $image;
}
开发者ID:name256,项目名称:crm42,代码行数:35,代码来源:image.flag.php

示例5: add

 /**
  * Add method
  *
  * @return void Redirects on successful add, renders view otherwise.
  */
 public function add()
 {
     $mask = $this->Masks->newEntity();
     if ($this->request->is('post')) {
         $mask = $this->Masks->patchEntity($mask, $this->request->data);
         if ($this->Masks->save($mask)) {
             //draw thumbnail
             $virtualimage = imagecreate(100, 100);
             $fillcolor = imagecolorallocate($virtualimage, 0, 0, 0);
             $bg = imagecolorallocate($virtualimage, 239, 239, 239);
             imagefilledrectangle($virtualimage, 0, 0, 100, 100, $bg);
             $points = explode(",", $this->request->data['polygon']);
             foreach ($points as $key => $point) {
                 $points[$key] = (int) ((double) trim($point) * 100);
             }
             imagefilledpolygon($virtualimage, $points, count($points) / 2, $fillcolor);
             if (imagejpeg($virtualimage, WWW_ROOT . 'img' . DS . 'maskthumbs' . DS . $mask->id . '.jpg')) {
                 $this->Flash->success(__('The mask has been saved.'));
                 return $this->redirect(['action' => 'index']);
             } else {
                 $this->Flash->error(__('The mask thumbnail could not be created. Please, try again.'));
             }
         } else {
             $this->Flash->error(__('The mask could not be saved. Please, try again.'));
         }
     }
     $this->set(compact('mask'));
     $this->set('_serialize', ['mask']);
 }
开发者ID:bobombolo,项目名称:fotomucker,代码行数:34,代码来源:MasksController.php

示例6: draw_axises

function draw_axises($im_width, $im_height)
{
    global $im, $black, $l_grey, $x0, $y0, $maxX, $maxY, $minX, $minY, $red;
    global $string_x_start, $string_x_end, $string_y_start, $string_y_end;
    global $im, $black, $l_grey, $x0, $y0, $maxX, $maxY, $startX, $startY, $minX, $minY;
    $maxX = $im_width - 25.0;
    $maxY = $im_height - 20.0;
    $minY = $maxY - $minY - 20.0;
    imageline($im, 25.0, $minY + 20.0, $maxX, $minY + 20.0, $black);
    imageline($im, $minX + 25.0, 20.0, $minX + 25.0, $maxY, $black);
    $xArrow[0] = $maxX - 6;
    $xArrow[1] = $minY + 20 - 2;
    $xArrow[2] = $maxX;
    $xArrow[3] = $minY + 20;
    $xArrow[4] = $maxX - 6;
    $xArrow[5] = $minY + 20 + 2;
    imagefilledpolygon($im, $xArrow, 3, $black);
    $yArrow[0] = $minX + 25 - 2;
    $yArrow[1] = 20 + 6;
    $yArrow[2] = $minX + 25;
    $yArrow[3] = 20;
    $yArrow[4] = $minX + 25 + 2;
    $yArrow[5] = 20 + 6;
    imagefilledpolygon($im, $yArrow, 3, $black);
    imagestring($im, 2, 25.0, $minY + 20.0, $string_x_start, $black);
    imagestring($im, 2, $maxX, $minY + 20.0, $string_x_end, $black);
    imagestring($im, 2, $minX + 15.0, 20.0, $string_y_end, $black);
}
开发者ID:mpospelov,项目名称:fedoruk_php,代码行数:28,代码来源:grafic.php

示例7: draw_axises

function draw_axises($im_width, $im_heignt)
{
    global $im, $black, $l_grey, $x0, $y0, $maxX, $maxY, $minXVal, $minYVal;
    $x0 = 25.0;
    //начало оси координат по X
    $y0 = 20.0;
    //начало оси координат по Y
    $maxX = $im_width - $x0;
    //максимальное значение оси координат по X в пикселах
    $maxY = $im_heignt - $y0;
    //максимальное значение оси координат по Y в пикселах
    imageline($im, $x0, $maxY, $maxX + 5, $maxY, $black);
    //рисуем ось X
    imageline($im, $x0, $y0 - 5, $x0, $maxY, $black);
    //рисуем ось Y
    //рисуем стрелку на оси X
    $xArrow[0] = $maxX + 2;
    $xArrow[1] = $maxY - 2;
    $xArrow[2] = $maxX + 8;
    $xArrow[3] = $maxY;
    $xArrow[4] = $maxX + 2;
    $xArrow[5] = $maxY + 2;
    imagefilledpolygon($im, $xArrow, 3, $black);
    //рисуем стрелку на оси Y
    $yArrow[0] = $x0 - 2;
    $yArrow[1] = $y0 - 2;
    $yArrow[2] = $x0;
    $yArrow[3] = $y0 - 8;
    $yArrow[4] = $x0 + 2;
    $yArrow[5] = $y0 - 2;
    imagefilledpolygon($im, $yArrow, 3, $black);
}
开发者ID:Atiragram,项目名称:poit-labs,代码行数:32,代码来源:image-graph.php

示例8: _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

示例9: showImage

 /**
  * renders the current captcha image
  */
 function showImage()
 {
     $image = imagecreatetruecolor($this->width, $this->height);
     $width = imagesx($image);
     $height = imagesy($image);
     $black = imagecolorallocate($image, 0, 0, 0);
     $white = imagecolorallocate($image, 250, 250, 250);
     $red = imagecolorallocatealpha($image, 225, 225, 225, 75);
     $green = imagecolorallocatealpha($image, 150, 150, 150, 75);
     $blue = imagecolorallocatealpha($image, 200, 200, 200, 75);
     imagefilledrectangle($image, 0, 0, $width, $height, $white);
     imagefilledellipse($image, ceil(rand(5, 145)), ceil(rand(0, 35)), 30, 30, $red);
     $points = array(rand(0, 150), rand(0, 50), rand(0, 150), rand(0, 50), rand(0, 150), rand(0, 50), rand(0, 150), rand(0, 50), rand(0, 150), rand(0, 50), rand(0, 150), rand(0, 50));
     imagefilledpolygon($image, $points, 4, $blue);
     imagefilledpolygon($image, array_reverse($points), 6, $green);
     imagefilledrectangle($image, 0, 0, $width, 0, $black);
     imagefilledrectangle($image, $width - 1, 0, $width - 1, $height - 1, $black);
     imagefilledrectangle($image, 0, 0, 0, $height - 1, $black);
     imagefilledrectangle($image, 0, $height - 1, $width, $height - 1, $black);
     for ($i = 0; $i < 50; $i++) {
         //imagefilledrectangle($im, $i + $i2, 5, $i + $i3, 70, $black);
         imagesetthickness($image, rand(1, 5));
         imagearc($image, rand(1, 150), rand(1, 50), rand(1, 150), rand(1, 50), rand(1, 150), rand(1, 50), rand(0, 1) ? $green : $red);
     }
     if (function_exists("imagettftext")) {
         $font = DIR_ROOT . 'view/fonts/Duality.ttf';
         imagettftext($image, 24, rand(-5, 5), intval(($width - strlen($this->code) * 10) / 2), intval(($height + 10) / 2), $black, $font, $this->code);
     } else {
         imagestring($image, 5, intval(($width - strlen($this->code) * 9) / 2), intval(($height - 15) / 2), $this->code, $black);
     }
     header('Content-type: image/jpeg');
     imagejpeg($image);
     imagedestroy($image);
 }
开发者ID:phpsa,项目名称:CoreCMS,代码行数:37,代码来源:captcha.php

示例10: 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

示例11: diagonalCross

 public function diagonalCross($img, $width, $height, $backColour, $crossColour)
 {
     $smallest = min($width, $height);
     //Make the width of the lines 20% of the smallest
     $lineWidth = $smallest * 0.2;
     $halfLine = $lineWidth / 2;
     //Draw the polygons in the background colour instead of drawing the lines, as when the lines overlap, the opacity changes in the overlap space
     $topPolyPointX = $width / 2;
     $topPolyPointY = $height / 2 - $halfLine;
     $topPolyEndX = $width - $halfLine;
     $bottomPolyPointX = $width / 2;
     $bottomPolyPointY = $height / 2 + $halfLine;
     $bottomPolyEndX = $width - $halfLine;
     $leftPolyPointX = $width / 2 - $halfLine;
     $leftPolyPointY = $height / 2;
     $leftPolyEndY = $height - $halfLine;
     $rightPolyPointX = $width / 2 + $halfLine;
     $rightPolyPointY = $height / 2;
     $rightPolyEndY = $height - $halfLine;
     imagefilledrectangle($img, 0, 0, $width, $height, $crossColour);
     imagefilledpolygon($img, array($halfLine, 0, $topPolyPointX, $topPolyPointY, $topPolyEndX, 0), 3, $backColour);
     imagefilledpolygon($img, array($halfLine, $height, $bottomPolyPointX, $bottomPolyPointY, $bottomPolyEndX, $height), 3, $backColour);
     imagefilledpolygon($img, array(0, $halfLine, $leftPolyPointX, $leftPolyPointY, 0, $leftPolyEndY), 3, $backColour);
     imagefilledpolygon($img, array($width, $halfLine, $rightPolyPointX, $rightPolyPointY, $width, $rightPolyEndY), 3, $backColour);
     return $img;
 }
开发者ID:xcgpseud,项目名称:flag,代码行数:26,代码来源:FlagStyle.php

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

示例13: fill

 function fill($transform, $image, $color)
 {
     $coords = $this->getPointArray();
     $size = $this->getPointCount();
     for ($i = 0; $i < $size; $i++) {
         $transform->apply($coords[$i * 2], $coords[$i * 2 + 1]);
     }
     imagefilledpolygon($image, $coords, $size, $color);
 }
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:9,代码来源:path.php

示例14: renderFill

 protected function renderFill($image, array $params, $color)
 {
     if ($params['numpoints'] < 3) {
         return;
     }
     // somehow imagesetthickness() affects the polygon drawing. reset to 0.
     imagesetthickness($image, 0);
     imagefilledpolygon($image, $params['points'], $params['numpoints'], $color);
 }
开发者ID:JangoBrick,项目名称:php-svg,代码行数:9,代码来源:SVGPolygonRenderer.php

示例15: generate

 public function generate()
 {
     $color = $this->hex2dec($this->color);
     $im = imagecreate($this->size, $this->size);
     imagefill($im, 0, 0, imagecolorallocate($im, $this->bgColorRGB[0], $this->bgColorRGB[1], $this->bgColorRGB[2]));
     $color = imagecolorallocate($im, $color[0], $color[1], $color[2]);
     imagefilledpolygon($im, array($this->size / 2, 0, $this->size, $this->size / 2, $this->size / 2, $this->size, 0, $this->size / 2), 4, $color);
     $this->image = $im;
     $this->markerSize = $this->size / 1.01;
     return $im;
 }
开发者ID:gdbhosale,项目名称:fancy-qr-code-generator,代码行数:11,代码来源:QrTagDotSquare5.php


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