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

PHP imageLine函数代码示例

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

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



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

示例1: drawRhythm

	function drawRhythm($daysAlive, $period, $color)
	{
	    global $daysToShow, $image, $diagramWidth, $diagramHeight;

	    // get day on which to center
	    $centerDay = $daysAlive - ($daysToShow / 2);

	    // calculate diagram parameters
	    $plotScale = ($diagramHeight - 25) / 2;
	    $plotCenter = ($diagramHeight - 25) / 2;

	    // draw the curve
	    for($x = 0; $x <= $daysToShow; $x++)
	    {
		// calculate phase of curve at this day, then Y value
		// within diagram
		$phase = (($centerDay + $x) % $period) / $period * 2 * pi();
		$y = 1 - sin($phase) * (float)$plotScale + (float)$plotCenter;

		// draw line from last point to current point
		if($x > 0)
		    imageLine($image, $oldX, $oldY,
			      $x * $diagramWidth / $daysToShow, $y, $color);

		// save current X/Y coordinates as start point for next line
		$oldX = $x * $diagramWidth / $daysToShow;
		$oldY = $y;
	    }

	}
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:30,代码来源:biorhythm.php


示例2: imagesmoothcircle

/**
 * Credits goes to an anonymous at http://usphp.com/manual/ro/function.imageantialias.php
 */
function imagesmoothcircle(&$img, $cx, $cy, $cr, $color)
{
    $ir = $cr;
    $ix = 0;
    $iy = $ir;
    $ig = 2 * $ir - 3;
    $idgr = -6;
    $idgd = 4 * $ir - 10;
    $fill = imageColorExactAlpha($img, $color['R'], $color['G'], $color['B'], 0);
    imageLine($img, $cx + $cr - 1, $cy, $cx, $cy, $fill);
    imageLine($img, $cx - $cr + 1, $cy, $cx - 1, $cy, $fill);
    imageLine($img, $cx, $cy + $cr - 1, $cx, $cy + 1, $fill);
    imageLine($img, $cx, $cy - $cr + 1, $cx, $cy - 1, $fill);
    $draw = imageColorExactAlpha($img, $color['R'], $color['G'], $color['B'], 42);
    imageSetPixel($img, $cx + $cr, $cy, $draw);
    imageSetPixel($img, $cx - $cr, $cy, $draw);
    imageSetPixel($img, $cx, $cy + $cr, $draw);
    imageSetPixel($img, $cx, $cy - $cr, $draw);
    while ($ix <= $iy - 2) {
        if ($ig < 0) {
            $ig += $idgd;
            $idgd -= 8;
            $iy--;
        } else {
            $ig += $idgr;
            $idgd -= 4;
        }
        $idgr -= 4;
        $ix++;
        imageLine($img, $cx + $ix, $cy + $iy - 1, $cx + $ix, $cy + $ix, $fill);
        imageLine($img, $cx + $ix, $cy - $iy + 1, $cx + $ix, $cy - $ix, $fill);
        imageLine($img, $cx - $ix, $cy + $iy - 1, $cx - $ix, $cy + $ix, $fill);
        imageLine($img, $cx - $ix, $cy - $iy + 1, $cx - $ix, $cy - $ix, $fill);
        imageLine($img, $cx + $iy - 1, $cy + $ix, $cx + $ix, $cy + $ix, $fill);
        imageLine($img, $cx + $iy - 1, $cy - $ix, $cx + $ix, $cy - $ix, $fill);
        imageLine($img, $cx - $iy + 1, $cy + $ix, $cx - $ix, $cy + $ix, $fill);
        imageLine($img, $cx - $iy + 1, $cy - $ix, $cx - $ix, $cy - $ix, $fill);
        $filled = 0;
        for ($xx = $ix - 0.45; $xx < $ix + 0.5; $xx += 0.2) {
            for ($yy = $iy - 0.45; $yy < $iy + 0.5; $yy += 0.2) {
                if (sqrt(pow($xx, 2) + pow($yy, 2)) < $cr) {
                    $filled += 4;
                }
            }
        }
        $draw = imageColorExactAlpha($img, $color['R'], $color['G'], $color['B'], 100 - $filled);
        imageSetPixel($img, $cx + $ix, $cy + $iy, $draw);
        imageSetPixel($img, $cx + $ix, $cy - $iy, $draw);
        imageSetPixel($img, $cx - $ix, $cy + $iy, $draw);
        imageSetPixel($img, $cx - $ix, $cy - $iy, $draw);
        imageSetPixel($img, $cx + $iy, $cy + $ix, $draw);
        imageSetPixel($img, $cx + $iy, $cy - $ix, $draw);
        imageSetPixel($img, $cx - $iy, $cy + $ix, $draw);
        imageSetPixel($img, $cx - $iy, $cy - $ix, $draw);
    }
}
开发者ID:bishopm,项目名称:circuit,代码行数:59,代码来源:gdext.inc.php


示例3: drawFunction

 function drawFunction($function, $dx = 0.1)
 {
     $xold = $x = $this->x0;
     eval("\$yold=" . $function . ";");
     for ($x += $dx; $x <= $this->x1; $x += $dx) {
         eval("\$y = " . $function . ";");
         imageLine($this->img, $this->posX0 + $xold * $this->scale, $this->posY0 - $yold * $this->scale, $this->posX0 + $x * $this->scale, $this->posY0 - $y * $this->scale, $this->grn);
         $xold = $x;
         $yold = $y;
     }
 }
