Ejemplo n.º 1
0
	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;
	    }

	}
Ejemplo n.º 2
0
/**
 * 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);
    }
}
Ejemplo n.º 3
0
 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;
     }
 }
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);
    }
}
Ejemplo n.º 5
0
 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;
 }
function imageSmoothArcDrawSegment(&$img, $cx, $cy, $a, $b, $aaAngleX, $aaAngleY, $color, $start, $stop, $seg)
{
    // Originally written from scratch by Ulrich Mierendorff, 06/2006
    // Rewritten and improved, 04/2007, 07/2007
    // Please do not use THIS function directly. Scroll down to imageSmoothArc(...).
    $fillColor = imageColorExactAlpha($img, $color[0], $color[1], $color[2], $color[3]);
    $xStart = abs($a * cos($start));
    $yStart = abs($b * sin($start));
    $xStop = abs($a * cos($stop));
    $yStop = abs($b * sin($stop));
    $dxStart = 0;
    $dyStart = 0;
    $dxStop = 0;
    $dyStop = 0;
    if ($xStart != 0) {
        $dyStart = $yStart / $xStart;
    }
    if ($xStop != 0) {
        $dyStop = $yStop / $xStop;
    }
    if ($yStart != 0) {
        $dxStart = $xStart / $yStart;
    }
    if ($yStop != 0) {
        $dxStop = $xStop / $yStop;
    }
    if (abs($xStart) >= abs($yStart)) {
        $aaStartX = true;
    } else {
        $aaStartX = false;
    }
    if ($xStop >= $yStop) {
        $aaStopX = true;
    } else {
        $aaStopX = false;
    }
    //$xp = +1; $yp = -1; $xa = +1; $ya = 0;
    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 );*/
        $_y1 = $dyStop * $x;
        $_y2 = $dyStart * $x;
        if ($xStart > $xStop) {
            $error1 = $_y1 - (int) $_y1;
            $error2 = 1 - $_y2 + (int) $_y2;
            $_y1 = $_y1 - $error1;
            $_y2 = $_y2 + $error2;
        } else {
            $error1 = 1 - $_y1 + (int) $_y1;
            $error2 = $_y2 - (int) $_y2;
            $_y1 = $_y1 + $error1;
            $_y2 = $_y2 - $error2;
        }
        /*
        if ($aaStopX)
            $diffColor1 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error1 );
        if ($aaStartX)
            $diffColor2 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error2 );
        */
        if ($seg == 0 || $seg == 2) {
            $i = $seg;
            if (!($start > $i * M_PI / 2 && $x > $xStart)) {
                if ($i == 0) {
                    $xp = +1;
                    $yp = -1;
                    $xa = +1;
                    $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);
                    }
                }
                if ($stop < ($i + 1) * M_PI / 2 && $x <= $xStop) {
                    $diffColor1 = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127 - (127 - $color[3]) * $error1);
                    $y2 = $_y1;
                    if ($aaStopX) {
                        imageSetPixel($img, $cx + $xp * $x + $xa, $cy + $yp * ($y2 - 1) + $ya, $diffColor1);
                    }
                } 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);
                }
            }
        }
    }
    ///YYYYY
    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 );
          */
        $_x1 = $dxStop * $y;
        $_x2 = $dxStart * $y;
        if ($yStart > $yStop) {
            $error1 = $_x1 - (int) $_x1;
            $error2 = 1 - $_x2 + (int) $_x2;
            $_x1 = $_x1 - $error1;
            $_x2 = $_x2 + $error2;
        } else {
            $error1 = 1 - $_x1 + (int) $_x1;
            $error2 = $_x2 - (int) $_x2;
            $_x1 = $_x1 + $error1;
            $_x2 = $_x2 - $error2;
        }
        /*
                if (!$aaStopX)
                    $diffColor1 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error1 );
                if (!$aaStartX)
                    $diffColor2 = imageColorExactAlpha( $img, $color[0], $color[1], $color[2], 127-(127-$color[3])*$error2 );
        */
        if ($seg == 0 || $seg == 2) {
            $i = $seg;
            if (!($start > $i * M_PI / 2 && $y > $yStop)) {
                if ($i == 0) {
                    $xp = +1;
                    $yp = -1;
                    $xa = 1;
                    $ya = 0;
                } else {
                    $xp = -1;
                    $yp = +1;
                    $xa = 0;
                    $ya = 1;
                }
                if ($stop < ($i + 1) * (M_PI / 2) && $y <= $yStop) {
                    $diffColor1 = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127 - (127 - $color[3]) * $error1);
                    $x1 = $_x1;
                    if (!$aaStopX) {
                        imageSetPixel($img, $cx + $xp * ($x1 - 1) + $xa, $cy + $yp * $y + $ya, $diffColor1);
                    }
                }
                if ($start > $i * M_PI / 2 && $y < $yStart) {
                    $diffColor2 = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127 - (127 - $color[3]) * $error2);
                    $x2 = $_x2;
                    if (!$aaStartX) {
                        imageSetPixel($img, $cx + $xp * ($x2 + 1) + $xa, $cy + $yp * $y + $ya, $diffColor2);
                    }
                } else {
                    $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);
                    $x1 = $x;
                    if ($y < $aaAngleY && $y <= $yStop) {
                        imageSetPixel($img, $cx + $xp * ($x1 + 1) + $xa, $cy + $yp * $y + $ya, $diffColor);
                    }
                }
            }
        }
        if ($seg == 1 || $seg == 3) {
            $i = $seg;
            if (!($stop < ($i + 1) * M_PI / 2 && $y > $yStart)) {
                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 && $y < $yStart) {
                    $diffColor2 = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127 - (127 - $color[3]) * $error2);
                    $x1 = $_x2;
                    if (!$aaStartX) {
                        imageSetPixel($img, $cx + $xp * ($x1 - 1) + $xa, $cy + $yp * $y + $ya, $diffColor2);
                    }
                }
                if ($stop < ($i + 1) * M_PI / 2 && $y <= $yStop) {
                    $diffColor1 = imageColorExactAlpha($img, $color[0], $color[1], $color[2], 127 - (127 - $color[3]) * $error1);
                    $x2 = $_x1;
                    if (!$aaStopX) {
                        imageSetPixel($img, $cx + $xp * ($x2 + 1) + $xa, $cy + $yp * $y + $ya, $diffColor1);
                    }
                } else {
                    $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);
                    $x1 = $x;
                    if ($y < $aaAngleY && $y < $yStart) {
                        imageSetPixel($img, $cx + $xp * ($x1 + 1) + $xa, $cy + $yp * $y + $ya, $diffColor);
                    }
                }
            }
        }
    }
}
Ejemplo n.º 7
0
 /**
  * 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);
 }
Ejemplo n.º 8
0
 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);
 }
Ejemplo n.º 9
0
            //$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");
/* Создание изображения */
// $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");
Ejemplo n.º 11
0
        }
        $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 {
Ejemplo n.º 12
0
    /**
     * 	Функция генерирует и выводит хидер 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);
    }
Ejemplo n.º 13
0
 protected function drawElement(&$data, $from, $to, $minX, $maxX, $minY, $maxY, $drawtype, $max_color, $avg_color, $min_color, $minmax_color, $calc_fnc, $axisside)
 {
     if (!isset($data['max'][$from]) || !isset($data['max'][$to])) {
         return;
     }
     $oxy = $this->oxy[$axisside];
     $zero = $this->zero[$axisside];
     $unit2px = $this->unit2px[$axisside];
     $shift_min_from = $shift_min_to = 0;
     $shift_max_from = $shift_max_to = 0;
     $shift_avg_from = $shift_avg_to = 0;
     if (isset($data['shift_min'][$from])) {
         $shift_min_from = $data['shift_min'][$from];
     }
     if (isset($data['shift_min'][$to])) {
         $shift_min_to = $data['shift_min'][$to];
     }
     if (isset($data['shift_max'][$from])) {
         $shift_max_from = $data['shift_max'][$from];
     }
     if (isset($data['shift_max'][$to])) {
         $shift_max_to = $data['shift_max'][$to];
     }
     if (isset($data['shift_avg'][$from])) {
         $shift_avg_from = $data['shift_avg'][$from];
     }
     if (isset($data['shift_avg'][$to])) {
         $shift_avg_to = $data['shift_avg'][$to];
     }
     $min_from = $data['min'][$from] + $shift_min_from;
     $min_to = $data['min'][$to] + $shift_min_to;
     $max_from = $data['max'][$from] + $shift_max_from;
     $max_to = $data['max'][$to] + $shift_max_to;
     $avg_from = $data['avg'][$from] + $shift_avg_from;
     $avg_to = $data['avg'][$to] + $shift_avg_to;
     $x1 = $from + $this->shiftXleft - 1;
     $x2 = $to + $this->shiftXleft;
     $y1min = $zero - ($min_from - $oxy) / $unit2px;
     $y2min = $zero - ($min_to - $oxy) / $unit2px;
     $y1max = $zero - ($max_from - $oxy) / $unit2px;
     $y2max = $zero - ($max_to - $oxy) / $unit2px;
     $y1avg = $zero - ($avg_from - $oxy) / $unit2px;
     $y2avg = $zero - ($avg_to - $oxy) / $unit2px;
     switch ($calc_fnc) {
         case CALC_FNC_MAX:
             $y1 = $y1max;
             $y2 = $y2max;
             $shift_from = $shift_max_from;
             $shift_to = $shift_max_to;
             break;
         case CALC_FNC_MIN:
             $y1 = $y1min;
             $y2 = $y2min;
             $shift_from = $shift_min_from;
             $shift_to = $shift_min_to;
             break;
         case CALC_FNC_ALL:
             // max
             $y1x = $y1max > $this->sizeY + $this->shiftY || $y1max < $this->shiftY;
             $y2x = $y2max > $this->sizeY + $this->shiftY || $y2max < $this->shiftY;
             if ($y1x) {
                 $y1max = $y1max > $this->sizeY + $this->shiftY ? $this->sizeY + $this->shiftY : $this->shiftY;
             }
             if ($y2x) {
                 $y2max = $y2max > $this->sizeY + $this->shiftY ? $this->sizeY + $this->shiftY : $this->shiftY;
             }
             // min
             $y1n = $y1min > $this->sizeY + $this->shiftY || $y1min < $this->shiftY;
             $y2n = $y2min > $this->sizeY + $this->shiftY || $y2min < $this->shiftY;
             if ($y1n) {
                 $y1min = $y1min > $this->sizeY + $this->shiftY ? $this->sizeY + $this->shiftY : $this->shiftY;
             }
             if ($y2n) {
                 $y2min = $y2min > $this->sizeY + $this->shiftY ? $this->sizeY + $this->shiftY : $this->shiftY;
             }
             $a[0] = $x1;
             $a[1] = $y1max;
             $a[2] = $x1;
             $a[3] = $y1min;
             $a[4] = $x2;
             $a[5] = $y2min;
             $a[6] = $x2;
             $a[7] = $y2max;
             // don't use break, avg must be drawed in this statement
         // don't use break, avg must be drawed in this statement
         case CALC_FNC_AVG:
             // don't use break, avg must be drawed in this statement
         // don't use break, avg must be drawed in this statement
         default:
             $y1 = $y1avg;
             $y2 = $y2avg;
             $shift_from = $shift_avg_from;
             $shift_to = $shift_avg_to;
     }
     $shift_from -= $shift_from != 0 ? $oxy : 0;
     $shift_to -= $shift_to != 0 ? $oxy : 0;
     $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;
     }
 }
Ejemplo n.º 14
0
 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);
 }
 public function buildLegRight()
 {
     imageLine($this->img, 170, 190, 170, 250, 5);
 }
<?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);
Ejemplo n.º 17
0
    /* 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);
Ejemplo n.º 18
0
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);
    }
}
Ejemplo n.º 19
0
						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");
							writinfo('/tmp/infos_graphe.txt','a+',"\$tab_y[$i+1]=".$tab_y[$i+1]."\n");
						}
						elseif(($afficher_pointille!='n')&&(isset($tab_y[$i]))&&($tab_y[$i]!="")&&(isset($tab_y[$i+2]))&&($tab_y[$i+2]!="")) {
							writinfo('/tmp/infos_graphe.txt','a+',"\nUne ligne pointillée\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+2]=".$tab_x[$i+2]."\n");
							writinfo('/tmp/infos_graphe.txt','a+',"\$tab_y[$i+2]=".$tab_y[$i+2]."\n");
							imagesetstyle($img, $style_pointille);
							imageLine($img,$tab_x[$i],$tab_y[$i],$tab_x[$i+2],$tab_y[$i+2],IMG_COLOR_STYLED);
							imagesetstyle($img, $style_plein);
							//imageLine($img,$tab_x[$i],$tab_y[$i],$tab_x[$i+2],$tab_y[$i+2],$couleureleve[$k]);
						}
					}
				}
			}
		}
	}
	//=================================


	//=================================
	// Légendes Matières:
	if(getSettingValue('graphe_star_txt')=='old_way') {
		for($i=0;$i<count($tab20)/2;$i++){
Ejemplo n.º 20
0
 /**
  * Function: drawActor
  *
  * Draws then given cloud.
  */
 function drawActor($x, $y, $w, $h, $fill = null, $stroke = null, $shadow = false)
 {
     if (isset($fill)) {
         if ($shadow) {
             $dx = mxConstants::$SHADOW_OFFSETX;
             $dy = mxConstants::$SHADOW_OFFSETY;
             imageFilledEllipse($this->image, $x + 0.5 * $w + $dx, $y + 0.2 * $h + $dy, 0.4 * $w, 0.4 * $h, $this->shadowColor);
             imageFilledEllipse($this->image, $x + 0.2 * $w + $dx, $y + 0.6 * $h + $dy, 0.4 * $w, 0.4 * $h, $this->shadowColor);
             imageFilledEllipse($this->image, $x + 0.8 * $w + $dx, $y + 0.6 * $h + $dy, 0.4 * $w, 0.4 * $h, $this->shadowColor);
             imageFilledRectangle($this->image, $x + 0.2 * $w + $dx, $y + 0.4 * $h + $dy, $x + 0.8 * $w + $dx, $y + 0.6 * $h + $dy, $this->shadowColor);
             imageFilledRectangle($this->image, $x + $dx, $y + 0.6 * $h + $dy, $x + $w + $dx, $y + $h + $dy, $this->shadowColor);
         }
         $fill = $this->getColor($fill);
         imageFilledEllipse($this->image, $x + 0.5 * $w, $y + 0.2 * $h, 0.4 * $w, 0.4 * $h, $fill);
         imageFilledEllipse($this->image, $x + 0.2 * $w, $y + 0.6 * $h, 0.4 * $w, 0.4 * $h, $fill);
         imageFilledEllipse($this->image, $x + 0.8 * $w, $y + 0.6 * $h, 0.4 * $w, 0.4 * $h, $fill);
         imageFilledRectangle($this->image, $x + 0.2 * $w, $y + 0.4 * $h, $x + 0.8 * $w, $y + 0.6 * $h, $fill);
         imageFilledRectangle($this->image, $x, $y + 0.6 * $h, $x + $w, $y + $h, $fill);
     }
     if ($stroke != null) {
         $stroke = $this->getColor($stroke);
         imageEllipse($this->image, $x + 0.5 * $w, $y + 0.2 * $h, 0.4 * $w, 0.4 * $h, $stroke);
         imageLine($this->image, $x + 0.2 * $w, $y + 0.4 * $h, $x + 0.8 * $w, $y + 0.4 * $h, $stroke);
         imageArc($this->image, $x + 0.2 * $w, $y + 0.6 * $h, 0.4 * $w, 0.4 * $h, 180, 270, $stroke);
         imageArc($this->image, $x + 0.8 * $w, $y + 0.6 * $h, 0.4 * $w, 0.4 * $h, 270, 360, $stroke);
         imageLine($this->image, $x, $y + 0.6 * $h, $x, $y + $h, $stroke);
         imageLine($this->image, $x, $y + $h, $x + $w, $y + $h, $stroke);
         imageLine($this->image, $x + $w, $y + $h, $x + $w, $y + 0.6 * $h, $stroke);
     }
 }
Ejemplo n.º 21
0
// Epaisseur initiale des traits...
imagesetthickness($img,2);

$x1=0;
$x2=$dim_photo+30;

$y1=0;
$y2=$dim_photo+30;

$couleur_fond=imageColorAllocate($img,255,255,255);
//imagecolorallocatealpha($img, 255, 255, 255, 127);

$couleur_trait=imageColorAllocate($img,0,0,0);
imageLine($img,$x1,$y1,$x2,$y1,$couleur_trait);
imageLine($img,$x1,$y1,$x1,$y2,$couleur_trait);

$chemin_img_fond="../temp/".get_user_temp_directory()."/fond_plan_classe.png";
imagePNG($img, $chemin_img_fond);

imageDestroy($img);
//================================

echo "<form action='".$_SERVER['PHP_SELF']."' name='form_reg_pos' method='post'>\n";
echo "<div style='float:right; width:40px;'>\n";
	echo "<div style='position:relative; top:18px; left:0px;'>\n";
	echo "<a href='javascript:decale_photos(-10,0)' title='Décaler les photos vers la gauche'>";
	echo "<img src='../images/arrow_left.png' width='18' height='18' />";
	echo "</a>";
	echo "</div\n>";
Ejemplo n.º 22
0
function skygrid($im, $sz, $C)
{
    for ($i = 0; $i < 180; $i += 15) {
        list($x0, $y0, $x1, $y1) = radial($i, $sz);
        imageLine($im, $x0, $y0, $x1, $y1, $C['ltgray']);
    }
    for ($i = 15; $i < 90; $i += 15) {
        elevation($im, $sz, $C, $i);
    }
}
Ejemplo n.º 23
0
$x2 = $x1 - 3;
$y1_hits = (int) ($image - $image * $per_hit[0] + 7);
$y1_host = (int) ($image - $image * $per_host[0] + 7);
$counth = count($hits_data);
if ($counth > 31) {
    $counth = 31;
}
for ($i = 1; $i < $counth; $i++) {
    // хиты
    $y2_hits = (int) ($image - $image * $per_hit[$i] + 7);
    imageLine($img, $x1, $y1_hits, $x2, $y2_hits, $color1);
    // хосты
    $y2_host = (int) ($image - $image * $per_host[$i] + 7);
    imageLine($img, $x1, $y1_host, $x2, $y2_host, $color2);
    if ($hits_data[$i] != 0 && $i == $max_index) {
        imageTTFtext($img, 6, 0, $x2 - 17, $y2_hits - 3, $color_red, BASEDIR . "gallery/font/font.ttf", "max");
        imageTTFtext($img, 6, 0, $x2 + 2, $y2_hits - 3, $color2, BASEDIR . "gallery/font/font.ttf", $hits_data[$i]);
        /* 
        ImageString($img, 1, $x2-17,  $y2_hits-10, "max", $color_red);
        ImageString($img, 1, $x2+2,  $y2_hits-10, $hits_data[$i], $color2);
        */
        imageLine($img, $x2 - 1, $y2_hits - 7, $x2 - 1, $y2_hits + 42, $color_red);
    }
    $y1_hits = $y2_hits;
    $y1_host = $y2_host;
    $x1 -= $coll;
    $x2 -= $coll;
}
Header("Content-type: image/gif");
ImageGIF($img);
ImageDestroy($img);
Ejemplo n.º 24
0
    $max_rgb = max($m) / 150;
    $im_out = imageCreate(284, 164);
    $background = imageColorAllocate($im_out, 100, 100, 110);
    $box_fill = imageColorAllocate($im_out, 130, 130, 140);
    $white = ImageColorAllocate($im_out, 240, 240, 240);
    $black = ImageColorAllocate($im_out, 20, 20, 20);
    $grey = ImageColorAllocate($im_out, 200, 200, 200);
    $red = ImageColorAllocate($im_out, 255, 0, 0);
    $green = ImageColorAllocate($im_out, 0, 200, 0);
    $blue = ImageColorAllocate($im_out, 0, 0, 255);
    $ry = 107;
    $gy = 107;
    $by = 107;
    imageFilledRectangle($im_out, 13, 6, 270, 158, $box_fill);
    for ($i = 0; $i < 256; $i++) {
        imageLine($im_out, $i + 14, 157, $i + 14, 157 - $max[$i] / $max_value, $white);
        imageLine($im_out, $i + 13, $ry, $i + 14, 157 - $r[$i] / $max_rgb, $red);
        imageLine($im_out, $i + 13, $gy, $i + 14, 157 - $g[$i] / $max_rgb, $green);
        imageLine($im_out, $i + 13, $by, $i + 14, 157 - $b[$i] / $max_rgb, $blue);
        $ry = 157 - $r[$i] / $max_rgb;
        $gy = 157 - $g[$i] / $max_rgb;
        $by = 157 - $b[$i] / $max_rgb;
    }
    imagePNG($im_out, 'plugins/enlargeit/histcache/' . $pid . $enl_histfile);
    imageDestroy($im);
    imagedestroy($im_out);
    $im = imagecreatefromPNG('plugins/enlargeit/histcache/' . $pid . $enl_histfile);
    imagedestroy($im);
    header('Content-type: image/png');
    readfile('plugins/enlargeit/histcache/' . $pid . $enl_histfile);
}
Ejemplo n.º 25
0
    imageString($im, 5, $dx + $gxb + 2 * $ticW, $i - $labelH, sprintf("%3.1f", $wnd), $blue);
    //}
    $wnd -= $dwnd;
    if ($wnd < 0) {
        $wnd = -$wnd;
    }
}
/* draw the wind direction graph */
$scale = $gyb / 360;
/* wind direction can only go from 0 to 360 degrees */
for ($i = 0; $i + 1 < $row_count; $i++) {
    $x1 = $i * $gxb / $row_count + $dx;
    $y1 = $gyb + $dy - $windd[$i] * $scale;
    $x2 = ($i + 1) * $gxb / $row_count + $dx;
    $y2 = $gyb + $dy - $windd[$i + 1] * $scale;
    imageLine($im, $x1, $y1, $x2, $y2, $red);
}
/* draw the wind speed graph */
$scale = $gyb / ($wnds_max - $wnds_min);
for ($i = 0; $i + 1 < $row_count; $i++) {
    $x1 = $i * $gxb / $row_count + $dx;
    $y1 = $gyb + $dy - ($winds[$i] - $wnds_min) * $scale;
    $x2 = ($i + 1) * $gxb / $row_count + $dx;
    $y2 = $gyb + $dy - ($winds[$i + 1] - $wnds_min) * $scale;
    imageLine($im, $x1, $y1, $x2, $y2, $blue);
}
/* use gif as the image format */
header("Content-type: image/gif");
imageGIF($im);
/* lastly delete the image from memory */
imageDestroy($im);
Ejemplo n.º 26
0
require_once "unicode.php";
$i = imageCreate(400, 400);
//Функция imageCreate() - создает новое палитровое изображение  возвращает идентификатор изображения(1-ширина изо, 2- высота изо)
$color = imageColorAllocate($i, 0, 255, 0);
imageFilledRectangle($i, 0, 0, imageSX($i), imageSY($i), $color);
//Функция imageFilledRectangle() - рисование закрашенного прямоугольника (1-ресурс изображения, 2 - х-координата точки 1, 3 - у-координата точки 1, 4 - х-координата точки 2, 5 - у-координата точки 2, 6 - цвет заливки)
$color = imageColorAllocate($i, 255, 0, 0);
imageRectangle($i, 100, 100, 200, 200, $color);
//Функция imageRectangle() - рисование прямоугольника (1-ресурс изображения, 2 - х-координата точки 1, 3 - у-координата точки 1, 4 - х-координата точки 2, 5 - у-координата точки 2, 6 - цвет бордера)
imageSetThickness($i, 10);
//Функция imageSetThickness() - задает толщину линии(1-ресурс изображения, 2-толщина линии)
$color = imageColorAllocate($i, 0, 0, 255);
imageRectangle($i, 50, 80, 150, 150, $color);
imageSetThickness($i, 3);
$color = imageColorAllocate($i, 255, 255, 0);
imageLine($i, 10, 10, 350, 250, $color);
//Функция imageLine() - рисует линию по двум точкам (1-ресурс изображения, 2 - х-координата точки 1, 3 - у-координата точки 1, 4 - х-координата точки 2, 5 - у-координата точки 2, 6 - цвет бордера)
$color = imageColorAllocate($i, 255, 255, 255);
imageArc($i, 300, 100, 150, 150, 0, 0, $color);
//Функция imagearc() - рисует окружность дуги с заданными координатами центра, дуга рисуется по часовой стрелке (1-ресурс изображения, 2 - х-координата центра, 3 - у-координата центра, 4 - ширина дуги, 5 - высота дуги, 6 - угол начала дуги в градусах, 7 - угол окончания дуги в градусах, 8 - цвет дуги )
//Функция imagefilledarc() - рисует и заливает окружность дуги с заданными координатами центра, дуга рисуется по часовой стрелке (1-ресурс изображения, 2 - х-координата центра, 3 - у-координата центра, 4 - ширина дуги, 5 - высота дуги, 6 - угол начала дуги в градусах, 7 - угол окончания дуги в градусах, 8 - цвет дуги )
$color = imageColorAllocate($i, 0, 255, 255);
imagefill($i, 130, 130, $color);
//Функция imagefill() - производит заливку, начиная с заданных координат точки (1-ресурс изображения, 2 - х-координата точки, 3 - у-координата точки, 4 - цвет заливки, либо можно указать константу заливки IMG_COLOR_TILED)
$im = imagecreatefromgif("images/image.gif");
imagesettile($i, $im);
//Функция imagesettile() - задает изображение, которое будет использовано в качестве элемента мозаичной заливки (1-ресурс изображения который будут заливать, 2- ресурс изображения для использования мозайчной заливки)
imagefill($i, 250, 50, IMG_COLOR_TILED);
$color = imagecolorallocate($i, 0, 0, 0);
imagepolygon($i, array(50, 250, 100, 250, 120, 280, 80, 350, 50, 250), 5, $color);
//Функция imagepolygon() - рисует многоугольник(1-ресурс изображения, 2 - массив координат вершин{array(x1,y1,x2,y2...)}, 3 - количество вершин точнее указанных точек, 4 - цвет бордера)
Ejemplo n.º 27
0
 function draw_grid()
 {
     global $graph_start_date;
     global $graph_completion_date;
     $start_stamp = format_date("U", $graph_start_date);
     $completion_stamp = format_date("U", $graph_completion_date);
     $graph_time_width = $completion_stamp - $start_stamp;
     // 7 Day increment
     $time_increment = mktime(0, 0, 0, 0, TICK_SIZE) - mktime(0, 0, 0, 0, 0);
     if ($time_increment * (MAX_TICKS + 1) < $graph_time_width) {
         $time_increment = mktime(0, 0, 0, 0, LARGE_TICK_SIZE) - mktime(0, 0, 0, 0, 0);
     }
     $current_stamp = $start_stamp;
     while ($current_stamp < $completion_stamp) {
         $x_pos = $this->date_stamp_to_x($current_stamp);
         imageLine($this->image, $x_pos, $this->top_margin - 5, $x_pos, $this->height - $this->bottom_margin, $this->color_grid);
         imagettftext($this->image, ALLOC_FONT_SIZE - 2, 45, $x_pos, $this->top_margin - 7, $this->color_text, ALLOC_FONT, date("M-d", $current_stamp));
         $current_stamp += $time_increment;
     }
     // Horizontal line above tasks
     imageLine($this->image, 0, $this->top_margin, $this->width, $this->top_margin, $this->color_grid);
 }
