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

PHP imagearc函数代码示例

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

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



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

示例1: create

 /** 创建验证码 */
 public function create()
 {
     // 创建图象
     $this->_img_res = imagecreate($this->width, $this->height);
     // 填充背景
     ImageColorAllocate($this->_img_res, $this->backgroundColor[0], $this->backgroundColor[1], $this->backgroundColor[2]);
     // 分配颜色
     $col_ellipse = imagecolorallocate($this->_img_res, $this->iconColor[0], $this->iconColor[1], $this->iconColor[2]);
     $minArea = $this->iconSize / 2 + 3;
     // 混淆用图象,不完整的圆
     for ($i = 0; $i < $this->icon; $i++) {
         $x = mt_rand($minArea, $this->width - $minArea);
         $y = mt_rand($minArea, $this->height - $minArea);
         $s = mt_rand(0, 360);
         $e = $s + 330;
         imagearc($this->_img_res, $x, $y, $this->iconSize, $this->iconSize, $s, $e, $col_ellipse);
     }
     // 验证用图象,完整的圆
     $x = mt_rand($minArea, $this->width - $minArea);
     $y = mt_rand($minArea, $this->height - $minArea);
     $r = $this->iconSize / 2;
     imagearc($this->_img_res, $x, $y, $this->iconSize, $this->iconSize, 0, 360, $col_ellipse);
     // 记录圆心坐标及半径
     $this->captcha_session($this->sess_name, array($x, $y, $r));
     // 生成图象
     Header("Content-type: image/PNG");
     ImagePNG($this->_img_res);
     ImageDestroy($this->_img_res);
     exit;
 }
开发者ID:Birjemin,项目名称:Study,代码行数:31,代码来源:ClickCaptcha.class.php


示例2: vCode

function vCode($num = 4, $size = 20, $width = 0, $height = 0)
{
    !$width && ($width = $num * $size * 4 / 5 + 5);
    !$height && ($height = $size + 10);
    $str = "0123456789";
    //验证码字符全集
    $code = '';
    for ($i = 0; $i < $num; $i++) {
        $code .= $str[mt_rand(0, strlen($str) - 1)];
    }
    // 画图像
    $im = imagecreatetruecolor($width, $height);
    // 定义要用到的颜色
    $back_color = imagecolorallocate($im, 255, 255, 255);
    //    $boer_color = imagecolorallocate($im, 100, 100, 100);
    $text_color = imagecolorallocate($im, 50, 50, 50);
    // 画背景
    imagefilledrectangle($im, 0, 0, $width, $height, $back_color);
    // 画边框
    //    imagerectangle($im, 0, 0, $width-1, $height-1, $boer_color);
    // 画干扰线
    for ($i = 0; $i < 30; $i++) {
        $font_color = imagecolorallocate($im, 0, 0, 0);
        imagearc($im, mt_rand(-$width, $width), mt_rand(-$height, $height), mt_rand(30, $width * 2), mt_rand(20, $height * 2), mt_rand(0, 360), mt_rand(0, 360), $font_color);
    }
    // 画验证码
    @imagefttext($im, $size, 0, 5, $size + 3, $text_color, 'images/index/Callie-Mae.ttf', $code);
    $_SESSION["VerifyCode"] = $code;
    header("Cache-Control: max-age=1, s-maxage=1, no-cache, must-revalidate");
    header("Content-type: image/png;charset=gb2312");
    imagepng($im);
    imagedestroy($im);
}
开发者ID:xiaoshizhishijingsai,项目名称:2014,代码行数:33,代码来源:identify.php