开发者ID:BackupTheBerlios,项目名称:nedi-svn,代码行数:11,代码来源:graph.php


示例4: imageSmoothArcDrawSegment

function imageSmoothArcDrawSegment(&$img, $cx, $cy, $a, $b, $color, $start, $stop, $seg)
{
    // Originally written from scratch by Ulrich Mierendorff, 06/2006
    // Rewritten and improved, 04/2007, 07/2007
    // Optimized circle version: 03/2008
    // Please do not use THIS function directly. Scroll down to imageSmoothArc(...).
    $fillColor = imageColorExactAlpha($img, $color[0], $color[1], $color[2], $color[3]);
    switch ($seg) {
        case 0:
            $xp = +1;
            $yp = -1;
            $xa = 1;
            $ya = -1;
            break;
        case 1:
            $xp = -1;
            $yp = -1;
            $xa = 0;
            $ya = -1;
            break;
        case 2:
            $xp = -1;
            $yp = +1;
            $xa = 0;
            $ya = 0;
            break;
        case 3:
            $xp = +1;
            $yp = +1;
            $xa = 1;
            $ya = 0;
            break;
    }
    for ($x = 0; $x <= $a; $x += 1) {
        $y = $b * sqrt(1 - $x * $x / ($a * $a));
        $error = $y - (int) $y;
        $y = (int) $y;
        $diffColor = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127 - (127 - $color[3]) * $error);
        imageSetPixel($img, $cx + $xp * $x + $xa, $cy + $yp * ($y + 1) + $ya, $diffColor);
        imageLine($img, $cx + $xp * $x + $xa, $cy + $yp * $y + $ya, $cx + $xp * $x + $xa, $cy + $ya, $fillColor);
    }
    for ($y = 0; $y < $b; $y += 1) {
        $x = $a * sqrt(1 - $y * $y / ($b * $b));
        $error = $x - (int) $x;
        $x = (int) $x;
        $diffColor = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127 - (127 - $color[3]) * $error);
        imageSetPixel($img, $cx + $xp * ($x + 1) + $xa, $cy + $yp * $y + $ya, $diffColor);
    }
}
开发者ID:rainbow-studio,项目名称:cmsms,代码行数:49,代码来源:imageSmoothArc_optimized.php


示例5: getPNG

 public function getPNG()
 {
     // создаем картинку
     $image = imageCreate($this->width + $this->widthLegend, $this->height);
     $backColor = imageColorAllocate($image, $this->colorBG >> 16, ($this->colorBG >> 8) % 256, $this->colorBG % 256);
     $centerColor = imageColorAllocate($image, $this->colorCenter >> 16, ($this->colorCenter >> 8) % 256, $this->colorCenter % 256);
     $pointsColor = imageColorAllocate($image, $this->colorPoints >> 16, ($this->colorPoints >> 8) % 256, $this->colorPoints % 256);
     $legendColor = imageColorAllocate($image, $this->colorLegend >> 16, ($this->colorLegend >> 8) % 256, $this->colorLegend % 256);
     // background
     imageFilledRectangle($image, 0, 0, $this->width, $this->height, $backColor);
     imageRectangle($image, $this->width, 0, $this->widthLegend + $this->width - 1, $this->height - 1, $legendColor);
     // добавляем масштаб в легенду
     imageLine($image, $this->width + 10, $this->height - $this->fontSize * 2 - 1, $this->width + 10, $this->height - $this->fontSize * 2 + 1, $legendColor);
     imageLine($image, $this->width + 10, $this->height - $this->fontSize * 2, $this->width + 20, $this->height - $this->fontSize * 2, $legendColor);
     imageLine($image, $this->width + 20, $this->height - $this->fontSize * 2 - 1, $this->width + 20, $this->height - $this->fontSize * 2 + 1, $legendColor);
     imageTTFText($image, $this->fontSize, 0, $this->width + $this->fontSize + 20, $this->height - $this->fontSize * 1.5, $legendColor, $this->pathToFont, "{$this->metersIn10Pix} {$this->metersLabel}");
     // center
     imageFilledEllipse($image, $this->centerWidth, $this->centerHeight, $this->sizePoints, $this->sizePoints, $centerColor);
     imageTTFText($image, $this->fontSize, 0, $this->centerWidth, $this->centerHeight + $this->fontSize + $this->sizePoints, $centerColor, $this->pathToFont, "0");
     imageTTFText($image, $this->fontSize, 0, $this->width + $this->fontSize, $this->fontSize * 2, $legendColor, $this->pathToFont, "0 - {$this->centerLabel}");
     // points
     $i = 1;
     foreach ($this->pointsBased as $v) {
         $angle = $v->getPoint()->getAzimuth() - 90;
         // угол для тригонометрии
         $pointWidth = $this->centerWidth + $this->k * ($v->getPoint()->getDistance() * cos(deg2rad($angle)));
         $pointHeight = $this->centerHeight + $this->k * ($v->getPoint()->getDistance() * sin(deg2rad($angle)));
         // рисуем точку
         imageEllipse($image, $pointWidth, $pointHeight, $this->sizePoints, $this->sizePoints, $pointsColor);
         // подпись
         imageTTFText($image, $this->fontSize, 0, $pointWidth, $pointHeight + $this->fontSize + $this->sizePoints, $pointsColor, $this->pathToFont, $i);
         // в легенду
         imageTTFText($image, $this->fontSize, 0, $this->width + $this->fontSize, $this->fontSize * 2 * ($i + 1), $legendColor, $this->pathToFont, "{$i} - " . $v->getTitle());
         $i++;
     }
     ob_start();
     imagePng($image);
     $str = ob_get_clean();
     return $str;
 }
开发者ID:arsenyru,项目名称:geodata,代码行数:40,代码来源:Visual.php


示例6: imageSmoothArcDrawSegment


//.........这里部分代码省略.........
                    $ya = 0;
                } else {
                    $xp = -1;
                    $yp = +1;
                    $xa = 0;
                    $ya = +1;
                }
                if ($stop < ($i + 1) * (M_PI / 2) && $x <= $xStop) {
                    $diffColor1 = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127 - (127 - $color[3]) * $error1);
                    $y1 = $_y1;
                    if ($aaStopX) {
                        imageSetPixel($img, $cx + $xp * $x + $xa, $cy + $yp * ($y1 + 1) + $ya, $diffColor1);
                    }
                } else {
                    $y = $b * sqrt(1 - $x * $x / ($a * $a));
                    $error = $y - (int) $y;
                    $y = (int) $y;
                    $diffColor = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127 - (127 - $color[3]) * $error);
                    $y1 = $y;
                    if ($x < $aaAngleX) {
                        imageSetPixel($img, $cx + $xp * $x + $xa, $cy + $yp * ($y1 + 1) + $ya, $diffColor);
                    }
                }
                if ($start > $i * M_PI / 2 && $x <= $xStart) {
                    $diffColor2 = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127 - (127 - $color[3]) * $error2);
                    $y2 = $_y2;
                    if ($aaStartX) {
                        imageSetPixel($img, $cx + $xp * $x + $xa, $cy + $yp * ($y2 - 1) + $ya, $diffColor2);
                    }
                } else {
                    $y2 = 0;
                }
                if ($y2 <= $y1) {
                    imageLine($img, $cx + $xp * $x + $xa, $cy + $yp * $y1 + $ya, $cx + $xp * $x + $xa, $cy + $yp * $y2 + $ya, $fillColor);
                }
            }
        }
        if ($seg == 1 || $seg == 3) {
            $i = $seg;
            if (!($stop < ($i + 1) * M_PI / 2 && $x > $xStop)) {
                if ($i == 1) {
                    $xp = -1;
                    $yp = -1;
                    $xa = 0;
                    $ya = 0;
                } else {
                    $xp = +1;
                    $yp = +1;
                    $xa = 1;
                    $ya = 1;
                }
                if ($start > $i * M_PI / 2 && $x < $xStart) {
                    $diffColor2 = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127 - (127 - $color[3]) * $error2);
                    $y1 = $_y2;
                    if ($aaStartX) {
                        imageSetPixel($img, $cx + $xp * $x + $xa, $cy + $yp * ($y1 + 1) + $ya, $diffColor2);
                    }
                } else {
                    $y = $b * sqrt(1 - $x * $x / ($a * $a));
                    $error = $y - (int) $y;
                    $y = (int) $y;
                    $diffColor = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127 - (127 - $color[3]) * $error);
                    $y1 = $y;
                    if ($x < $aaAngleX) {
                        imageSetPixel($img, $cx + $xp * $x + $xa, $cy + $yp * ($y1 + 1) + $ya, $diffColor);
                    }
开发者ID:gdbhosale,项目名称:fancy-qr-code-generator,代码行数:67,代码来源:imageSmoothArc.php


示例7: drawRoundedRectangle

 /**
  * Draws a rectangle with rounded corners on the image
  * @param Point $leftTop Point of the upper left corner
  * @param Dimension $dimension Dimension of the rectangle
  * @param integer $cornerSize The number of pixels which should be round of
  * @param Color $color
  * @param integer $width
  * @return null
  */
 public function drawRoundedRectangle(Point $leftTop, Dimension $dimension, $cornerSize, $color)
 {
     $color = $this->allocateColor($color);
     $x = $leftTop->getX();
     $y = $leftTop->getY();
     $width = $dimension->getWidth();
     $height = $dimension->getHeight();
     $cornerWidth = $cornerSize * 2;
     $innerWidth = $width - $cornerWidth;
     $innerHeight = $height - $cornerWidth;
     // left top
     imageArc($this->resource, $x + $cornerSize, $y + $cornerSize, $cornerWidth, $cornerWidth, 180, 270, $color);
     // top
     imageLine($this->resource, $x + $cornerSize, $y, $x + $width - $cornerSize, $y, $color);
     // right top
     imageArc($this->resource, $x + $width - $cornerSize, $y + $cornerSize, $cornerWidth, $cornerWidth, 270, 360, $color);
     // center
     imageLine($this->resource, $x, $y + $cornerSize, $x, $y + $height - $cornerSize, $color);
     imageLine($this->resource, $x + $width, $y + $cornerSize, $x + $width, $y + $height - $cornerSize, $color);
     // left down
     imageArc($this->resource, $x + $cornerSize, $y + $height - $cornerSize, $cornerWidth, $cornerWidth, 90, 180, $color);
     // down
     imageLine($this->resource, $x + $cornerSize, $y + $height, $x + $width - $cornerSize, $y + $height, $color);
     // right down
     imageArc($this->resource, $x + $width - $cornerSize, $y + $height - $cornerSize, $cornerWidth, $cornerWidth, 0, 90, $color);
 }
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:35,代码来源:Image.php


示例8: makeCharter

 function makeCharter($competitor_name, $competitor_points, $class_id, $path, $print_with_results, $charter_type, $year)
 {
     $this->load->model('settings_model');
     $print_settings = $this->settings_model->getPrintSettings();
     foreach ($print_settings as $setting_key => $print_setting) {
         //schaut ob es überhaupt mit der pixelverschiebung zu tun hat:
         if ($setting_key != str_replace("axis", "", $setting_key)) {
             ${$setting_key} = $print_setting['setting_value'];
         }
     }
     $total_points = $competitor_points['total_points'];
     $textnr = 4;
     $width = 420;
     $height = 595;
     if ($charter_type == 'honor') {
         $width = 850;
         $move_x_axis = 529 + $move_x_axis;
         $move_y_axis = 112 + $move_y_axis;
     }
     $im = imagecreate($width, $height);
     //Dicke der Linien festlegen
     imagesetthickness($im, 50);
     //Breite und Höhe des $im Objekts
     $image_height = ImageSY($im);
     $image_width = ImageSX($im);
     //Farben
     $black = ImageColorAllocate($im, 0, 0, 0);
     //Schriften (arial)
     $font = '/libs/fonts/Arial.ttf';
     #!!!!!!!!!!!!!!!!!!!!!!!!!!
     $font_height = ImageFontHeight(2);
     $font_width = ImageFontWidth(2);
     $length = $font_width * strlen($competitor_name);
     //Mitte des Bildes
     $image_center_x = $image_width / 2 - $length / 2;
     $image_center_y = $image_height / 2 - $font_height / 2;
     //Transparenten Hintergrund erstellen
     $im = imagecreatetruecolor($width, $height);
     imagesavealpha($im, true);
     imagealphablending($im, false);
     $background = imagecolorallocatealpha($im, 255, 255, 255, 127);
     imagefilledrectangle($im, 0, 0, $width, $height, $background);
     imagealphablending($im, true);
     //"Drucke" die Jahreszahl
     $x_year = 317 + $move_x_axis;
     $y_year = 161 + $move_y_axis;
     imagettftext($im, 7, 0, $x_year, $y_year, $black, $font, $year);
     //"Drucke" den Competitor Name
     $x_competitor_name = $image_center_x + $move_x_axis;
     $y_competitor_name = 356 + $move_y_axis;
     if ($charter_type == 'honor') {
         $x_competitor_name = $x_competitor_name - 190;
     }
     imagettftext($im, 15, 0, $x_competitor_name, $y_competitor_name, $black, $font, $competitor_name);
     //"Drucke" die Gesamtpunktzahl
     $x_competitor_points = 190 + $move_x_axis;
     $y_competitor_points = 295 + $move_y_axis;
     imagettftext($im, 15, 0, $x_competitor_points, $y_competitor_points, $black, $font, $total_points);
     //sport_section_2
     $x_sport_section_2_1 = 203 + $move_x_axis;
     $x_sport_section_2_2 = 267 + $move_x_axis;
     $y_sport_section_2 = 218 + $move_y_axis;
     imageLine($im, $x_sport_section_2_1, $y_sport_section_2, $x_sport_section_2_2, $y_sport_section_2, $black);
     //sport_section_3
     $x_sport_section_3_1 = 203 + $move_x_axis;
     $x_sport_section_3_2 = 267 + $move_x_axis;
     $y_sport_section_3 = 247 + $move_y_axis;
     imageLine($im, $x_sport_section_3_1, $y_sport_section_3, $x_sport_section_3_2, $y_sport_section_3, $black);
     //druck auch die Ergebnisse
     if ($print_with_results) {
         //hier können dann die Ergebnisse rein
     }
     //wandelt leerzeichen und  Umlaute um, schreibt alles klein
     $upas = array("ä" => "ae", "ü" => "ue", "ö" => "oe", "Ä" => "Ae", "Ü" => "Ue", "Ö" => "Oe");
     $file_name = str_replace(' ', '_', $competitor_name);
     $file_name = strtr($file_name, $upas);
     $file_name = strtolower($file_name);
     $charter_path = './output/' . $path . '/' . $class_id . '_' . $file_name . '.png';
     ImagePNG($im, $charter_path);
 }
开发者ID:kilianvolmer,项目名称:GiegSports,代码行数:80,代码来源:results.php


示例9: log10

            //$count=$count/1000*50;//lin
            $count = log10($count + 1.0) * ($va / log10(2000));
            if ($count > $max2) {
                $max2 = $count;
            }
            if ($count > 0) {
                imageLine($image, $i, $j * $va + $vs - $count, $i, $j * $va + $vs, $green);
            }
            $j++;
        }
        //while
        $i++;
        $i++;
    }
    //for $mo
    imageLine($image, $i, $vs - $va * 2, $i, $diagramHeight - 1, $black);
}
//for $y
$j = 0;
foreach ($cats as $cat) {
    imageFilledRectangle($image, 1, $j * $va + $vs - ($va - 1), $hs - 1, $j * $va + $vs - ($va - 11), $colorBackgr);
    imageString($image, 3, 2, $j * $va + $vs - $va, "{$cats[$j]}", $black);
    $j++;
}
pg_close($dbconn);
echo "max records/month= {$max} max2 pixels= {$max2}<br>\n";
//create an interlaced image for better loadingin the browser
imageInterlace($image, 1);
//mark background coloras being transparent
//imageColorTransparent($image,$colorBackgr);
imagePNG($image, "{$secdir}/hec.png");
开发者ID:helio-vo,项目名称:helio,代码行数:31,代码来源:hec_graph.php


示例10: imageCreateTrueColor

/* Создание изображения */
// $i = imageCreate(500, 300);
$i = imageCreateTrueColor(500, 300);
/* Подготовка к работе */
imageAntiAlias($i, true);
$red = imageColorAllocate($i, 255, 0, 0);
$white = imageColorAllocate($i, 0xff, 0xff, 0xff);
$black = imageColorAllocate($i, 0, 0, 0);
$green = imageColorAllocate($i, 0, 255, 0);
$blue = imageColorAllocate($i, 0, 0, 255);
$grey = imageColorAllocate($i, 192, 192, 192);
imageFill($i, 0, 0, $grey);
/* Рисуем примитивы */
imageSetPixel($i, 10, 10, $black);
imageLine($i, 20, 20, 280, 180, $red);
imageRectangle($i, 20, 20, 280, 180, $blue);
//array of dots
$points = [120, 120, 100, 200, 300, 200];
imagePolygon($i, $points, 3, $green);
imageEllipse($i, 200, 150, 300, 200, $red);
// imageArc($i, 210, 160, 300, 200, 0, 90, $black);
imageFilledArc($i, 200, 150, 300, 200, 0, 40, $red, IMG_ARC_PIE);
/* Рисуем текст */
imageString($i, 5, 150, 200, 'php7', $black);
imageCharUp($i, 3, 200, 200, 'PHP5', $blue);
imageTtfText($i, 30, 10, 300, 150, $green, 'arial.ttf', 'PHP7');
/* Отдаем изображение */
// header("Content-type: image/gif");
// imageGif($i);
header("Content-type: image/png");
开发者ID:sydorenkovd,项目名称:phpOOPsite.local-train,代码行数:30,代码来源:image_create.php


示例11: imageLine

        }
        $xline = $xline + $grid_spacing;
        imageLine($img, $xline, 0, $xline, $img_height, $color);
    }
    // Y Axis
    for ($y = 0; $y < $grid_y_inc; $y++) {
        if ($img_grid_random_color) {
            $r = rand($txt_rgb_min, $txt_rgb_max);
            $g = rand($txt_rgb_min, $txt_rgb_max);
            $b = rand($txt_rgb_min, $txt_rgb_max);
            $color = imageColorAllocate($img, $r, $g, $b);
        } else {
            $color = $black;
        }
        $yline = $yline + $grid_spacing;
        imageLine($img, 0, $yline, $img_width, $yline, $color);
    }
}
// Border
if ($img_use_border) {
    imageRectangle($img, 0, 0, $img_width - 1, $img_height - 1, $black);
}
$string_len = strlen($string);
$position = $txt_horizontal_pos;
// Looping through each letter
for ($i = 0; $i < $string_len; $i++) {
    $c = $string[$i];
    // Angle
    if ($txt_use_angles) {
        $angle = rand($txt_letter_angle_min, $txt_letter_angle_max);
    } else {
开发者ID:mmr,项目名称:b1n,代码行数:31,代码来源:createimg.php


示例12: confirmImage

    /**
     * 	Функция генерирует и выводит хидер PNG и изображение с кодом подтверждения (код берется из массива полей)
     * 	Возвращает результат выполнения imagePNG
     * 	@return	bool
     */
    function confirmImage() {

        $width = ajaxform::$captcha[width];
        $height = ajaxform::$captcha[height];

        $multi = 4;
        $xwidth = $width * $multi;
        $xheight = $height * $multi;

        $code = $this->fields[confirm][value];

        $im = imageCreateTrueColor($xwidth, $xheight);
        $w = imageColorAllocate($im, 255, 255, 255);
        $b = imageColorAllocate($im, 000, 000, 000);
        $g = imageColorAllocate($im, 100, 100, 100);
        imageFill($im, 1, 1, $w);
        $w = imageColorTransparent($im, $w);

        $r = mt_rand(0, $xheight);
        for ($x = 0; $x < $xwidth + $xheight; $x += 4 * $multi) {

            for ($i = 0; $i < $multi; $i++)
                imageLine($im, $x + $i, 0, $x + $i - $xheight, $xheight + $r, $g);
        }

        $arr = preg_split('//', $code, -1, PREG_SPLIT_NO_EMPTY);
        for ($i = 0; $i < count($arr); $i++) {

            $x = ($xwidth * 0.04) + (floor(($xwidth * 0.97) * 0.167)) * $i; // разрядка
            $y = ($xheight * 0.8);
            $s = ($xheight * 0.5) * (96 / 72); // 96 — res
            $a = mt_rand(-20, 20);

            imageTTFText($im, $s, $a, $x, $y, $b, $_SERVER[DOCUMENT_ROOT] . "/lib/core/classes/form_ajax/consolas.ttf", $arr[$i]); //
        }

        $temp = imageCreateTrueColor($xwidth, $xheight);
        $w = imageColorAllocate($temp, 255, 255, 255);
        imageFill($temp, 1, 1, $w);
        $w = imageColorTransparent($temp, $w);

        $phase = rand(-M_PI, M_PI);
        $frq = 2 * M_PI / $xheight;
        $amp = $xwidth * 0.02;

        for ($y = 0; $y < $xheight; $y++) {

            $dstx = $amp + sin($y * $frq + $phase) * $amp;

            imagecopy($temp, $im, $dstx, $y, 0, $y, $xwidth, 1);
            //imagesetpixel($im, $dstx, $y, $b);
        }

        $res = imageCreateTrueColor($width, $height);
        $w = imageColorAllocate($res, 255, 255, 255);
        imageFill($res, 1, 1, $w);
        $w = imageColorTransparent($res, $w);

        imageCopyResampled($res, $temp, 0, 0, 0, 0, $width, $height, $xwidth, $xheight);

        imageTrueColorToPalette($res, true, 256);

        header("CONTENT-TYPE: IMAGE/PNG");
        return imagePNG($res);
    }
开发者ID:GGF,项目名称:baza4,代码行数:70,代码来源:ajaxform.class.php


示例13: drawElement


//.........这里部分代码省略.........
     $y1_shift = $zero - $shift_from / $unit2px;
     $y2_shift = $zero - $shift_to / $unit2px;
     if (!$this->limitToBounds($y1, $y2, $this->shiftY, $this->sizeY, $drawtype)) {
         return true;
     }
     if (!$this->limitToBounds($y1_shift, $y2_shift, $this->shiftY, $this->sizeY, $drawtype)) {
         return true;
     }
     // draw main line
     switch ($drawtype) {
         case GRAPH_ITEM_DRAWTYPE_BOLD_LINE:
             if ($calc_fnc == CALC_FNC_ALL) {
                 imagefilledpolygon($this->im, $a, 4, $minmax_color);
                 if (!$y1x || !$y2x) {
                     imageline($this->im, $x1 + 1, $y1max, $x2 + 1, $y2max, $max_color);
                     imageline($this->im, $x1, $y1max, $x2, $y2max, $max_color);
                 }
                 if (!$y1n || !$y2n) {
                     imageline($this->im, $x1 - 1, $y1min, $x2 - 1, $y2min, $min_color);
                     imageline($this->im, $x1, $y1min, $x2, $y2min, $min_color);
                 }
             }
             imageline($this->im, $x1, $y1 + 1, $x2, $y2 + 1, $avg_color);
             imageline($this->im, $x1, $y1, $x2, $y2, $avg_color);
             break;
         case GRAPH_ITEM_DRAWTYPE_LINE:
             if ($calc_fnc == CALC_FNC_ALL) {
                 imagefilledpolygon($this->im, $a, 4, $minmax_color);
                 if (!$y1x || !$y2x) {
                     imageline($this->im, $x1, $y1max, $x2, $y2max, $max_color);
                 }
                 if (!$y1n || !$y2n) {
                     imageline($this->im, $x1, $y1min, $x2, $y2min, $min_color);
                 }
             }
             imageline($this->im, $x1, $y1, $x2, $y2, $avg_color);
             break;
         case GRAPH_ITEM_DRAWTYPE_FILLED_REGION:
             $a[0] = $x1;
             $a[1] = $y1;
             $a[2] = $x1;
             $a[3] = $y1_shift;
             $a[4] = $x2;
             $a[5] = $y2_shift;
             $a[6] = $x2;
             $a[7] = $y2;
             imagefilledpolygon($this->im, $a, 4, $avg_color);
             break;
         case GRAPH_ITEM_DRAWTYPE_DOT:
             imagefilledrectangle($this->im, $x1 - 1, $y1 - 1, $x1, $y1, $avg_color);
             break;
         case GRAPH_ITEM_DRAWTYPE_BOLD_DOT:
             imagefilledrectangle($this->im, $x2 - 1, $y2 - 1, $x2 + 1, $y2 + 1, $avg_color);
             break;
         case GRAPH_ITEM_DRAWTYPE_DASHED_LINE:
             if (function_exists('imagesetstyle')) {
                 // use imagesetstyle+imageline instead of bugged imagedashedline
                 $style = array($avg_color, $avg_color, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT);
                 imagesetstyle($this->im, $style);
                 imageline($this->im, $x1, $y1, $x2, $y2, IMG_COLOR_STYLED);
             } else {
                 imagedashedline($this->im, $x1, $y1, $x2, $y2, $avg_color);
             }
             break;
         case GRAPH_ITEM_DRAWTYPE_GRADIENT_LINE:
             imageLine($this->im, $x1, $y1, $x2, $y2, $avg_color);
             // draw the initial line
             imageLine($this->im, $x1, $y1 - 1, $x2, $y2 - 1, $avg_color);
             $bitmask = 255;
             $blue = $avg_color & $bitmask;
             // $blue_diff = 255 - $blue;
             $bitmask = $bitmask << 8;
             $green = ($avg_color & $bitmask) >> 8;
             // $green_diff = 255 - $green;
             $bitmask = $bitmask << 8;
             $red = ($avg_color & $bitmask) >> 16;
             // $red_diff = 255 - $red;
             // note: though gradients on the chart looks ok, the formula used is completely incorrect
             // if you plan to fix something here, it would be better to start from scratch
             $maxAlpha = 110;
             $startAlpha = 50;
             $alphaRatio = $maxAlpha / ($this->sizeY - $startAlpha);
             $diffX = $x1 - $x2;
             for ($i = 0; $i <= $diffX; $i++) {
                 $Yincr = $diffX > 0 ? abs($y2 - $y1) / $diffX : 0;
                 $gy = $y1 > $y2 ? $y2 + $Yincr * $i : $y2 - $Yincr * $i;
                 $steps = $this->sizeY + $this->shiftY - $gy + 1;
                 for ($j = 0; $j < $steps; $j++) {
                     if ($gy + $j < $this->shiftY + $startAlpha) {
                         $alpha = 0;
                     } else {
                         $alpha = 127 - abs(127 - $alphaRatio * ($gy + $j - $this->shiftY - $startAlpha));
                     }
                     $color = imagecolorexactalpha($this->im, $red, $green, $blue, $alpha);
                     imagesetpixel($this->im, $x2 + $i, $gy + $j, $color);
                 }
             }
             break;
     }
 }
开发者ID:kai-cn,项目名称:zatree,代码行数:101,代码来源:class.cchart_zabbix.php


示例14: renderGeometry

 function renderGeometry($pointArrayQuery, $geometry, $brush, $r, $b, $g)
 {
     $this->renderGeometryArray[] = array($this->convertpointarray($pointArrayQuery), $geometry, $brush, $r, $b, $g);
     global $render_im;
     $imgName = "render.png";
     if (!$render_im[$this->controlId]) {
         $render_im[$this->controlId] = imagecreate($this->width, $this->height);
     }
     $background_color = imagecolorallocate($render_im[$this->controlId], 255, 255, 255);
     $NewPointArray = explode("|", $pointArrayQuery);
     $line_color = imagecolorallocate($render_im[$this->controlId], 34, 255, 91);
     $brush_im = imagecreate($brush, $brush);
     $brush_color = imagecolorallocate($brush_im, $r, $b, $g);
     imageLine($brush_im, 8, 0, 8, 16, $brush_color);
     imageLine($brush_im, 0, 8, 16, 8, $brush_color);
     imagesetbrush($render_im[$this->controlId], $brush_im);
     $geometry = strtoupper($geometry);
     if ($geometry == "MULTIPOINT") {
         $geometry = "POINT";
     }
     if ($geometry == "MULTILINE" || $geometry == "MULTILINESTRING" || $geometry == "LINESTRING") {
         $geometry = "LINE";
     }
     if ($geometry == "MULTIPOLYGON") {
         $geometry = "LINE";
     }
     //echo "<script>alert('$geometry')</script>";
     switch ($geometry) {
         case "POINT":
             for ($i = 0; $i < sizeof($NewPointArray); $i++) {
                 $pixCoord = explode(",", $NewPointArray[$i]);
                 $marker_im = imagecreate(11, 11);
                 $background_color = imagecolorallocate($marker_im, 255, 255, 255);
                 $line_color = imagecolorallocate($marker_im, $r, $b, $g);
                 imageLine($marker_im, 5, 0, 5, 11, $line_color);
                 imageLine($marker_im, 0, 5, 11, 5, $line_color);
                 imagecopy($render_im[$this->controlId], $marker_im, $pixCoord[0] - 5, $pixCoord[1] - 5, 0, 0, 11, 11);
                 imagedestroy($marker_im);
             }
             break;
         case "LINE":
             //	echo "<script>alert('line')</script>";
             for ($i = 0; $i < sizeof($NewPointArray); $i++) {
                 for ($u = 0; $u < 2; $u++) {
                     $pixCoord[$u] = explode(",", $NewPointArray[$i + $u]);
                 }
                 if ($pixCoord[1][0]) {
                     imageLine($render_im[$this->controlId], $pixCoord[0][0], $pixCoord[0][1], $pixCoord[1][0], $pixCoord[1][1], IMG_COLOR_BRUSHED);
                 }
                 //		echo "<script>alert('".$pixCoord[1][0]."','".$pixCoord[1][1]."');</script>";
             }
             break;
         case "POLYGON":
             //echo "<script>alert('polygon')</script>";
             $pointArrayQuery = str_replace("|", ",", $pointArrayQuery);
             $array = explode(",", $pointArrayQuery);
             @imagepolygon($render_im[$this->controlId], $array, sizeof($NewPointArray), IMG_COLOR_BRUSHED);
             break;
     }
     //$test=imagepng($render_im[$this -> controlId], "render.png");
     //echo "<script>alert('render=$test')</script>";
     imagedestroy($brush_im);
 }
开发者ID:netcon-source,项目名称:MyGeoCloud,代码行数:63,代码来源:functions.php


示例15: buildLegRight

 public function buildLegRight()
 {
     imageLine($this->img, 170, 190, 170, 250, 5);
 }
开发者ID:kaysen820,项目名称:design_patten,代码行数:4,代码来源:PersonFatBuilder.class.php


示例16: imageCreateTrueColor

<?php

/*Работа с изображениями.Часть 2 урок 2-12
 ***Функция imageCopyResized() - копирование и изменение размера части изображения(1-куда копируем ресурс изо создаваемое, 2-откуда копируем ресурс изо исходное, 3 - х-координата создаваемого изо, 4 - у-координата создаваемого изо, 5 - х-координата исходного изо, 6 - у-координата исходного изо, 7- ширина создаваемого изо, 8 - высота создаваемого изо, 9 - ширина исходного изо, 10 - высота исходного изо)
 */
$im = imageCreateTrueColor(400, 500);
$color = imageColorAllocate($im, 34, 34, 34);
imageFill($im, 100, 100, $color);
$color = imageColorAllocate($im, 100, 200, 3);
imageSetThickness($im, 5);
imageLine($im, 0, 0, imageSX($im), imageSY($im), $color);
$color = imageColorAllocate($im, 0, 40, 255);
imageFilledRectangle($im, 10, 10, 100, 100, $color);
$im2 = imageCreateTrueColor(100, 200);
imageCopyResized($im2, $im, 0, 0, 50, 50, imageSX($im2), imageSY($im2), 70, 70);
header("Content-type: image/png");
imagePng($im2);
imageDestroy($im);
imageDestroy($im2);
开发者ID:echmaster,项目名称:data,代码行数:19,代码来源:2-12+Работа+с+изображением+Часть+2.php


示例17: imageLine

    /* y axis2 tics */
    imageLine($im, $dx + $gxb - $ticW, $i, $dx + $gxb + $ticW, $i, $black);
    /* y axis2 labels */
    //  if($flag=!$flag){
    imageString($im, 5, $dx + $gxb + 2 * $ticW, $i - $labelH, sprintf("%3.1f", $hum), $drkGreen);
    //  }
    $hum -= $dhum;
}
/* draw the temperature graph */
$scale = $gyb / ($tmp_max - $tmp_min);
for ($i = 0; $i + 1 < $row_count; $i++) {
    $x1 = $i * $gxb / $row_count + $dx;
    $y1 = $gyb + $dy - ($tempi[$i] - $tmp_min) * $scale;
    $x2 = ($i + 1) * $gxb / $row_count + $dx;
    $y2 = $gyb + $dy - ($tempi[$i + 1] - $tmp_min) * $scale;
    imageLine($im, $x1, $y1, $x2, $y2, $red);
}
/* draw the humidity graph */
$scale = $gyb / ($hum_max - $hum_min);
for ($i = 0; $i + 1 < $row_count; $i++) {
    $x1 = $i * $gxb / $row_count + $dx;
    $y1 = $gyb + $dy - ($humi[$i] - $hum_min) * $scale;
    $x2 = ($i + 1) * $gxb / $row_count + $dx;
    $y2 = $gyb + $dy - ($humi[$i + 1] - $hum_min) * $scale;
    imageLine($im, $x1, $y1, $x2, $y2, $drkGreen);
}
/* use gif as the image format */
header("Content-type: image/gif");
imageGIF($im);
/* lastly delete the image from memory */
imageDestroy($im);
开发者ID:BackupTheBerlios,项目名称:wth-svn,代码行数:31,代码来源:tmp_hum.gif.php