Ejemplo n.º 28
0
				$x1=$x[$i];
				$x2=$x[$i+1];
				if(($ycourbe[$k][$i]!=-1)&&($ycourbe[$k][$i+1]!=-1)){
					//$x_prec[$y+1]=$x2;
					//$y_prec[$y+1]=$ycourbe[$k][$i+1];
					imageLine($img,$x1,$ycourbe[$k][$i],$x2,$ycourbe[$k][$i+1],$couleureleve[$k]);
				}
				elseif(($afficher_pointille!='n')&&(isset($ycourbe[$k][$i]))&&($ycourbe[$k][$i]!=-1)&&(isset($ycourbe[$k][$i+2]))&&($ycourbe[$k][$i+2]!=-1)) {
					/*
					// imageDashedLine() est bugguée... on peut récupérer des hachures de 8mm de hauteur pour 2mm de large
					imagesetthickness($img,1);
					imageDashedLine($img,$x[$i+2],$ycourbe[$k][$i+2],$x1,$ycourbe[$k][$i],$couleureleve[$k]);
					imagesetthickness($img,$epaisseur);
					*/
					imagesetstyle($img, $style_pointille);
					imageLine($img,$x1,$ycourbe[$k][$i],$x[$i+2],$ycourbe[$k][$i+2],IMG_COLOR_STYLED);
					imagesetstyle($img, $style_plein);
				}
			}
			if($epaisseur_croissante_traits_periodes=='oui') {
				$epaisseur+=1;
			}
		}
	}

	//================================================================



	writinfo('/tmp/infos_graphe.txt','a+',"\nJuste avant imagePNG\n");
Ejemplo n.º 29
0
<?php

$im = imageCreateTrueColor(150, 50);
$color = imageColorAllocate($im, 128, 128, 128);
imageFill($im, 10, 10, $color);
$color = imageColorAllocate($im, 255, 255, 255);
for ($i = 0; $i < 800; $i++) {
    $randW = mt_rand(0, imageSX($im));
    $randH = mt_rand(0, imageSY($im));
    imageSetPixel($im, $randW, $randH, $color);
}
imageSetThickness($im, 2);
$color = imageColorAllocate($im, 100, 100, 100);
imageLine($im, 10, 30, 130, 20, $color);
$color = imageColorAllocate($im, 70, 70, 70);
$n1 = mt_rand(0, 9);
imageTtfText($im, 25, 10, mt_rand(2, 10), mt_rand(25, 45), $color, "times.ttf", $n1);
$color = imageColorAllocate($im, 255, 0, 50);
$str = "ABCDIFGHIJKLMNOPKASTUVWXYZ";
$nw = mt_rand(0, 15);
$n2 = $str[$nw];
imageTtftext($im, 22, -10, mt_rand(25, 35), mt_rand(25, 45), $color, "times.ttf", $n2);
$color = imageColorAllocate($im, 50, 50, 50);
$n3 = mt_rand(0, 9);
imageTtfText($im, 25, 15, mt_rand(60, 70), mt_rand(25, 45), $color, "times.ttf", $n3);
$color = imageColorAllocate($im, 250, 250, 250);
$nw2 = mt_rand(15, 25);
$n4 = $str[$nw2];
imageTtfText($im, 22, 30, mt_rand(90, 100), mt_rand(25, 45), $color, "times.ttf", $n4);
$color = imageColorAllocate($im, 255, 220, 70);
$n5 = mt_rand(0, 9);
Ejemplo n.º 30
0
$string = "";
$letters = array();
$lines = array();
$arcs = array();
$dir = "fonts/";
$image = imagecreatetruecolor(170, 60);
$bg = imagecolorallocate($image, 255, 155, 255);
imagefilledrectangle($image, 0, 0, 170, 60, $bg);
for ($l = 0; $l < 7; $l++) {
    $lines[$l]["x1"] = mt_rand(0, imageSX($image));
    $lines[$l]["y1"] = mt_rand(0, imageSY($image));
    $lines[$l]["x2"] = mt_rand(0, imageSX($image));
    $lines[$l]["y2"] = mt_rand(0, imageSY($image));
    $lines[$l]["color"] = imagecolorallocate($image, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
    imageSetThickness($image, mt_rand(1, 3));
    imageLine($image, $lines[$l]["x1"], $lines[$l]["y1"], $lines[$l]["x2"], $lines[$l]["y2"], $lines[$l]["color"]);
}
for ($a = 0; $a < 7; $a++) {
    $arcs[$a]["x"] = mt_rand(0, imageSX($image));
    $arcs[$a]["y"] = mt_rand(0, imageSY($image));
    $arcs[$a]["width"] = mt_rand(0, imageSX($image));
    $arcs[$a]["height"] = mt_rand(0, imageSY($image));
    $arcs[$a]["u1"] = mt_rand(0, 360);
    $arcs[$a]["u2"] = mt_rand(0, 360);
    $arcs[$a]["color"] = imagecolorallocate($image, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
    imageSetThickness($image, mt_rand(1, 3));
    imageArc($image, $arcs[$a]["x"], $arcs[$a]["y"], $arcs[$a]["width"], $arcs[$a]["height"], $arcs[$a]["u1"], $arcs[$a]["u2"], $arcs[$a]["color"]);
}
for ($p = 0; $p < 999; $p++) {
    $x = mt_rand(0, imageSX($image));
    $y = mt_rand(0, imageSY($image));