Ejemplo n.º 1
0
 /**
  * Draw an ellipse
  *
  * Parameter array:
  * 
  * 'x': int X center point
  * 
  * 'y': int Y center point
  * 
  * 'rx': int X radius
  * 
  * 'ry': int Y radius
  * 
  * 'fill': mixed [optional] The fill color
  * 
  * 'line': mixed [optional] The line color
  * 
  * @param array $params Parameter array
  */
 function ellipse($params)
 {
     $x = $this->_getX($params['x']);
     $y = $this->_getY($params['y']);
     $rx = $this->_getX($params['rx']);
     $ry = $this->_getY($params['ry']);
     $fillColor = isset($params['fill']) ? $params['fill'] : false;
     $lineColor = isset($params['line']) ? $params['line'] : false;
     if (($fill = $this->_getFillStyle($fillColor, $x - $rx, $y - $ry, $x + $rx, $y + $ry)) !== false) {
         ImageFilledEllipse($this->_canvas, $x, $y, $rx * 2, $ry * 2, $fill);
     }
     if (($line = $this->_getLineStyle($lineColor)) !== false) {
         ImageEllipse($this->_canvas, $x, $y, $rx * 2, $ry * 2, $line);
     }
     parent::ellipse($params);
 }
Ejemplo n.º 2
0
function drawTimerEvent($im, $x1, $y1, $h)
{
    $blue = imagecolorallocate($im, 160, 160, 180);
    $red = imagecolorallocate($im, 200, 100, 0);
    $gray = imagecolorallocate($im, 100, 100, 100);
    $black = imagecolorallocate($im, 0, 0, 0);
    $yellow = imagecolorallocate($im, 240, 240, 220);
    for ($i = $y1 + 15; $i < $h; $i += 2) {
        imageline($im, $x1, $i, $x1, $i, $gray);
    }
    ImageEllipse($im, $x1, $y1, 26, 26, $black);
    ImageEllipse($im, $x1, $y1, 22, 22, $black);
    ImageFilledEllipse($im, $x1, $y1, 16, 16, $yellow);
    ImageEllipse($im, $x1, $y1, 16, 16, $red);
    imageline($im, $x1, $y1 - 8, $x1, $y1 + 8, $red);
    //imageline($im, $x1  , $y1+8 , $x1, $y1+6,  $red);
    imageline($im, $x1 - 8, $y1, $x1 + 8, $y1, $red);
    imageline($im, $x1 - 7, $y1 - 4, $x1 + 7, $y1 + 4, $red);
    imageline($im, $x1 - 4, $y1 - 7, $x1 + 4, $y1 + 7, $red);
    imageline($im, $x1 + 7, $y1 - 4, $x1 - 7, $y1 + 4, $red);
    imageline($im, $x1 + 4, $y1 - 7, $x1 - 4, $y1 + 7, $red);
    ImageFilledEllipse($im, $x1, $y1, 10, 10, $yellow);
    imageline($im, $x1 - 1, $y1 + 1, $x1 + 1, $y1 - 5, $red);
    imageline($im, $x1 - 1, $y1 + 1, $x1 + 3, $y1 + 1, $red);
}
Ejemplo n.º 3
0
<?php

ImageEllipse($image, $x, $y, $diameter, $diameter, $color);
Ejemplo n.º 4
0
imagedestroy($img_logo);
// dessin du soleil
$font_ttf = $global['FONT_PATH'];
ImageTTFText($im, 8, 0, 3, 15, $txt_color, $font_ttf, 'HELIO features catalog/Paris Observatory');
$date_iso = str_replace(' ', 'T', $date);
ImageTTFText($im, 10, 0, 3, 35, $txt_color, $font_ttf, $date_iso);
ImageTTFText($im, 8, 0, 3, 50, $txt_color, $font_ttf, "Rotation " . $numrot);
ImageTTFText($im, 8, 0, 3, 65, $txt_color, $font_ttf, "P0:" . round(rad2deg($po)) . "°");
// Adds code detection name
if (count($rs['CODE'])) {
    ImageTTFText($im, 8, 0, 3, 80, $txt_color, $font_ttf, $rs['CODE'][0]);
}
if ($with_obs) {
    ImageTTFText($im, 8, 0, 10, $sizeY - 20, $txt_color, $font_ttf, $msg);
}
ImageEllipse($im, $xc, $sizeY - $yc, 2 * $rs['R_SUN'][0] * $zoom, 2 * $rs['R_SUN'][0] * $zoom, $txt_color);
// dessin des axes
$c_blue = ImageColorAllocate($im, 0, 0, 255);
$c_white = ImageColorAllocate($im, 255, 255, 255);
$style = array($c_blue, $c_blue, $c_blue, $c_blue, $c_blue, $c_white, $c_white, $c_white, $c_white, $c_white);
imagesetstyle($im, $style);
ImageLine($im, 0, $sizeY - $yc, $sizeX, $sizeY - $yc, IMG_COLOR_STYLED);
ImageLine($im, $xc, 0, $xc, $sizeY, IMG_COLOR_STYLED);
// encadrement
ImageRectangle($im, 0, 0, $sizeX - 1, $sizeY - 1, $txt_color);
if (isset($rs['ID_CORONALHOLES'])) {
    //$max_intensity = min($rs['CH_MEAN2QSUN']);
    //$min_intensity = max($rs['CH_MEAN2QSUN']);
    $max_intensity = min($rs['FEAT_MEAN2QSUN']);
    $min_intensity = max($rs['FEAT_MEAN2QSUN']);
    foreach ($rs['ID_CORONALHOLES'] as $key => $id_ch) {
Ejemplo n.º 5
0
 function OutputCAPTCHA()
 {
     @session_start();
     // 隨機生成明碼、暗碼
     $byteTable = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
     // 明碼定義陣列
     $LCode = '';
     // 明碼
     for ($i = 0; $i < $this->CAPTCHA_LENGTH; $i++) {
         $LCode .= $byteTable[rand(0, count($byteTable) - 1)];
     }
     // 隨機抽碼
     $DCode = md5($LCode);
     // 暗碼 (明碼的MD5)
     $_SESSION['captcha_dcode'] = $DCode;
     // 暗碼存入 Session
     // 生成暫存圖像
     $captcha = ImageCreateTrueColor($this->CAPTCHA_WIDTH, $this->CAPTCHA_HEIGHT);
     $randcolR = rand(100, 230);
     $randcolG = rand(100, 230);
     $randcolB = rand(100, 230);
     // 隨機色碼值
     $backColor = ImageColorAllocate($captcha, $randcolR, $randcolG, $randcolB);
     // 背景色
     ImageFill($captcha, 0, 0, $backColor);
     // 填入背景色
     $txtColor = ImageColorAllocate($captcha, $randcolR - 40, $randcolG - 40, $randcolB - 40);
     // 文字色
     $rndFontCount = count($this->CAPTCHA_FONTFACE);
     // 隨機字型數目
     // 打入文字
     for ($p = 0; $p < $this->CAPTCHA_LENGTH; $p++) {
         if ($this->CAPTCHA_FONTMETHOD) {
             // TrueType 字型
             // 設定旋轉角度 (左旋或右旋)
             if (rand(1, 2) == 1) {
                 $degree = rand(0, 25);
             } else {
                 $degree = rand(335, 360);
             }
             // 圖層, 字型大小, 旋轉角度, X軸, Y軸 (字左下方起算), 字色, 字型, 印出文字
             ImageTTFText($captcha, rand(14, 16), $degree, ($p + 1) * $this->CAPTCHA_GAP, $this->CAPTCHA_TEXTY, $txtColor, $this->CAPTCHA_FONTFACE[rand(0, $rndFontCount - 1)], substr($LCode, $p, 1));
         } else {
             // GDF 字型
             $font = ImageLoadFont($this->CAPTCHA_FONTFACE[rand(0, $rndFontCount - 1)]);
             // 圖層, 字型, X軸, Y軸 (字左上方起算), 印出文字, 字色
             ImageString($captcha, $font, ($p + 1) * $this->CAPTCHA_GAP, $this->CAPTCHA_TEXTY - 18, substr($LCode, $p, 1), $txtColor);
         }
     }
     // 混淆用 (畫橢圓)
     for ($n = 0; $n < $this->CAPTCHA_ECOUNT; $n++) {
         ImageEllipse($captcha, rand(1, $this->CAPTCHA_WIDTH), rand(1, $this->CAPTCHA_HEIGHT), rand(50, 100), rand(12, 25), $txtColor);
         ImageEllipse($captcha, rand(1, $this->CAPTCHA_WIDTH), rand(1, $this->CAPTCHA_HEIGHT), rand(50, 100), rand(12, 25), $backColor);
     }
     // 輸出圖像
     header('Content-Type: image/png');
     header('Cache-Control: no-cache');
     ImagePNG($captcha);
     ImageDestroy($captcha);
 }
Ejemplo n.º 6
0
function dessine_viseur($couleur)
{
    global $image;
    // Trait sur le cercle
    // en haut à gauche du cercle
    ImageLine($image, D + TAILLE_MAP / 2 - 25, D + TAILLE_MAP / 2 - 25, D + TAILLE_MAP / 2 - 18, D + TAILLE_MAP / 2 - 18, $couleur);
    // en bas à droite du cercle
    ImageLine($image, D + TAILLE_MAP / 2 + 25, D + TAILLE_MAP / 2 + 25, D + TAILLE_MAP / 2 + 18, D + TAILLE_MAP / 2 + 18, $couleur);
    // en haut à droite du cercle
    ImageLine($image, D + TAILLE_MAP / 2 + 25, D + TAILLE_MAP / 2 - 25, D + TAILLE_MAP / 2 + 18, D + TAILLE_MAP / 2 - 18, $couleur);
    // en bas à gauche du cercle
    ImageLine($image, D + TAILLE_MAP / 2 - 25, D + TAILLE_MAP / 2 + 25, D + TAILLE_MAP / 2 - 18, D + TAILLE_MAP / 2 + 18, $couleur);
    // Crois du milieur
    // trait : \
    ImageLine($image, D + TAILLE_MAP / 2 - 5, D + TAILLE_MAP / 2 - 5, D + TAILLE_MAP / 2 + 5, D + TAILLE_MAP / 2 + 5, $couleur);
    // trait : /
    ImageLine($image, D + TAILLE_MAP / 2 - 5, D + TAILLE_MAP / 2 + 5, D + TAILLE_MAP / 2 + 5, D + TAILLE_MAP / 2 - 5, $couleur);
    //cercle
    ImageEllipse($image, D + TAILLE_MAP / 2, D + TAILLE_MAP / 2, 50, 50, $couleur);
}
Ejemplo n.º 7
0
<?php

header("Content-type: image/png");
// 1 : on indique qu'on va envoyer une image PNG
$image = imagecreate(400, 380);
// 2 : on crée une nouvelle image de taille 400 x 350
// 3 : on s'amuse avec notre image (on va apprendre à le faire)
$orange = imagecolorallocate($image, 255, 128, 0);
$bleu = imagecolorallocate($image, 0, 0, 255);
$bleuclair = imagecolorallocate($image, 156, 227, 254);
$noir = imagecolorallocate($image, 0, 0, 0);
$blanc = imagecolorallocate($image, 255, 255, 255);
//ecrire un texte
imagestring($image, 4, 35, 15, "Salut les Zéros !", $blanc);
// dessiner un trait
ImageLine($image, 30, 30, 120, 120, $noir);
//Voici une illustration en figure suivante.
ImageEllipse($image, 100, 100, 100, 50, $noir);
// un rectangle
ImageRectangle($image, 30, 30, 160, 120, $noir);
//un triangle
$points = array(10, 40, 120, 50, 160, 160);
ImagePolygon($image, $points, 3, $noir);
//imagecolortransparent($image, $orange); // On rend le fond orange transparent
imagepng($image);
// 4 : on a fini de faire joujou, on demande à afficher l'image
Ejemplo n.º 8
0
            if ($row["minerals"] > 0) {
                ImageFilledArc($map, $row["x"], $row["y"], 30, 24, 210 - 12 * $row["minerals"], 210 + 12 * $row["minerals"], $minerals, IMG_ARC_PIE);
            }
            if ($row["oil"] > 0) {
                ImageFilledArc($map, $row["x"], $row["y"], 30, 24, 330 - 12 * $row["oil"], 330 + 12 * $row["oil"], $oil, IMG_ARC_PIE);
            }
            if ($row["grain"] > 0) {
                ImageFilledArc($map, $row["x"], $row["y"], 30, 24, 90 - 12 * $row["grain"], 90 + 12 * $row["grain"], $grain, IMG_ARC_PIE);
            }
            // Draw hidden boomer lines
            for ($i = 1; $i <= $row["boomers"]; $i++) {
                ImageEllipse($map, $row["x"], $row["y"], 25 + $i * 4, 19 + $i * 4, $powerc);
            }
            // Draw tank or visible boomer lines
            for ($i = 1; $i <= $row["major"]; $i++) {
                ImageEllipse($map, $row["x"], $row["y"], 25 + ($row['boomers'] + $i) * 4, 19 + ($row['boomers'] + $i) * 4, $black);
            }
            // Draw inner ellipse
            if ($row["colour"] == 'Vuln') {
                ImageFilledEllipse($map, $row["x"], $row["y"], 19, 13, $white);
            } else {
                ImageFilledEllipse($map, $row["x"], $row["y"], 19, 13, $blue);
            }
            // Draw minor units
            if ($row["minor"] > 9) {
                $row["minor"] = '*';
            }
            ImageTTFText($map, 10, 0, $row["x"] - 4, $row["y"] + 5, $black, $font, $row["minor"]);
        }
    }
}
Ejemplo n.º 9
0
<?php

$size = 100;
$scale = 2.5;
$image = ImageCreateTrueColor($size * $scale, $size);
$background_color = 0xffffff;
// white
ImageFilledRectangle($image, 0, 0, $size * $scale - 1, $size * $scale - 1, $background_color);
$black = 0x0;
ImageEllipse($image, $size / 2, $size / 2, $size - 1, $size - 1, $black);
ImageFilledEllipse($image, $size / 2 + ($scale - 1) * $size, $size / 2, $size - 1, $size - 1, $black);
header('Content-type: image/png');
ImagePNG($image);
ImageDestroy($image);
Ejemplo n.º 10
0
<?php

ImageEllipse($image, $x, $y, $width, $height, $color);