示例18: vvcode_render_code

function vvcode_render_code($code)
{
    if (!empty($code)) {
        // load fonts
        $ttf = array();
        if ($dir = opendir(DIR_WS_INCLUDES . 'fonts/')) {
            while (($file = readdir($dir)) !== false) {
                if (is_file(DIR_WS_INCLUDES . 'fonts/' . $file) and strstr(strtoupper($file), '.TTF')) {
                    $ttf[] = DIR_FS_CATALOG . '/includes/fonts/' . $file;
                }
            }
            closedir($dir);
        }
        $width = 240;
        $height = 50;
        $imgh = imagecreate($width, $height);
        $fonts = imagecolorallocate($imgh, 112, 112, 112);
        $lines = imagecolorallocate($imgh, 220, 148, 02);
        $background = imagecolorallocate($imgh, 196, 196, 196);
        imagefill($imgh, 0, 0, $background);
        $x = olc_rand(0, 20);
        $y = olc_rand(20, 40);
        for ($i = $x, $z = $y; $i < $width && $z < $width;) {
            imageLine($imgh, $i, 0, $z, $height, $lines);
            $i += $x;
            $z += $y;
        }
        $x = olc_rand(0, 20);
        $y = olc_rand(20, 40);
        for ($i = $x, $z = $y; $i < $width && $z < $width;) {
            imageLine($imgh, $z, 0, $i, $height, $lines);
            $i += $x;
            $z += $y;
        }
        $x = olc_rand(0, 10);
        $y = olc_rand(10, 20);
        for ($i = $x, $z = $y; $i < $height && $z < $height;) {
            imageLine($imgh, 0, $i, $width, $z, $lines);
            $i += $x;
            $z += $y;
        }
        $x = olc_rand(0, 10);
        $y = olc_rand(10, 20);
        for ($i = $x, $z = $y; $i < $height && $z < $height;) {
            imageLine($imgh, 0, $z, $width, $i, $lines);
            $i += $x;
            $z += $y;
        }
        for ($i = 0; $i < strlen($code); $i++) {
            $font = $ttf[(int) olc_rand(0, count($ttf) - 1)];
            $size = olc_rand(30, 36);
            $rand = olc_rand(1, 20);
            $direction = olc_rand(0, 1);
            if ($direction == 0) {
                $angle = 0 - $rand;
            } else {
                $angle = $rand;
            }
            if (function_exists('imagettftext')) {
                imagettftext($imgh, $size, $angle, 15 + 36 * $i, 38, $fonts, $font, substr($code, $i, 1));
            } else {
                $tc = ImageColorAllocate($imgh, 0, 0, 0);
                //Schriftfarbe - schwarz
                ImageString($imgh, $size, 26 + 36 * $i, 20, substr($code, $i, 1), $tc);
            }
        }
        header('Content-Type: image/jpeg');
        imagejpeg($imgh);
        imagedestroy($imgh);
    }
}
开发者ID:BackupTheBerlios,项目名称:ol-commerce-svn,代码行数:71,代码来源:224.php


示例19:

						if((isset($tab_x[$i+1]))&&($tab_x[$i+1]!="")) {
							imageline ($img,$tab_x[$i],$tab_y[$i],$tab_x[$i+1],$tab_y[$i+1],$couleureleve[$k]);
							writinfo('/tmp/infos_graphe.txt','a+',"\nUne ligne\n");
							writinfo('/tmp/infos_graphe.txt','a+',"\$tab_x[$i]=$tab_x[$i]\n");
							writinfo('/tmp/infos_graphe.txt','a+',"\$tab_y[$i]=$tab_y[$i]\n");
							writinfo('/tmp/infos_graphe.txt','a+',"\$tab_x[$i+1]=".$tab_x[$i+1]."\n");
		 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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