示例3: render

 /**
  * Outputs the Captcha image.
  *
  * @param   boolean  html output
  * @return  mixed
  */
 public function render($html)
 {
     // Creates a black image to start from
     $this->image_create(Captcha::$config['background']);
     // Add random white/gray arcs, amount depends on complexity setting
     $count = (Captcha::$config['width'] + Captcha::$config['height']) / 2;
     $count = $count / 5 * min(10, Captcha::$config['complexity']);
     for ($i = 0; $i < $count; $i++) {
         imagesetthickness($this->image, mt_rand(1, 2));
         $color = imagecolorallocatealpha($this->image, 255, 255, 255, mt_rand(0, 120));
         imagearc($this->image, mt_rand(-Captcha::$config['width'], Captcha::$config['width']), mt_rand(-Captcha::$config['height'], Captcha::$config['height']), mt_rand(-Captcha::$config['width'], Captcha::$config['width']), mt_rand(-Captcha::$config['height'], Captcha::$config['height']), mt_rand(0, 360), mt_rand(0, 360), $color);
     }
     // Use different fonts if available
     $font = Captcha::$config['fontpath'] . Captcha::$config['fonts'][array_rand(Captcha::$config['fonts'])];
     // Draw the character's white shadows
     $size = (int) min(Captcha::$config['height'] / 2, Captcha::$config['width'] * 0.8 / strlen($this->response));
     $angle = mt_rand(-15 + strlen($this->response), 15 - strlen($this->response));
     $x = mt_rand(1, Captcha::$config['width'] * 0.9 - $size * strlen($this->response));
     $y = (Captcha::$config['height'] - $size) / 2 + $size;
     $color = imagecolorallocate($this->image, 255, 255, 255);
     imagefttext($this->image, $size, $angle, $x + 1, $y + 1, $color, $font, $this->response);
     // Add more shadows for lower complexities
     Captcha::$config['complexity'] < 10 and imagefttext($this->image, $size, $angle, $x - 1, $y - 1, $color, $font, $this->response);
     Captcha::$config['complexity'] < 8 and imagefttext($this->image, $size, $angle, $x - 2, $y + 2, $color, $font, $this->response);
     Captcha::$config['complexity'] < 6 and imagefttext($this->image, $size, $angle, $x + 2, $y - 2, $color, $font, $this->response);
     Captcha::$config['complexity'] < 4 and imagefttext($this->image, $size, $angle, $x + 3, $y + 3, $color, $font, $this->response);
     Captcha::$config['complexity'] < 2 and imagefttext($this->image, $size, $angle, $x - 3, $y - 3, $color, $font, $this->response);
     // Finally draw the foreground characters
     $color = imagecolorallocate($this->image, 0, 0, 0);
     imagefttext($this->image, $size, $angle, $x, $y, $color, $font, $this->response);
     // Output
     return $this->image_render($html);
 }
开发者ID:momoim,项目名称:momo-api,代码行数:39,代码来源:Black.php


示例4: gauge

 function gauge()
 {
     // Prepare image
     $this->img = imagecreate(100, 100);
     $this->white = imagecolorallocate($this->img, 255, 255, 255);
     $this->black = imagecolorallocate($this->img, 0, 0, 0);
     $this->red = imagecolorallocate($this->img, 150, 0, 0);
     $this->yellow = imagecolorallocate($this->img, 150, 150, 0);
     $this->green = imagecolorallocate($this->img, 0, 150, 0);
     // Set parameters
     $this->center = 50;
     $this->min = 0;
     $this->maxred = 50;
     $this->maxyellow = 80;
     $this->max = 100;
     $this->pos = 90;
     $this->legend = "";
     // Draw Gauge
     imagearc($this->img, $this->center, $this->center, 100, 100, 0, 360, $this->black);
     imagearc($this->img, $this->center, $this->center, 10, 10, 0, 360, $this->black);
     imagearc($this->img, $this->center, $this->center, 86, 86, 0 + 180, 180 + 180, $this->black);
     imagearc($this->img, $this->center, $this->center, 56, 56, 0 + 180, 180 + 180, $this->black);
     $this->addLine($this->min);
     $this->addLine($this->maxred);
     imagefill($this->img, 25, 25, $this->red);
     //check this point if you move the arcs
     $this->addLine($this->maxyellow);
     imagefill($this->img, 55, 15, $this->yellow);
     //check this point if you move the arcs
     $this->addLine($this->max);
     imagefill($this->img, 85, 30, $this->green);
     //check this point if you move the arcs
     imagefill($this->img, 50, 75, $this->black);
 }
开发者ID:SuichiesS,项目名称:homewatch,代码行数:34,代码来源:gauge.class.php


