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


PHP imagedashedline函数代码示例

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


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

示例1: CaptchaSecurityImages

 function CaptchaSecurityImages($width = '120', $height = '40', $characters = '6')
 {
     $code = $this->generateCode($characters);
     /* font size will be 75% of the image height */
     $font_size = $height * 0.75;
     $image = @imagecreate($width, $height) or die('Cannot initialize new GD image stream');
     /* set the colours */
     $background_color = imagecolorallocate($image, 255, 255, 255);
     $text_color = imagecolorallocate($image, 0, 0, 0);
     $noise_color = imagecolorallocate($image, 226, 82, 207);
     $noise_color1 = imagecolorallocate($image, 64, 179, 255);
     $noise_color2 = imagecolorallocate($image, 255, 204, 190);
     /* generate random dots in background */
     for ($i = 0; $i < $width * $height / 250; $i++) {
         imageellipse($image, mt_rand(0, $width), mt_rand(0, $height), mt_rand(0, $width), mt_rand(0, $height), $noise_color2);
     }
     /* generate random dots in background */
     for ($i = 0; $i < $width * $height / 150; $i++) {
         imagedashedline($image, mt_rand(0, $width), mt_rand(0, $height), mt_rand(0, $width), mt_rand(0, $height), $noise_color1);
     }
     /* generate random lines in background */
     for ($i = 0; $i < $width * $height / 150; $i++) {
         imagedashedline($image, mt_rand(0, $width), mt_rand(0, $height), mt_rand(0, $width), mt_rand(0, $height), $noise_color);
     }
     /* create textbox and add text */
     $textbox = imagettfbbox($font_size, 0, $this->font, $code) or die('Error in imagettfbbox function');
     $x = ($width - $textbox[4]) / 2;
     $y = ($height - $textbox[5]) / 2;
     imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->font, $code) or die('Error in imagettftext function');
     /* output captcha image to browser */
     imagejpeg($image);
     imagedestroy($image);
     $_SESSION['security_code'] = $code;
 }
开发者ID:Coding110,项目名称:cbvideo,代码行数:34,代码来源:captcha_simple.img.php

示例2: imagecolorallocate

// red color
$blue = imagecolorallocate($image, 0, 0, 255);
// blue color
$green = imagecolorallocate($image, 0, 255, 0);
// green color
$black = imagecolorallocate($image, 0, 0, 0);
// black color
imageline($image, 0, $nolla, $width, $nolla, $black);
// draw zero line in middle of picture
imagestring($image, 5, 5, $nolla + 5, '0 C', $black);
// write 0 c near zero line
imagedashedline($image, 0, $nolla + 20 * $kerroin, $width, $nolla + 20 * $kerroin, $black);
// draw -20 C line
imagestring($image, 5, 5, $nolla + 20 * $kerroin + 5, '-20 C', $black);
// write -20 C near-20 c line
imagedashedline($image, 0, $nolla - 20 * $kerroin, $width, $nolla - 20 * $kerroin, $black);
// draw 20 C line
imagestring($image, 5, 5, $nolla - 20 * $kerroin + 5, '20 C', $black);
// write 20 near 20 c line
imagestring($image, 5, 10, 10, 'Ulkolampotila:', $black);
imagestring($image, 4, 10, 25, 'Current', $green);
imagestring($image, 4, 10, 40, 'Max', $red);
imagestring($image, 4, 10, 55, 'Min', $blue);
// write on the top corner out temperature,current,max,min
@($line = explode(" ", $file[$i]));
// using space for delimiter separates values to array
@($temp_a = $line[5] * $kerroin);
// setting first temperature point
@($maxtemp_a = $line[6] * $kerroin);
// setting first max temp point
@($mintemp_a = $line[7] * $kerroin);
开发者ID:Belsebot,项目名称:Thermometer-chart,代码行数:31,代码来源:chart.php

示例3: create

 public function create()
 {
     $pxHeight = $this->pxPaperSize['height'] / 2;
     // we only use a quadrant
     $pxWidth = $this->pxPaperSize['width'] / 2;
     // we only use a quadrant
     $im = imagecreatetruecolor($pxWidth, $pxHeight);
     if (!$im) {
         throw new Exception(__('Failed to create prescription'));
     }
     $font = $this->fonts['regular'];
     $fontBold = $this->fonts['bold'];
     $white = imagecolorallocate($im, 255, 255, 255);
     $black = imagecolorallocate($im, 0, 0, 0);
     imagefilledrectangle($im, 0, 0, $this->pxPaperSize['width'], $this->pxPaperSize['height'], $white);
     // deduct 1pixel to the right vertical and lower horizontal
     $width = $pxWidth - 1;
     $height = $pxHeight - 1;
     imagedashedline($im, 0, 0, 0, $height, $black);
     // left vertical
     imagedashedline($im, 0, 0, $width, 0, $black);
     // upper horizontal
     imagedashedline($im, $width, 0, $width, $height, $black);
     // right vertical
     imagedashedline($im, 0, $height, $width, $height, $black);
     // lower horizontal
     $x = 0;
     $y = 20;
     $size = 11;
     $angle = 0;
     $texts = array();
     $texts[] = $this->prescriberName;
     $texts[] = 'S.L.# ' . $this->prescriberStateLicenseNumber . '        D.E.A.# ' . $this->prescriberDeaNumber;
     foreach ($texts as $text) {
         $box = imagettfbbox($size, $angle, $fontBold, $text);
         $x = abs(ceil(($pxWidth - $box[2]) / 2));
         $y += 20;
         imagettftext($im, $size, 0, $x, $y, $black, $fontBold, $text);
     }
     $texts = array();
     $texts[] = $this->practiceName;
     $texts[] = $this->practiceAddress;
     $texts[] = $this->practiceCity . ', ' . $this->practiceState . ' ' . $this->practicePostalCode;
     $y += 20;
     foreach ($texts as $text) {
         $box = imagettfbbox($size, $angle, $font, $text);
         $x = abs(ceil(($pxWidth - $box[2]) / 2));
         $y += 20;
         imagettftext($im, $size, 0, $x, $y, $black, $font, $text);
     }
     $data = array();
     $data[] = array('label' => __('Patient Name'), 'text' => $this->patientName);
     $data[] = array('label' => __('Address'), 'text' => $this->patientAddress . ', ' . $this->patientCity . ' ' . $this->patientState . ' ' . $this->patientPostalCode);
     $data[] = array(array('label' => __('Date'), 'text' => $this->medicationDatePrescribed), array('label' => __('DOB'), 'text' => $this->patientDateOfBirth));
     $data[] = array('label' => __('Description'), 'text' => $this->medicationDescription);
     $data[] = array('label' => _('Comments'), 'text' => $this->medicationComment);
     $data[] = array(array('label' => __('Quantity'), 'text' => $this->medicationQuantity), array('label' => __('Refill'), 'text' => $this->medicationRefills . ' ' . __('Times')));
     $data[] = array('label' => __('Directions'), 'text' => $this->medicationDirections);
     $permitted = '';
     if (!$this->medicationSubstitution) {
         $permitted = __('Not') . ' ';
     }
     $data[] = array('label' => '', 'text' => __('Substitution') . ' ' . $permitted . __('Permitted'));
     $size = 10;
     $labelMaxWidth = 0;
     $textMaxWidth = 0;
     foreach ($data as $key => $value) {
         if (!isset($value['label'])) {
             foreach ($value as $k => $v) {
                 $label = $v['label'];
                 $box = imagettfbbox($size, $angle, $font, $label);
                 $maxWidth = abs(ceil($box[2] - $box[0]));
                 $data[$key][$k]['labelWidth'] = $maxWidth;
                 if ($maxWidth > $labelMaxWidth) {
                     $labelMaxWidth = $maxWidth;
                 }
                 $text = $v['text'];
                 $box = imagettfbbox($size, $angle, $font, $text);
                 $maxWidth = abs(ceil($box[2] - $box[0]));
                 $data[$key][$k]['textWidth'] = $maxWidth;
                 if ($maxWidth > $textMaxWidth) {
                     $textMaxWidth = $maxWidth;
                 }
             }
         } else {
             $label = $value['label'];
             $box = imagettfbbox($size, $angle, $font, $label);
             $maxWidth = abs(ceil($box[2] - $box[0]));
             $data[$key]['labelWidth'] = $maxWidth;
             if ($maxWidth > $labelMaxWidth) {
                 $labelMaxWidth = $maxWidth;
             }
             $text = $value['text'];
             $box = imagettfbbox($size, $angle, $font, $text);
             $maxWidth = abs(ceil($box[2] - $box[0]));
             $data[$key]['textWidth'] = $maxWidth;
             if ($maxWidth > $textMaxWidth) {
                 $textMaxWidth = $maxWidth;
             }
         }
//.........这里部分代码省略.........
开发者ID:dragonlet,项目名称:clearhealth,代码行数:101,代码来源:Prescription.php

示例4: produce_page_graph


//.........这里部分代码省略.........
                }
            }
        }
    }
    if ($max >= 10 && $max < 100) {
        $max = ceil($max);
    } else {
        if ($max >= 100 && $max < 1000) {
            $max = round($max, -1);
            // Up
        } else {
            if ($max >= 1000) {
                $max = round($max, -2);
                // Up
            }
        }
    }
    $lines = min($graphwidth, $total);
    $gap = ($graphwidth - $lines) / $lines;
    if ($gap < 0) {
        $gap = 0;
    }
    $range = $max - $min;
    if ($range > 0) {
        $ratio = $graphheight / $range;
    } else {
        $ratio = 1;
    }
    $b = reset($before->{$field});
    $a = reset($after->{$field});
    $pb = null;
    $pa = null;
    $px = null;
    $bc = null;
    $ac = null;
    $beforeaverages = array();
    $afteraverages = array();
    $averagesamplespace = max(20, $total / 20);
    for ($i = 1; $i < $lines; $i++) {
        $xpoint = $i + $x1 + ($i - 1) * $gap;
        $ybefore = $height - 10 - floor(($b - $min) * $ratio);
        $yafter = $height - 10 - floor(($a - $min) * $ratio);
        if ($i > $averagesamplespace / 2 && $i < $lines - $averagesamplespace / 2) {
            $beforechunk = array_slice($before->{$field}, $i - $averagesamplespace / 2, $averagesamplespace);
            $beforechunk = array_sum($beforechunk) / count($beforechunk);
            $beforechunk = $height - 10 - floor(($beforechunk - $min) * $ratio);
            $beforeaverages[$xpoint] = $beforechunk;
            $afterchunk = array_slice($after->{$field}, $i - $averagesamplespace / 2, $averagesamplespace);
            $afterchunk = array_sum($afterchunk) / count($afterchunk);
            $afterchunk = $height - 10 - floor(($afterchunk - $min) * $ratio);
            $afteraverages[$xpoint] = $afterchunk;
        }
        if ($gap > 0 && $px != null) {
            if ($gap > 3) {
                imagefilledellipse($image, $xpoint, $ybefore, 3, 3, $colours->beforepoint);
                imagefilledellipse($image, $xpoint, $yafter, 3, 3, $colours->afterpoint);
            } else {
                imagesetpixel($image, $xpoint, $ybefore, $colours->beforepoint);
                imagesetpixel($image, $xpoint, $yafter, $colours->afterpoint);
            }
            imageline($image, $px, $pb, $xpoint, $ybefore, $colours->beforeline);
            imageline($image, $px, $pa, $xpoint, $yafter, $colours->afterline);
        }
        $px = $xpoint;
        $pb = $ybefore;
        $pa = $yafter;
        $b = next($before->{$field});
        $a = next($after->{$field});
    }
    $ybefore = array_sum($before->{$field}) / $total - $min;
    $ybefore = $height - 10 - round($ybefore * $ratio, 1);
    $yafter = array_sum($after->{$field}) / $total - $min;
    $yafter = $height - 10 - round($yafter * $ratio, 1);
    imagedashedline($image, 11, $ybefore, $width - 12, $ybefore, $colours->beforelineflat);
    imagedashedline($image, 11, $yafter, $width - 12, $yafter, $colours->afterlineflat);
    $lastx = null;
    $lasty = null;
    foreach ($beforeaverages as $x => $y) {
        if ($lastx != null) {
            imageline($image, $lastx, $lasty, $x, $y, $colours->beforelineave);
        }
        $lastx = $x;
        $lasty = $y;
    }
    $lastx = null;
    $lasty = null;
    foreach ($afteraverages as $x => $y) {
        if ($lastx != null) {
            imageline($image, $lastx, $lasty, $x, $y, $colours->afterlineave);
        }
        $lastx = $x;
        $lasty = $y;
    }
    write_graph_y_labels($image, $min, $max, $width, $height, $colours->black);
    write_graph_title($image, $field, $width, $height, $colours->black);
    write_graph_legend($image, $colours, $width, $height);
    imagepng($image, $path . $name, 9);
    chmod($path . $name, 0775);
    return $name;
}
开发者ID:rajeshtaneja,项目名称:moodle-performance-runner,代码行数:101,代码来源:lib.php

示例5: imagedashedline

<?php

/* Prototype  : bool imagedashedline  ( resource $image  , int $x1  , int $y1  , int $x2  , int $y2  , int $color  )
 * Description: Draws a dashed line.
 * This function is deprecated. Use combination of imagesetstyle() and imageline() instead.
 * Source code: ext/standard/image.c
 * Alias to functions: 
 */
echo "Simple test of imagedashedline() function\n";
$dest = dirname(realpath(__FILE__)) . '/imagedashedline.png';
// create a blank image
$image = imagecreatetruecolor(250, 250);
// set the background color to black
$bg = imagecolorallocate($image, 0, 0, 0);
// red dashed lines
$col_line = imagecolorallocate($image, 255, 0, 0);
// draw a couple of vertical dashed lines
imagedashedline($image, 100, 20, 100, 230, $col_line);
imagedashedline($image, 150, 20, 150, 230, $col_line);
// output the picture to a file
imagepng($image, $dest);
//check color of a point on edge..
$col1 = imagecolorat($image, 100, 230);
// ..and a point on background
$col2 = imagecolorat($image, 5, 5);
$color1 = imagecolorsforindex($image, $col1);
$color2 = imagecolorsforindex($image, $col2);
var_dump($color1, $color2);
imagedestroy($image);
echo "Done\n";
开发者ID:gleamingthecube,项目名称:php,代码行数:30,代码来源:ext_gd_tests_imagedashedline_basic.php

示例6: imagesx

echo imagesx($img).'x'.imagesy($img).'<br />';
*/
$imgjpeg = imagecreate(600, 500);
$imgjpeg = imagecreatetruecolor(500, 500);
//真彩色图片颜色无法像调色板直接显示
$color1 = imagecolorallocate($imgjpeg, 0, 75, 0);
$color2 = imagecolorallocate($imgjpeg, 255, 255, 0);
//真彩色需填充,坐标-相邻所有相同色素点均改变
imagefill($imgjpeg, 0, 0, $color1);
//imagefill($imgjpeg,30,30,$color2);
for ($i = 1; $i <= 30; $i++) {
    $x1 = mt_rand(0, 500);
    $y1 = mt_rand(0, 500);
    $x2 = mt_rand(0, 500);
    $y2 = mt_rand(0, 500);
    $color3 = imagecolorallocate($imgjpeg, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
    imageline($imgjpeg, $x1, $y1, $x2, $y2, $color3);
    $x1 = mt_rand(0, 500);
    //$y1=mt_rand(0,500);
    //$x2=mt_rand(0,500);
    $y2 = mt_rand(0, 500);
    imagedashedline($imgjpeg, $x1, $y1, $x2, $y2, $color3);
}
for ($i = 0; $i <= 500; $i++) {
    imagesetpixel($imgjpeg, $i, mt_rand(0, $i), $color2);
}
imagerectangle($imgjpeg, 100, 100, 400, 400, $color2);
//显示图片
imagejpeg($imgjpeg);
//释放资源
imagedestroy($imgjpeg);
开发者ID:soontan,项目名称:allinone,代码行数:31,代码来源:day16.imagestart.php

示例7: myDrawLine

function myDrawLine($image, $x1, $y1, $x2, $y2, $color, $drawtype)
{
    if ($drawtype == MAP_LINK_DRAWTYPE_BOLD_LINE) {
        zbx_imagealine($image, $x1, $y1, $x2, $y2, $color, LINE_TYPE_BOLD);
    } elseif ($drawtype == MAP_LINK_DRAWTYPE_DASHED_LINE) {
        if (function_exists('imagesetstyle')) {
            // use imagesetstyle + imageline instead of bugged ImageDashedLine
            $style = array($color, $color, $color, $color, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT);
            imagesetstyle($image, $style);
            zbx_imageline($image, $x1, $y1, $x2, $y2, IMG_COLOR_STYLED);
        } else {
            imagedashedline($image, $x1, $y1, $x2, $y2, $color);
        }
    } elseif ($drawtype == MAP_LINK_DRAWTYPE_DOT && function_exists('imagesetstyle')) {
        $style = array($color, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT);
        imagesetstyle($image, $style);
        zbx_imageline($image, $x1, $y1, $x2, $y2, IMG_COLOR_STYLED);
    } else {
        zbx_imagealine($image, $x1, $y1, $x2, $y2, $color);
    }
}
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:21,代码来源:maps.inc.php

示例8: execute

	/**
	* Create the image containing $code with a seed of $seed
	*/
	function execute($code, $seed)
	{
		global $config;
		srand($seed);
		mt_srand($seed);

		// Create image
		$img = imagecreatetruecolor($this->width, $this->height);

		// Generate colours
		$colour = new colour_manager($img, array(
			'random'	=> true,
			'min_value'	=> 60,
		), 'hsv');

		$scheme = $colour->colour_scheme('background', false);
		$scheme = $colour->mono_range($scheme, 10, false);
		shuffle($scheme);

		$bg_colours = array_splice($scheme, mt_rand(6, 12));

		// Generate code characters
		$characters = $sizes = $bounding_boxes = array();
		$width_avail = $this->width - 15;
		$code_len = strlen($code);

		$captcha_bitmaps = $this->captcha_bitmaps();
		for ($i = 0; $i < $code_len; ++$i)
		{
			$characters[$i] = new char_cube3d($captcha_bitmaps, $code[$i]);

			list($min, $max) = $characters[$i]->range();
			$sizes[$i] = mt_rand($min, $max);

			$box = $characters[$i]->dimensions($sizes[$i]);
			$width_avail -= ($box[2] - $box[0]);
			$bounding_boxes[$i] = $box;
		}

		// Redistribute leftover x-space
		$offset = array();
		for ($i = 0; $i < $code_len; ++$i)
		{
			$denom = ($code_len - $i);
			$denom = max(1.3, $denom);
			$offset[$i] = mt_rand(0, (1.5 * $width_avail) / $denom);
			$width_avail -= $offset[$i];
		}

		if ($config['captcha_gd_x_grid'])
		{
			$grid = (int) $config['captcha_gd_x_grid'];
			for ($y = 0; $y < $this->height; $y += mt_rand($grid - 2, $grid + 2))
			{
				$current_colour = $scheme[array_rand($scheme)];
				imageline($img, mt_rand(0,4), mt_rand($y - 3, $y), mt_rand($this->width - 5, $this->width), mt_rand($y - 3, $y), $current_colour);
			}
		}

		if ($config['captcha_gd_y_grid'])
		{
			$grid = (int) $config['captcha_gd_y_grid'];
			for ($x = 0; $x < $this->width; $x += mt_rand($grid - 2, $grid + 2))
			{
				$current_colour = $scheme[array_rand($scheme)];
				imagedashedline($img, mt_rand($x -3, $x + 3), mt_rand(0, 4), mt_rand($x -3, $x + 3), mt_rand($this->height - 5, $this->height), $current_colour);
			}
		}

		$xoffset = 5;
		for ($i = 0; $i < $code_len; ++$i)
		{
			$dimm = $bounding_boxes[$i];
			$xoffset += ($offset[$i] - $dimm[0]);
			$yoffset = mt_rand(-$dimm[1], $this->height - $dimm[3]);

			$characters[$i]->drawchar($sizes[$i], $xoffset, $yoffset, $img, $colour->get_resource('background'), $scheme);
			$xoffset += $dimm[2];
		}
		
		if ($config['captcha_gd_foreground_noise'])
		{
			$this->noise_line($img, 0, 0, $this->width, $this->height, $colour->get_resource('background'), $scheme, $bg_colours);
		}

		// Send image
		header('Content-Type: image/png');
		header('Cache-control: no-cache, no-store');
		imagepng($img);
		imagedestroy($img);
	}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:94,代码来源:captcha_gd.php

示例9: ImageLine

    ImageLine($Image, 41, 260 - $label * $gap, 740 + $negative, 260 - $label * $gap, $ltgrey);
}
if ($negative > 10) {
    ImageLine($Image, 40 + $negative, 20, 40 + $negative, 260, $dkgrey);
}
ImageLine($Image, 50, 20, 50, 260, $dkgrey);
ImageLine($Image, 50, 260, 740 + $negative, 260, $dkgrey);
// Add quartile lines
if (isset($_GET['q1']) and isset($_GET['q2']) and isset($_GET['q3'])) {
    for ($i = 1; $i <= 3; $i++) {
        $quartile = round($_GET["q{$i}"], 2);
        imagedashedline($Image, $quartile * 7 + 40 + $negative, 20, $quartile * 7 + 40 + $negative, 260, $blue);
    }
}
imagedashedline($Image, $min_mark * 7 + 38 + $negative, 20, $min_mark * 7 + 38 + $negative, 260, $blue);
imagedashedline($Image, $max_mark * 7 + 43 + $negative, 20, $max_mark * 7 + 43 + $negative, 260, $blue);
ImageRectangle($Image, round($_GET["q1"], 2) * 7 + 40 + $negative, 1, round($_GET["q3"], 2) * 7 + 40 + $negative, 13, $blue);
ImageLine($Image, round($_GET["q2"], 2) * 7 + 40 + $negative, 1, round($_GET["q2"], 2) * 7 + 40 + $negative, 12, $blue);
// Median vertical
ImageLine($Image, $min_mark * 7 + 38 + $negative, 1, $min_mark * 7 + 38 + $negative, 13, $blue);
// Min vertical
ImageLine($Image, $min_mark * 7 + 38 + $negative, 7, round($_GET["q1"], 2) * 7 + 40 + $negative, 7, $blue);
// Min whisker
ImageLine($Image, $max_mark * 7 + 43 + $negative, 1, $max_mark * 7 + 43 + $negative, 13, $blue);
// Max vertical
ImageLine($Image, $max_mark * 7 + 43 + $negative, 7, round($_GET["q3"], 2) * 7 + 40 + $negative, 7, $blue);
// Max whisker
for ($i = $scale_start; $i <= 100; $i++) {
    if (isset($mydata[$i]) and $mydata[$i] > 0) {
        if ($i < $_GET['pmk']) {
            ImageFilledRectangle($Image, $i * 7 + 38 + $negative, 260 - $mydata[$i] * $gap, $i * 7 + 43 + $negative, 260, $red);
开发者ID:vinod-co,项目名称:centa,代码行数:31,代码来源:draw_distribution_chart.php

示例10: addMeasuredItem

/**
 * Adds the measured item to the PDF output.
 * 
 * @param object reference (!) to the current ezPDF-Object
 * @param string commaseperated X-Values of polygon / line
 * @param string commaseperated Y-Values of polygon / line
 * @param array configuration settings.
 *
 * @return void nothing
 *
 * @see makeCoordPairs
 * @see isClosedPolygon
 * @see makeStrokePointPairs
 * @see makePolyFromCoord
 * @see transformForPDF
 * @see makeCoordPairs
 *
 * @author M. Jansen <jansen@terrestris.de>, 2006-05-26
 */
function addMeasuredItem($thePDF, $x_value_str, $y_value_str, $theConfArray = array())
{
    // get global variable:
    global $legendFilenameUserPolygon;
    // create legend image:
    $legend_width = 17;
    $leg_img = imagecreate($legend_width, $legend_width);
    // save previous state:
    $thePDF->saveState();
    // save colors for legend:
    if (!defined("MAP_HAS_USER_POLYGON")) {
        define("MAP_HAS_USER_POLYGON", "test");
    }
    // get the arrays
    $theFullArr = makeCoordPairs($x_value_str, $y_value_str);
    $thePolyArr = makePolyFromCoord($theFullArr);
    if (isClosedPolygon($theFullArr)) {
        $isClosed = TRUE;
    } else {
        $isClosed = FALSE;
    }
    $nr_of_points = count($theFullArr);
    // is fill option set?
    // wenn der erste und letzte punkt nicht �bereinstimmen,
    // so muss in jedem Falle dofill auf 0 gesetzt werden
    if ($theConfArray['do_fill'] != '' && $isClosed) {
        $doFill = 1;
        // which color to use for filling?
        if (is_array($theConfArray['fill_color']) && $theConfArray['fill_color']['r'] != '' && $theConfArray['fill_color']['g'] != '' && $theConfArray['fill_color']['b'] != '') {
            $thePDF->setColor($theConfArray['fill_color']['r'], $theConfArray['fill_color']['g'], $theConfArray['fill_color']['b']);
            $legend_image_fill = $theConfArray['fill_color']['r'] . "," . $theConfArray['fill_color']['g'] . "," . $theConfArray['fill_color']['b'];
            // color to legend file
            $bg_color = imagecolorallocate($leg_img, round($theConfArray['fill_color']['r'] * 255), round($theConfArray['fill_color']['g'] * 255), round($theConfArray['fill_color']['b'] * 255));
        } else {
            $thePDF->setColor(0, 0, 0);
            // color to legend file
            $bg_color = imagecolorallocate($leg_img, 0, 0, 0);
        }
    } else {
        $doFill = 0;
        // color to legend file
        $bg_color = imagecolorallocate($leg_img, -1, -1, -1);
    }
    // Do we need to stroke (outline)?
    if ($theConfArray['do_stroke'] != '') {
        // which color to use for filling?
        if (is_array($theConfArray['stroke_color']) && $theConfArray['stroke_color']['r'] != '' && $theConfArray['stroke_color']['g'] != '' && $theConfArray['stroke_color']['b'] != '') {
            $thePDF->setStrokeColor($theConfArray['stroke_color']['r'], $theConfArray['stroke_color']['g'], $theConfArray['stroke_color']['b']);
            $thePDF->setLineStyle($theConfArray['line_style']['width'], $theConfArray['line_style']['cap'], $theConfArray['line_style']['join'], $theConfArray['line_style']['dash']);
            $theStrokePointPairs = makeStrokePointPairs($theFullArr);
            for ($i = 0; $i < count($theStrokePointPairs); $i++) {
                $line = $theStrokePointPairs[$i];
                if ($i != count($theStrokePointPairs) - 1 || $isClosed) {
                    $thePDF->line($line[0], $line[1], $line[2], $line[3]);
                    $stroke_color_legend_image = imagecolorallocate($leg_img, round($theConfArray['stroke_color']['r'] * 255), round($theConfArray['stroke_color']['g'] * 255), round($theConfArray['stroke_color']['b'] * 255));
                    if (is_array($theConfArray['line_style']['dash']) && $theConfArray['line_style']['dash'][1] != "" && $theConfArray['line_style']['dash'][1] != 0) {
                        imagedashedline($leg_img, 0, 0, $legend_width - 1, 0, $stroke_color_legend_image);
                        imagedashedline($leg_img, $legend_width - 1, 1, $legend_width - 1, $legend_width - 1, $stroke_color_legend_image);
                        imagedashedline($leg_img, 0, 0, 0, $legend_width - 1, $stroke_color_legend_image);
                        imagedashedline($leg_img, 0, $legend_width - 1, $legend_width - 1, $legend_width - 1, $stroke_color_legend_image);
                    } else {
                        imageline($leg_img, 0, 0, $legend_width - 1, 0, $stroke_color_legend_image);
                        imageline($leg_img, $legend_width - 1, 0, $legend_width - 1, $legend_width - 1, $stroke_color_legend_image);
                        imageline($leg_img, $legend_width - 1, $legend_width - 1, 0, $legend_width - 1, $stroke_color_legend_image);
                        imageline($leg_img, 0, $legend_width - 1, 0, 0, $stroke_color_legend_image);
                    }
                }
            }
        }
    }
    $thePDF->polygon($thePolyArr, $nr_of_points, $doFill);
    // eventually create the file:
    imagepng($leg_img, $legendFilenameUserPolygon);
    $thePDF->restoreState();
}
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:94,代码来源:print_functions.php

示例11: addDashed

 /**
  * 为图像增加干扰虚线
  *
  * @params int  $num  干扰线条数
  */
 function addDashed($num)
 {
     $width = imagesx($this->hImg);
     $height = imagesy($this->hImg);
     for ($i = 0; $i < $num; $i++) {
         $color = imagecolorallocate($this->hImg, rand(100, 255), rand(100, 255), rand(100, 255));
         imagedashedline($this->hImg, mt_rand(0, $width), mt_rand(0, $height), mt_rand(0, $width), mt_rand(0, $height), $color);
     }
 }
开发者ID:laiello,项目名称:lengdoframe,代码行数:14,代码来源:vcode.class.php

示例12: draw_lines

function draw_lines($im, $width, $height)
{
    $line_color = array('red' => 198, 'green' => 189, 'blue' => 165);
    $linecolor = imagecolorallocate($im, $line_color['red'], $line_color['green'], $line_color['blue']);
    for ($i = 0; $i <= $height; $i += 10) {
        imagedashedline($im, 0, $i, $width, $i, $linecolor);
    }
    for ($i = 0; $i <= $width; $i += 10) {
        imagedashedline($im, $i, 0, $i, $height, $linecolor);
    }
    return $im;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:12,代码来源:default.php

示例13: allocate_diagram_image


//.........这里部分代码省略.........
                     //END_CANCELTHROW???
                     if (isset($xSpriteMap[$marker])) {
                         // patch for an inexistent index
                         // echo '<br>MARKER: <br>&nbsp&nbsp&nbsp&nbsp' . $marker .'<br>'; print_r($xSpriteMap[$marker]) . '<br>';
                         $spriteCoords2 = $xSpriteMap[$marker];
                         if (!($element_running->running && $mk[1] == 'TIMER')) {
                             imagecopymerge($img, $shape_image, $figure[1] - $x1, $figure[2] - $y1, $spriteCoords2[0], $spriteCoords2[1], $figure[3], $figure[4], 100);
                         }
                     }
                 }
                 if (isset($element_running->terminated) && $element_running->terminated) {
                     imagecopymerge($img, $shape_image, $X2, $figure[2] - $y1, $xSpriteMap['icon_terminated'][0], $xSpriteMap['icon_terminated'][1], 12, 12, 100);
                 }
                 $this->print_text($img, $figure[6], 10, 0, $black, $font, $X1, $Y1, $X2, $Y2, $figure[0]);
                 break;
             case 'bpmnGateway':
                 //                    print_r($figure); echo '<br><br>';
                 $X1 = $figure[1] - $x1;
                 $Y1 = $figure[2] - $y1 + $figure[4] - 10;
                 $X2 = $X1 + $figure[3];
                 $Y2 = $Y1 + $figure[4] + 5;
                 $css = $figure[5];
                 $spriteCoords = $xSpriteMap[$css];
                 imagecopymerge($img, $shape_image, $figure[1] - $x1, $figure[2] - $y1, $spriteCoords[0], $spriteCoords[1], $figure[3], $figure[4], 100);
                 $this->print_text($img, $figure[6], 10, 0, $black, $font, $X1, $Y1, $X2, $Y2, $figure[0]);
                 break;
             case 'bpmnArtifact':
                 $xX1 = $figure[1] - $x1;
                 $xY1 = $figure[2] - $y1;
                 $xX2 = $xX1 + $figure[3];
                 $xY2 = $xY1 + $figure[4];
                 imagesetthickness($img, 1);
                 if ($figure[6] == 'GROUP') {
                     imagedashedline($img, $xX1, $xY1, $xX2, $xY1, $black);
                     imagedashedline($img, $xX2, $xY1, $xX2, $xY2, $black);
                     imagedashedline($img, $xX2, $xY2, $xX1, $xY2, $black);
                     imagedashedline($img, $xX1, $xY2, $xX1, $xY1, $black);
                 }
                 if ($figure[6] == 'TEXTANNOTATION') {
                     imageline($img, $xX1, $xY1, $xX1, $xY2, $black);
                     imageline($img, $xX1, $xY1, $xX1 + 15, $xY1, $black);
                     imageline($img, $xX1, $xY2, $xX1 + 15, $xY2, $black);
                 }
                 $this->print_text($img, $figure[5], 10, 0, $black, $font, $xX1, $xY1, $xX2, $xY2, $figure[0], $figure[5]);
                 break;
                 //this break wasn't here ...
             //this break wasn't here ...
             case 'bpmnFlow':
                 $X1 = $figure[1] - $x1;
                 $Y1 = $figure[2] - $y1;
                 $X2 = $X1 + $figure[3];
                 $Y2 = $Y1 + $figure[4];
                 imagesetthickness($img, 1);
                 $lines = json_decode($figure[9]);
                 if ($element_running->in_flow) {
                     $line_color = $black;
                     $shape_image = $imgSprite;
                 } else {
                     $line_color = $gray;
                     $shape_image = $imgSpriteBW;
                 }
                 foreach ($lines as $key => $segment) {
                     // echo '<br>Point'. $key . ': (' . $lines[$key]->x . ', ' . $lines[$key]->y .')';
                     // echo '<br>Point'. ($key + 1) . ': (' . $lines[$key+1]->x . ', ' . $lines[$key+1]->y .')';
                     if (isset($lines[$key + 1]) && $lines[$key + 1]->x != '' && $lines[$key + 1]->y != '') {
                         if ($figure[2] == 'MESSAGE' || $figure[2] == 'ASSOCIATION' || $figure[2] == 'DATAASSOCIATION') {
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:67,代码来源:PMSEImageGenerator.php

示例14: line

 public function line(array $settings) : InternalGD
 {
     $x1 = isset($settings['x1']) ? $settings['x1'] : 0;
     $y1 = isset($settings['y1']) ? $settings['y1'] : 0;
     $x2 = isset($settings['x2']) ? $settings['x2'] : 0;
     $y2 = isset($settings['y2']) ? $settings['y2'] : 0;
     $rgb = isset($settings['color']) ? $settings['color'] : '0|0|0';
     $type = isset($settings['type']) ? $settings['type'] : 'solid';
     $type = strtolower($type);
     if ($type === 'solid') {
         imageline($this->canvas, $x1, $y1, $x2, $y2, $this->allocate($rgb));
     } elseif ($type === 'dashed') {
         imagedashedline($this->canvas, $x1, $y1, $x2, $y2, $this->allocate($rgb));
     }
     return $this;
 }
开发者ID:znframework,项目名称:znframework,代码行数:16,代码来源:InternalGD.php

示例15: make_linkFN

function make_linkFN($children_ha, $im_dest, $position_node)
{
    $background_R = $GLOBALS['background_R'];
    $background_G = $GLOBALS['background_G'];
    $background_B = $GLOBALS['background_B'];
    $foreground_R = $GLOBALS['foreground_R'];
    $foreground_G = $GLOBALS['foreground_R'];
    $foreground_B = $GLOBALS['foreground_R '];
    $root_dir = $GLOBALS['root_dir'];
    $layout_template = $GLOBALS['layout_template'];
    $duplicate_dir_structure = $GLOBALS['duplicate_dir_structure'];
    $family = $GLOBALS['family'];
    $debug = $GLOBALS['debug'];
    $src_x = 0;
    $src_y = 0;
    $text_color = ImageColorAllocate($im_dest, $foreground_R, $foreground_G, $foreground_B);
    $node_from_found = 0;
    $node_to_found = 0;
    foreach ($children_ha as $child) {
        $id_node_from = $child['id_child'];
        $linked = $child['linked'];
        if (!empty($linked)) {
            foreach ($linked as $link) {
                $id_node_to = $link['id_node_to'];
                mydebug(__LINE__, __FILE__, array('id_node_to' => $id_node_to, 'id_node_from' => $id_node_from));
                foreach ($position_node as $pos) {
                    $id_node = $pos['id_node'];
                    mydebug(__LINE__, __FILE__, array('id_node_from' => $id_node_from, 'id_node_to' => $id_node_to, 'id_node' => $id_node, 'trovato' => $node_from_found));
                    if ($id_node == $id_node_from and !$node_from_found) {
                        // get position of node from
                        mydebug(__LINE__, __FILE__, $id_node);
                        $bounds = $pos['bounds'];
                        $bounds = explode(",", $bounds);
                        $xa1 = $bounds[0];
                        $ya1 = $bounds[1];
                        // left top corner
                        $xa4 = $bounds[2];
                        $ya4 = $bounds[3];
                        // right bottom corner
                        $xa2 = $xa4;
                        $ya2 = $ya1;
                        // right top corner
                        $xa3 = $xa1;
                        $ya3 = $ya4;
                        // left bottom corner
                        $node_from_found = 1;
                    } elseif ($id_node == $id_node_to and !$node_to_found) {
                        // get position of node to
                        $node_to_found = 1;
                        $bounds = $pos['bounds'];
                        $bounds = explode(",", $bounds);
                        $xb1 = $bounds[0];
                        $yb1 = $bounds[1];
                        // left top corner
                        $xb4 = $bounds[2];
                        $yb4 = $bounds[3];
                        // right bottom corner
                        $xb2 = $xb4;
                        $yb2 = $yb1;
                        // right top corner
                        $xb3 = $xb1;
                        $yb3 = $yb4;
                        // left bottom corner
                    }
                }
                if ($node_from_found and $node_to_found) {
                    $node_from_found = 0;
                    $node_to_found = 0;
                    // Calcola la distanza tra i punti
                    $min_dist = 10000;
                    $min_array = 0;
                    $distanza_ar = array();
                    $coordinate_ar = array();
                    for ($i = 1; $i <= 4; $i++) {
                        $XA = "xa" . $i;
                        $YA = "ya" . $i;
                        for ($o = 1; $o <= 4; $o++) {
                            $XB = "xb" . $o;
                            $YB = "yb" . $o;
                            $distanza_ar[] = round(sqrt(abs(pow(${$XA} - ${$XB}, 2) + pow(${$YA} - ${$YB}, 2))));
                            $coordinate_ar[] = ${$XA} . "," . ${$YA} . "," . ${$XB} . "," . ${$YB};
                        }
                    }
                    for ($i = 0; $i <= 15; $i++) {
                        if ($distanza_ar[$i] < $min_dist) {
                            $min_array = $i;
                            $min_dist = $distanza_ar[$i];
                            # echo "Minore = $min_array, distanza Minore = $min_dist <BR>";
                        }
                    }
                    $coordinate = $coordinate_ar[$min_array];
                    $coord_final = explode(",", $coordinate);
                    # echo "$coordinate<BR><BR>";
                    $x_from = $coord_final[0];
                    $y_from = $coord_final[1];
                    $x_to = $coord_final[2];
                    $y_to = $coord_final[3];
                    imagedashedline($im_dest, $x_from, $y_from, $x_to, $y_to, $text_color);
                }
            }
//.........这里部分代码省略.........
开发者ID:eguicciardi,项目名称:ada,代码行数:101,代码来源:graph_map.inc.php


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