示例5: fill_arc

 public static function fill_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1, $color2, $text = '', $placeindex = 0)
 {
     $r = $diameter / 2;
     $w = deg2rad((360 + $start + ($end - $start) / 2) % 360);
     if (function_exists("imagefilledarc")) {
         // exists only if GD 2.0.1 is avaliable
         imagefilledarc($im, $centerX + 1, $centerY + 1, $diameter, $diameter, $start, $end, $color1, IMG_ARC_PIE);
         imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2, IMG_ARC_PIE);
         imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color1, IMG_ARC_NOFILL | IMG_ARC_EDGED);
     } else {
         imagearc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2);
         imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2);
         imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start + 1)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2);
         imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end - 1)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2);
         imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2);
         imagefill($im, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $color2);
     }
     if ($text) {
         if ($placeindex > 0) {
             imageline($im, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $diameter, $placeindex * 12, $color1);
             imagestring($im, 4, $diameter, $placeindex * 12, $text, $color1);
         } else {
             imagestring($im, 4, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $text, $color1);
         }
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:26,代码来源:APCImages.php


示例6: draw_axes

function draw_axes()
{
    global $im, $black, $gray;
    for ($x = -1.1; $x <= 1.1; $x += 0.2) {
        imagearc($im, transform_x($x), transform_y(y), 3, 3, 0, 360, $black);
        imagettftext($im, 10, 0, transform_x($x) - 10, transform_y(0) - 4, $black, FONT, $x);
        for ($y = 0; $y <= HEIGHT; $y += 30) {
            imageline($im, transform_x($x), $y, transform_x($x), $y + 10, $gray);
        }
        imagearc($im, transform_x($x), transform_y(f($x)), 3, 3, 0, 360, $black);
        for ($xprime = 0; $xprime <= transform_x($x); $xprime += 30) {
            imageline($im, $xprime, transform_y(f($x)), $xprime + 10, transform_y(f($x)), $gray);
        }
        imagettftext($im, 10, 0, transform_x($x) + 4, transform_y(f($x)), $black, FONT, round(f($x), 2));
    }
    // x axis
    imageline($im, 0, HEIGHT / 2, WIDTH, HEIGHT / 2, $black);
    // y axis
    imageline($im, WIDTH / 2, 0, WIDTH / 2, HEIGHT, $black);
    // box
    imageline($im, 0, 0, WIDTH, 0, $black);
    imageline($im, 0, 0, 0, HEIGHT, $black);
    imageline($im, 0, HEIGHT - 1, WIDTH - 1, HEIGHT - 1, $black);
    imageline($im, WIDTH - 1, 0, WIDTH - 1, HEIGHT - 1, $black);
}
开发者ID:Hepic,项目名称:web-class,代码行数:25,代码来源:plot.php


示例7: gd_rectangle

/**
 * GD Rectangle Function
 *
 * @param class $siggen
 * @param array $data
 * 		int x
 * 		int y
 * 		int x2
 * 		int y2
 * 		bool filled
 * 		int radius
 * 		string color
 * 		int alpha
 *
 * @return bool
 */
function gd_rectangle($siggen, $data)
{
    // Get our color index
    $color = $this->set_color($data['color'], $data['alpha']);
    // Make sure radius is a positive number
    $data['radius'] = abs($data['radius']);
    // Only do this "massive" drawing if we have rounded corners
    if ($data['radius'] > 0) {
        if ($data['filled'] == 1) {
            imagefilledrectangle($siggen->im, $data['x'] + $data['radius'], $data['y'], $data['x2'] - $data['radius'], $data['y2'], $color);
            imagefilledrectangle($siggen->im, $data['x'], $data['y'] + $data['radius'], $data['x'] + $data['radius'] - 1, $data['y2'] - $data['radius'], $color);
            imagefilledrectangle($siggen->im, $data['x2'] - $data['radius'] + 1, $data['y'] + $data['radius'], $data['x2'], $data['y2'] - $data['radius'], $color);
            imagefilledarc($siggen->im, $data['x'] + $data['radius'], $data['y'] + $data['radius'], $data['radius'] * 2, $data['radius'] * 2, 180, 270, $color, IMG_ARC_PIE);
            imagefilledarc($siggen->im, $data['x2'] - $data['radius'], $data['y'] + $data['radius'], $data['radius'] * 2, $data['radius'] * 2, 270, 360, $color, IMG_ARC_PIE);
            imagefilledarc($siggen->im, $data['x'] + $data['radius'], $data['y2'] - $data['radius'], $data['radius'] * 2, $data['radius'] * 2, 90, 180, $color, IMG_ARC_PIE);
            imagefilledarc($siggen->im, $data['x2'] - $data['radius'], $data['y2'] - $data['radius'], $data['radius'] * 2, $data['radius'] * 2, 360, 90, $color, IMG_ARC_PIE);
        } else {
            imageline($siggen->im, $data['x'] + $data['radius'], $data['y'], $data['x2'] - $data['radius'], $data['y'], $color);
            imageline($siggen->im, $data['x'] + $data['radius'], $data['y2'], $data['x2'] - $data['radius'], $data['y2'], $color);
            imageline($siggen->im, $data['x'], $data['y'] + $data['radius'], $data['x'], $data['y2'] - $data['radius'], $color);
            imageline($siggen->im, $data['x2'], $data['y'] + $data['radius'], $data['x2'], $data['y2'] - $data['radius'], $color);
            imagearc($siggen->im, $data['x'] + $data['radius'], $data['y'] + $data['radius'], $data['radius'] * 2, $data['radius'] * 2, 180, 270, $color);
            imagearc($siggen->im, $data['x2'] - $data['radius'], $data['y'] + $data['radius'], $data['radius'] * 2, $data['radius'] * 2, 270, 360, $color);
            imagearc($siggen->im, $data['x'] + $data['radius'], $data['y2'] - $data['radius'], $data['radius'] * 2, $data['radius'] * 2, 90, 180, $color);
            imagearc($siggen->im, $data['x2'] - $data['radius'], $data['y2'] - $data['radius'], $data['radius'] * 2, $data['radius'] * 2, 360, 90, $color);
        }
    } else {
        if ($data['filled'] == 1) {
            imagefilledrectangle($siggen->im, $data['x'], $data['y'], $data['x2'], $data['y2'], $color);
        } else {
            imagerectangle($siggen->im, $data['x'], $data['y'], $data['x2'], $data['y2'], $color);
        }
    }
    return TRUE;
}
开发者ID:Sajaki,项目名称:addons,代码行数:51,代码来源:gd_rectangle.php


示例8: showImage

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


示例9: createimage

 function createimage()
 {
     $this->calculate();
     $r = $this->radius;
     //$image=imagecreate($r*3,$r*2); // Modified by Elpidio Latorilla 2003-04-23
     $image = imagecreate($r * 2, $r * 2);
     $white = imagecolorallocate($image, 255, 255, 255);
     $black = imagecolorallocate($image, 0, 0, 0);
     imagecolorTransparent($image, $white);
     for ($k = 0; $k < count($this->colors); $k++) {
         $fillcolor[$k] = imagecolorallocate($image, $this->colornames[$this->colors[$k]][0], $this->colornames[$this->colors[$k]][1], $this->colornames[$this->colors[$k]][2]);
     }
     imagearc($image, $r, $r, $r * 2 - 1, $r * 2 - 1, 0, 360, $black);
     imagefill($image, $r, $r, $fillcolor[0]);
     for ($j = 0; $j < count($this->elements); $j++) {
         $degree += 360 * $this->fractions[$j];
         if ($this->elements[$j]) {
             imageline($image, $r, $r, $r + $r * cos($degree * pi() / 180), $r + $r * sin($degree * pi() / 180), $black);
             imagefill($image, $r + 15 * cos(($degree + 5) * pi() / 180), $r + 15 * sin(($degree + 5) * pi() / 180), $fillcolor[$j]);
         }
         // Modified by Elpidio Latorilla 2003-04-23
         //imagefilledrectangle($image,2.1*$r,.7*$r+($r/15)*$j,2.12*$r+($r/25),.7*$r+5+($r/15)*$j,$fillcolor[$j]);
         //imagestring($image,0,2.13*$r+$r/20,.71*$r+($r/15)*$j-2,$this->elements[$j]."-".$this->elementnames[$j],$black);
     }
     $this->final = $image;
 }
开发者ID:patmark,项目名称:care2x-tz,代码行数:26,代码来源:piechart.class.php


示例10: buildImageVerify

 /**
  * 
  * @brief 图片处理 验证码
  * @param unknown_type $length
  * @param unknown_type $mode
  * @param unknown_type $type
  * @param unknown_type $width
  * @param unknown_type $height
  * @param unknown_type $verifyName
  */
 public static function buildImageVerify($length = 4, $mode = 1, $type = 'png', $width = 48, $height = 22, $verifyName = 'verify')
 {
     $randval = self::randString($length, $mode);
     $_SESSION[$verifyName] = md5($randval);
     $width = $length * 10 + 10 > $width ? $length * 10 + 10 : $width;
     if ($type != 'gif' && function_exists('imagecreatetruecolor')) {
         $im = imagecreatetruecolor($width, $height);
     } else {
         $im = imagecreate($width, $height);
     }
     $r = array(225, 255, 255, 223);
     $g = array(225, 236, 237, 255);
     $b = array(225, 236, 166, 125);
     $key = mt_rand(0, 3);
     $backColor = imagecolorallocate($im, $r[$key], $g[$key], $b[$key]);
     //背景色(随机)
     $borderColor = imagecolorallocate($im, 100, 100, 100);
     //边框色
     imagefilledrectangle($im, 0, 0, $width - 1, $height - 1, $backColor);
     imagerectangle($im, 0, 0, $width - 1, $height - 1, $borderColor);
     $stringColor = imagecolorallocate($im, mt_rand(0, 200), mt_rand(0, 120), mt_rand(0, 120));
     // 干扰
     for ($i = 0; $i < 10; $i++) {
         imagearc($im, mt_rand(-10, $width), mt_rand(-10, $height), mt_rand(200, 300), mt_rand(35, 200), 55, 44, $stringColor);
     }
     for ($i = 0; $i < 25; $i++) {
         imagesetpixel($im, mt_rand(0, $width), mt_rand(0, $height), $stringColor);
     }
     for ($i = 0; $i < $length; $i++) {
         imagestring($im, 5, $i * 10 + 5, mt_rand(1, 8), $randval[$i], $stringColor);
     }
     Image::output($im, $type);
 }
开发者ID:fengxiangyun,项目名称:diary,代码行数:43,代码来源:Image.class.php


示例11: create_captcha

 /**
  * +----------------------------------------------------------
  * 图片上传的处理函数
  * +----------------------------------------------------------
  */
 function create_captcha()
 {
     $word = $this->create_word();
     // 把验证码字符串写入session
     $_SESSION['captcha'] = md5($word . DOU_SHELL);
     // 绘制基本框架
     $im = imagecreatetruecolor($this->captcha_width, $this->captcha_height);
     $bg_color = imagecolorallocate($im, 235, 236, 237);
     imagefilledrectangle($im, 0, 0, $this->captcha_width, $this->captcha_height, $bg_color);
     $border_color = imagecolorallocate($im, 118, 151, 199);
     imagerectangle($im, 0, 0, $this->captcha_width - 1, $this->captcha_height - 1, $border_color);
     // 添加干扰
     for ($i = 0; $i < 5; $i++) {
         $rand_color = imagecolorallocate($im, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
         imagearc($im, mt_rand(-$this->captcha_width, $this->captcha_width), mt_rand(-$this->captcha_height, $this->captcha_height), mt_rand(30, $this->captcha_width * 2), mt_rand(20, $this->captcha_height * 2), mt_rand(0, 360), mt_rand(0, 360), $rand_color);
     }
     for ($i = 0; $i < 50; $i++) {
         $rand_color = imagecolorallocate($im, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
         imagesetpixel($im, mt_rand(0, $this->captcha_width), mt_rand(0, $this->captcha_height), $rand_color);
     }
     // 生成验证码图片
     $text_color = imagecolorallocate($im, mt_rand(0, 200), mt_rand(0, 120), mt_rand(0, 120));
     imagestring($im, 6, 18, 5, $word, $text_color);
     // header
     header("Cache-Control: max-age=1, s-maxage=1, no-cache, must-revalidate");
     header("Content-type: image/png;charset=utf-8");
     /* 绘图结束 */
     imagepng($im);
     imagedestroy($im);
     return true;
 }
开发者ID:phphonor,项目名称:companycms,代码行数:36,代码来源:captcha.class.php


示例12: arc

 /**
  * (non-PHPdoc)
  * @see Imagine\Draw\DrawerInterface::arc()
  */
 public function arc(PointInterface $center, BoxInterface $size, $start, $end, Color $color)
 {
     if (false === imagearc($this->resource, $center->getX(), $center->getY(), $size->getWidth(), $size->getHeight(), $start, $end, $this->getColor($color))) {
         throw new RuntimeException('Draw arc operation failed');
     }
     return $this;
 }
开发者ID:nicodmf,项目名称:Imagine,代码行数:11,代码来源:Drawer.php


示例13: buildVerifyImage

 public static function buildVerifyImage($length = 4, $width = 48, $height = 22, $verifyName = 'verify')
 {
     $randval = substr(md5(time() . microtime()), 5, $length);
     header('Content-Type: image/gif');
     $_SESSION[$verifyName] = md5($randval);
     $width = $length * 9 + 10 > $width ? $length * 9 + 10 : $width;
     $im = @imagecreate($width, $height);
     $r = array(225, 255, 255, 223);
     $g = array(225, 236, 237, 255);
     $b = array(225, 236, 166, 125);
     $key = mt_rand(0, 3);
     $backColor = imagecolorallocate($im, $r[$key], $g[$key], $b[$key]);
     //背景色(随机)
     $borderColor = imagecolorallocate($im, 100, 100, 100);
     //边框色
     $pointColor = imagecolorallocate($im, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
     //点颜色
     @imagefilledrectangle($im, 0, 0, $width - 1, $height - 1, $backColor);
     //@imagerectangle($im, 0, 0, $width-1, $height-1, $borderColor);
     $stringColor = imagecolorallocate($im, mt_rand(0, 200), mt_rand(0, 120), mt_rand(0, 120));
     //干扰
     for ($i = 0; $i < 5; $i++) {
         $fontcolor = imagecolorallocate($im, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
         imagearc($im, mt_rand(-10, $width), mt_rand(-10, $height), mt_rand(30, 300), mt_rand(20, 200), 55, 44, $fontcolor);
     }
     for ($i = 0; $i < 10; $i++) {
         $fontcolor = imagecolorallocate($im, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
         imagesetpixel($im, mt_rand(0, $width), mt_rand(0, $height), $pointColor);
     }
     @imagestring($im, 5, 5, 3, $randval, $stringColor);
     imagegif($im);
 }
开发者ID:princehaku,项目名称:flowphp,代码行数:32,代码来源:Image.class.php


示例14: draw

 /**
  * Draws this object onto an image
  *
  * @param   img.Image image
  * @return  var
  */
 public function draw($image)
 {
     if (FALSE !== $this->fill) {
         return imagefilledarc($image->handle, $this->cx, $this->cy, $this->w, $this->h, $this->s, $this->e, $this->col->handle, $this->fill);
     } else {
         return imagearc($image->handle, $this->cx, $this->cy, $this->w, $this->h, $this->s, $this->e, $this->col->handle);
     }
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:14,代码来源:Arc.class.php


示例15: draw_data

	function draw_data($x,$y,$rad,$color, $isCore = false)
	{
		global $im,$x0,$y0,$black, $maxX, $maxY;
		
		//рисуем точку
		imagefilledarc($im,$x0 + $x,$maxY-$y,$rad,$rad,0,360,$color,IMG_ARC_PIE);
		if ($isCore) imagearc($im,$x0 + $x,$maxY-$y,$rad,$rad,0,360,$black);
	}
开发者ID:Atiragram,项目名称:poit-labs,代码行数:8,代码来源:image-2.php


示例16: drawLines

 private function drawLines()
 {
     $lineCnt = mt_rand(4, 8);
     for ($i = 0; $i < $lineCnt; $i++) {
         imagesetthickness($this->tmpImage, rand(1, 3));
         imagearc($this->tmpImage, mt_rand(-10, $this->width), mt_rand(-10, $this->height), mt_rand(30, 300), mt_rand(20, 200), mt_rand(80, 360), mt_rand(0, 300), $this->textColor);
     }
 }
开发者ID:tsoftware-org,项目名称:captcha,代码行数:8,代码来源:Captcha.php


示例17: draw

 public function draw($data)
 {
     $img = $this->prepare_image($data);
     if (!empty($data['fill_color'])) {
         imagefilledellipse($img, $this->padding + $data['radius'], $this->padding + $data['radius'], $data['radius'], $data['radius'], $this->get_line_color($img, $data['fill_color']));
     }
     imagearc($img, $this->padding + $data['radius'], $this->padding + $data['radius'], $data['radius'], $data['radius'], 0, 360, $this->get_line_color($img, $data['line_color']));
     $this->_draw($img);
 }
开发者ID:XanderKon,项目名称:Exercises,代码行数:9,代码来源:Circle.php


示例18: circle_sectioned

function circle_sectioned($x, $y, $radius, $color)
{
    global $image;
    for ($rad = $radius - 4; $rad <= $radius; $rad++) {
        for ($sections = 0; $sections < 6; $sections++) {
            imagearc($image, $x, $y, $rad, $rad, $sections * 60, $sections * 60 + 40, $color);
        }
    }
}
开发者ID:startrekfinalfrontier,项目名称:UI,代码行数:9,代码来源:secimage.php


示例19: arc

 public function arc(Point $center, $width, $height, $start, $end, $style = NULL, $filled = FALSE, Color $color = NULL)
 {
     if (!$center->isInImage($this)) {
         throw new IllegalArgumentException();
     }
     if ($filled == TRUE && $style == NULL) {
         throw new IllegalArgumentException();
     }
     $filled == TRUE ? imagefilledarc($this->imageResource, $center->getX(), $center->getY(), $width, $height, $start, $end, $this->prepareColor($color), $style) : imagearc($this->imageResource, $center->getX(), $center->getY(), $width, $height, $start, $end, $this->prepareColor($color));
 }
开发者ID:rendix2,项目名称:QW_MVS,代码行数:10,代码来源:Images.php


示例20: mkCode

 public function mkCode($num = 4, $size = 20, $width = 0, $height = 0)
 {
     // $num => 验证码字符数目
     // $size => 字符大小(注意单位是pt不是px)
     // $width这只是大概的图像宽度,因为不同字体的同样font-size所占width也是有微小差距的
     !$width && ($width = $num * $size);
     //根据要显示验证码字符长度设置验证码图像长度
     !$height && ($height = $size + 10);
     //设置图像的高度
     $font_url = dirname(dirname(__FILE__)) . "/font/mywanderingheart.ttf";
     //如果字体路径错误:会无法显示验证码,但是有图像(后面这一点得看情况)
     // 我们要显示的验证码字符集合
     $str = "23456789abcdefghijkmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVW";
     //要显示的验证码
     $code = '';
     for ($i = 0; $i < $num; $i++) {
         $code .= $str[mt_rand(0, strlen($str) - 1)];
     }
     // 画图像,新建一个真彩色图像,并返回一个图像标识符赋值给 $im
     $im = imagecreatetruecolor($width, $height);
     // 定义要用到的颜色
     $background_color = imagecolorallocate($im, 255, 255, 255);
     //这里默认白色背景
     $border_color = imagecolorallocate($im, 255, 255, 255);
     //这里默认白色边框
     $text_color = imagecolorallocate($im, 50, 50, 50);
     //这里默认淡黑色字体颜色
     // 画背景
     imagefilledrectangle($im, 0, 0, $width, $height, $background_color);
     // 画边框(该函数事实上是画一个矩形)
     imagerectangle($im, 0, 0, $width - 1, $height - 1, $border_color);
     // 画干扰点
     for ($i = 0; $i < 10 * $num; $i++) {
         $font_color = imagecolorallocate($im, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
         imagesetpixel($im, mt_rand(0, $width), mt_rand(0, $height), $font_color);
     }
     // 默认画4条干扰线
     //这地方可以自己研究一下
     for ($i = 0; $i < 4; $i++) {
         $font_color = imagecolorallocate($im, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
         imagearc($im, mt_rand(0, $width), mt_rand(0, $height), mt_rand(0, $width), mt_rand(0, $height), mt_rand(0, 360), mt_rand(0, 360), $font_color);
         // imagearc($im, 0, 0, $width*2, $height, 0, 90, $font_color);
     }
     //好吧,是时候把验证码字符画上去了
     @imagefttext($im, $size, 0, 10, $size + 5, $text_color, $font_url, $code);
     // 喂,浏览器!我给你发的这个东西不要从你的缓存中拿啊。还有啊,这是一个png图像,不要解析错了。
     header("Cache-Control: max-age=1, s-maxage=1, no-cache, must-revalidate");
     header("Content-type: image/png;charset=utf-8");
     // imagepng 以 PNG 格式将图像输出到浏览器,如果指定了第二个参数 filename 将保存图像到文件
     // 例如imagepng( $im, '1.png' ); 将图像保存到同级目录下的1.png文件(如果该文件已存在则覆盖)
     imagepng($im);
     imagedestroy($im);
     return $code;
     //把验证码字符返回
 }
开发者ID:AJLoveChina,项目名称:PHPVerifyCode,代码行数:55,代码来源:class.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP imagebmp函数代码示例发布时间:2022-05-15
下一篇:
PHP imageantialias函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap