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

PHP imagesettile函数代码示例

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

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



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

示例1: addBackground

 public function addBackground($canvas, $bgImage, $bgWidth, $bgHeight, $bgOriginX, $bgOriginY)
 {
     $background = imagecreatetruecolor($bgWidth, $bgHeight);
     imagesettile($background, $bgImage);
     imagefill($background, 0, 0, IMG_COLOR_TILED);
     imagecopy($canvas, $background, $bgOriginX, $bgOriginY, 0, 0, $bgWidth, $bgHeight);
 }
开发者ID:neilcrookes,项目名称:Ximi,代码行数:7,代码来源:ximi_image_gd.php


示例2: apply

 /**
  * {@inheritdoc}
  */
 public function apply(CanvasInterface $canvas, AbstractStyledDrawable $drawable)
 {
     if (false == @imagesettile($canvas->getHandler(), $this->pattern->getHandler())) {
         throw new DrawableException('Could Not Apply The Fill Pattern Style');
     }
     return new TiledColor();
 }
开发者ID:El-Loco-Pinguino,项目名称:FaitesUnVoeu_WF3,代码行数:10,代码来源:FillStyle.php


示例3: index

 public function index()
 {
     //	Check the request headers; avoid hitting the disk at all if possible. If the Etag
     //	matches then send a Not-Modified header and terminate execution.
     if ($this->_serve_not_modified($this->_cache_file)) {
         return;
     }
     // --------------------------------------------------------------------------
     //	The browser does not have a local cache (or it's out of date) check the
     //	cache directory to see if this image has been processed already; serve it up if
     //	it has.
     if (file_exists(DEPLOY_CACHE_DIR . $this->_cache_file)) {
         $this->_serve_from_cache($this->_cache_file);
     } else {
         //	Cache object does not exist, create a new one and cache it
         //	Get and create the placeholder graphic
         $_tile = imagecreatefrompng($this->_tile);
         // --------------------------------------------------------------------------
         //	Create the container
         $_img = imagecreatetruecolor($this->_width, $this->_height);
         // --------------------------------------------------------------------------
         //	Tile the placeholder
         imagesettile($_img, $_tile);
         imagefilledrectangle($_img, 0, 0, $this->_width, $this->_height, IMG_COLOR_TILED);
         // --------------------------------------------------------------------------
         //	Draw a border
         $_border = imagecolorallocate($_img, 190, 190, 190);
         for ($i = 0; $i < $this->_border; $i++) {
             //	Left
             imageline($_img, 0 + $i, 0, 0 + $i, $this->_height, $_border);
             //	Top
             imageline($_img, 0, 0 + $i, $this->_width, 0 + $i, $_border);
             //	Bottom
             imageline($_img, 0, $this->_height - 1 - $i, $this->_width, $this->_height - 1 - $i, $_border);
             //	Right
             imageline($_img, $this->_width - 1 - $i, 0, $this->_width - 1 - $i, $this->_height, $_border);
         }
         // --------------------------------------------------------------------------
         //	Set the appropriate cache headers
         $this->_set_cache_headers(time(), $this->_cache_file, FALSE);
         // --------------------------------------------------------------------------
         //	Output to browser
         header('Content-Type: image/png', TRUE);
         imagepng($_img);
         // --------------------------------------------------------------------------
         //	Save local version, make sure cache is writable
         imagepng($_img, DEPLOY_CACHE_DIR . $this->_cache_file);
         // --------------------------------------------------------------------------
         //	Destroy the images to free up resource
         imagedestroy($_tile);
         imagedestroy($_img);
     }
     // --------------------------------------------------------------------------
     //	Kill script, th, th, that's all folks.
     //	Stop the output class from hijacking our headers and
     //	setting an incorrect Content-Type
     exit(0);
 }
开发者ID:nailsapp,项目名称:module-cdn,代码行数:58,代码来源:placeholder.php


示例4: apply

 public function apply($resource)
 {
     $imageWidth = imagesx($resource->image);
     $imageHeight = imagesy($resource->image);
     $width = $imageWidth * $this->settings->xtimes;
     $height = $imageHeight * $this->settings->xtimes;
     $new = imagecreatetruecolor($width, $height);
     imagesettile($new, $resource->image);
     imagefill($new, 0, 0, IMG_COLOR_TILED);
     $resource->image = $new;
 }
开发者ID:psychoticmeowArchives,项目名称:Imaje,代码行数:11,代码来源:tile.php


示例5: execute

 /**
  * Fills image with color or pattern
  *
  * @param  \Intervention\Image\Image $image
  * @return boolean
  */
 public function execute($image)
 {
     $filling = $this->argument(0)->value();
     $x = $this->argument(1)->type('digit')->value();
     $y = $this->argument(2)->type('digit')->value();
     $width = imagesx($image->getCore());
     $height = imagesy($image->getCore());
     try {
         // set image tile filling
         $tile = $image->getDriver()->init($filling);
     } catch (\Intervention\Image\Exception\NotReadableException $e) {
         // set solid color filling
         $color = new Color($filling);
         $filling = $color->getInt();
     }
     foreach ($image as $frame) {
         if (isset($tile)) {
             imagesettile($frame->getCore(), $tile->getCore());
             $filling = IMG_COLOR_TILED;
         }
         imagealphablending($frame->getCore(), true);
         if (is_int($x) && is_int($y)) {
             // resource should be visible through transparency
             $base = $image->getDriver()->newImage($width, $height)->getCore();
             imagecopy($base, $frame->getCore(), 0, 0, 0, 0, $width, $height);
             // floodfill if exact position is defined
             imagefill($frame->getCore(), $x, $y, $filling);
             // copy filled original over base
             imagecopy($base, $frame->getCore(), 0, 0, 0, 0, $width, $height);
             // set base as new resource-core
             imagedestroy($frame->getCore());
             $frame->setCore($base);
         } else {
             // fill whole image otherwise
             imagefilledrectangle($frame->getCore(), 0, 0, $width - 1, $height - 1, $filling);
         }
     }
     isset($tile) ? imagedestroy($tile->getCore()) : null;
     return true;
 }
开发者ID:EdgarPost,项目名称:image,代码行数:46,代码来源:FillCommand.php


示例6: generate

 public function generate()
 {
     imagesavealpha($this->_owner->image, true);
     imagealphablending($this->_owner->image, true);
     imagesavealpha($this->watermark->image, false);
     imagealphablending($this->watermark->image, false);
     $width = $this->_owner->imagesx();
     $height = $this->_owner->imagesy();
     $watermark_width = $this->watermark->imagesx();
     $watermark_height = $this->watermark->imagesy();
     switch ($this->position) {
         case "tl":
             $x = 0;
             $y = 0;
             break;
         case "tm":
             $x = ($width - $watermark_width) / 2;
             $y = 0;
             break;
         case "tr":
             $x = $width - $watermark_width;
             $y = 0;
             break;
         case "ml":
             $x = 0;
             $y = ($height - $watermark_height) / 2;
             break;
         case "mm":
             $x = ($width - $watermark_width) / 2;
             $y = ($height - $watermark_height) / 2;
             break;
         case "mr":
             $x = $width - $watermark_width;
             $y = ($height - $watermark_height) / 2;
             break;
         case "bl":
             $x = 0;
             $y = $height - $watermark_height;
             break;
         case "bm":
             $x = ($width - $watermark_width) / 2;
             $y = $height - $watermark_height;
             break;
         case "br":
             $x = $width - $watermark_width;
             $y = $height - $watermark_height;
             break;
         case "user":
             $x = $this->position_x - $this->watermark->getHandleX() / 2;
             $y = $this->position_y - $this->watermark->getHandleY() / 2;
             break;
         default:
             $x = 0;
             $y = 0;
             break;
     }
     if ($this->position != "tile") {
         imagecopy($this->_owner->image, $this->watermark->image, $x, $y, 0, 0, $watermark_width, $watermark_height);
     } else {
         imagesettile($this->_owner->image, $this->watermark->image);
         imagefilledrectangle($this->_owner->image, 0, 0, $width, $height, IMG_COLOR_TILED);
     }
     return true;
 }
开发者ID:joogoo,项目名称:php5-image,代码行数:64,代码来源:Watermark.php


示例7: show_surface


//.........这里部分代码省略.........
             $dminx = $xmin * $difmx / $gdifx;
             $poz = array();
             $olx = $this->pixel_up($valorix[0], $difmx, $gdifx, $xmin) + $gx;
             $oly = $this->pixel_up($valoriy[0], $difm, $gdify, $ymin);
             $oly0 = $this->pixel_up(0, $difm, $gdify, $ymin);
             $poz[] = $olx;
             $poz[] = $gyy - $oly0;
             $poz[] = $olx;
             $poz[] = $gyy - $oly;
             if ($single == false) {
                 $pozitii[$pos][0] = array($olx, $gyy - $oly, ${$olx}, $gyy - $oly, $valorix[0] . "," . $valoriy[0]);
             } else {
                 $pozitii[$pos][0] = array($olx, $gyy - $oly, ${$olx}, $gyy - $oly, $valoriy[0]);
             }
             for ($j = 1; $j < $this->count; $j++) {
                 $lx = $this->pixel_up($valorix[$j], $difmx, $gdifx, $xmin) + $gx;
                 $ly = $this->pixel_up($valoriy[$j], $difm, $gdify, $ymin);
                 $poz[] = $lx;
                 $poz[] = $gyy - $ly;
                 if ($single == false) {
                     $textul = $valorix[$j] . "," . $valoriy[$j];
                 } else {
                     $textul = $valoriy[$j];
                 }
                 $pozitii[$pos][$j] = array($lx, $gyy - $ly, $olx, $gyy - $oly, $textul);
                 $olx = $lx;
                 $oly = $ly;
                 $i++;
             }
             $poz[] = $lx;
             $poz[] = $gyy - $oly0;
             if ($this->acolors[$pos][1] == 0) {
                 imagefilledpolygon($this->imagine, $poz, sizeof($poz) / 2, $this->acolors[$pos][0]);
             } else {
                 imagesettile($this->imagine, $this->acolors[$pos][0]);
                 imagefilledpolygon($this->imagine, $poz, sizeof($poz) / 2, IMG_COLOR_TILED);
             }
             if ($this->showcoords) {
                 foreach ($pozitii as $line) {
                     foreach ($line as $lin) {
                         $this->pune_indice($this->imagine, $lin[0], $lin[1], $lin[2], $lin[3], $lin[4]);
                     }
                 }
             }
             $k++;
             $pos++;
         }
         if ($single == true && $this->count > 1 && $this->count / ($this->fonstsize + 1) < 10) {
             if ($this->count > 2) {
                 $pana = min($this->count, sizeof($categories));
             } else {
                 $pana = min($this->count, sizeof($categories)) - 1;
             }
             for ($j = 0; $j < $pana; $j++) {
                 $lx = ($this->pixel_up($valorix[$j], $difmx, $gdifx, $xmin) + $this->pixel_up($valorix[$j + 1], $difmx, $gdifx, $xmin)) / 2 + $gx - $this->fontsize * strlen($categories[$j]) / 3.3;
                 imagefttext($this->imagine, $this->fontsize * 0.8, 0, $lx, $gyy + $this->fontsize * 1.5, $this->bc($this->imagine, "darkgray"), $this->font, $categories[$j]);
             }
         }
         if ($this->showpanel) {
             $px = $gx * 0.8;
             $pxx = $gxx * 1;
             $py = $gyy * 1.06;
             $pyy = $gyy * 1.5;
             $rand = $this->fontsize * 0.8;
             $cc = sizeof($pozitii);
             $bordura = "white-brown";
             for ($i = 0; $i < $cc; $i++) {
                 $diferenta = $py * 1.02 - $py;
                 $this->liniuta($this->imagine, $px, $py + $i * $rand + $i * $diferenta, $px * 3, $py + $i * $rand + ($i + 1) * $diferenta, $this->linewidth, $culori[$i], $i);
                 imagefttext($this->imagine, $rand, 0, $px * 3 - $rand / 3, $py + $i * $rand + $rand / 1.5 + ($i + 1) * $diferenta, $this->black, $this->font, $catego[$i]);
             }
             $ttx = $this->width * 0.28;
             $tty = $gyy * 1.12;
             $cate = ($gxx - $ttx) / $this->fontsize * 1.5;
         } else {
             $ttx = $this->width * 0.02;
             $tty = $gyy * 1.12;
             $cate = ($gxx - $ttx) / $this->fontsize * 1.5;
         }
         if (strlen($this->title) > 0) {
             $tlx = $this->width / 2 - strlen($this->title) * $this->fontsize / 2.5;
             $tly = $this->height * 0.04 + 3;
             imagefttext($this->imagine, $this->fontsize + 3, 0, $tlx, $tly, $this->bc($this->imagine, $this->title_color), $this->font, $this->title);
         }
         if (strlen($this->text) > 0) {
             $textul = array();
             for ($i = 1; $i <= $cate; $i++) {
                 $textul[] = nl2br(substr($this->text, floor(($i - 1) * $cate), ceil($cate)));
             }
             $i = 0;
             foreach ($textul as $linie) {
                 imagefttext($this->imagine, $this->fontsize - 1, 0, $ttx, $tty + $i, $this->bc($this->imagine, $this->text_color), $this->font, $linie);
                 $i += $this->fontsize + 1;
             }
         }
         $this->set_filter();
     } else {
         echo "not enought values";
     }
 }
开发者ID:rohitbatra1987,项目名称:ruckus_dev,代码行数:101,代码来源:graph_charts.php


示例8: ImageColorAllocate

    case 4:
        $col_txt = ImageColorAllocate($im, $col_txt_r, $col_txt_g, $col_txt_b);
        break;
}
$noiset = mt_rand(1, 2);
$image_data = getimagesize($im_bg_url);
$image_type = $image_data[2];
if ($image_type == 1) {
    $img_src = imagecreatefromgif($im_bg_url);
} elseif ($image_type == 2) {
    $img_src = imagecreatefromjpeg($im_bg_url);
} elseif ($image_type == 3) {
    $img_src = imagecreatefrompng($im_bg_url);
}
if ($im_bg_type == 1) {
    imagesettile($im, $img_src);
    imageFilledRectangle($im, 0, 0, $image_width, $image_height, IMG_COLOR_TILED);
} else {
    imagecopyresampled($im, $img_src, 0, 0, 0, 0, $image_width, $image_height, $image_data[0], $image_data[1]);
}
$pos_x = ($image_width - $codelen) / 2;
foreach ($data as $d) {
    $pos_y = ($image_height + $d['height']) / 2;
    ImageTTFText($im, $d['size'], $d['angle'], $pos_x, $pos_y, $col_txt, $font, $d['char']);
    $pos_x += $d['width'] + $char_padding;
}
### a nice border
ImageRectangle($im, 0, 0, $image_width - 1, $image_height - 1, $color_border);
switch ($output_type) {
    case 'jpeg':
        Header('Content-type: image/jpeg');
开发者ID:nvvetal,项目名称:water,代码行数:31,代码来源:cforms-captcha.php


示例9: set

 static function set(&$image, $value, $method)
 {
     if ($method == 'border') {
         //画线粗细
         return imagesetthickness($image, (int) $value);
     }
     if ($method == 'style') {
         //画线风格
         return imagesetstyle($image, (array) $value);
     }
     if ($method == 'brush') {
         //画笔图像
         return imagesetbrush($image, $value);
     }
     if ($method == 'pattern') {
         //填充的贴图 图案
         return imagesettile($image, $value);
     }
     if ($method == 'alias') {
         //抗锯齿
         return imageantialias($image, (bool) $value);
     }
     if ($method == 'alpha') {
         //alpha混色标志
         return imagelayereffect($image, (int) $value);
     }
     if ($method == 'transparent') {
         //透明色
         return imagecolortransparent($image, (int) $value);
     }
     if ($method == 'mix') {
         //混色模式
         return imagealphablending($image, (bool) $value);
     }
 }
开发者ID:art-youth,项目名称:framework,代码行数:35,代码来源:img.php


示例10: createImage

 /**
  * Creates a captcha image.
  *
  */
 private function createImage()
 {
     $intWidth = $this->intImageWidth;
     $intHeight = $intWidth / 3;
     $intFontSize = floor($intWidth / strlen($this->strRandomString)) - 2;
     $intAngel = 15;
     $intVerticalMove = floor($intHeight / 7);
     $image = imagecreatetruecolor($intWidth, $intHeight);
     $arrFontColors = array(imagecolorallocate($image, 0, 0, 0), imagecolorallocate($image, 255, 0, 0), imagecolorallocate($image, 0, 180, 0), imagecolorallocate($image, 0, 105, 172), imagecolorallocate($image, 145, 19, 120));
     $arrFonts = array($this->strFontDir . 'coprgtb.ttf', $this->strFontDir . 'ltypeb.ttf');
     //Draw background
     $imagebg = imagecreatefromjpeg($this->strBackgroundDir . rand(1, $this->intNumberOfBackgrounds) . '.jpg');
     imagesettile($image, $imagebg);
     imagefilledrectangle($image, 0, 0, $intWidth, $intHeight, IMG_COLOR_TILED);
     //Draw string
     for ($i = 0; $i < strlen($this->strRandomString); ++$i) {
         $intColor = rand(0, count($arrFontColors) - 1);
         $intFont = rand(0, count($arrFonts) - 1);
         $intAngel = rand(-$intAngel, $intAngel);
         $intYMove = rand(-$intVerticalMove, $intVerticalMove);
         if ($this->boolFreetypeInstalled) {
             imagettftext($image, $intFontSize, $intAngel, 6 + $intFontSize * $i, $intHeight / 2 + $intFontSize / 2 + $intYMove, $arrFontColors[$intColor], $arrFonts[$intFont], substr($this->strRandomString, $i, 1));
         } else {
             imagestring($image, 5, 6 + 25 * $i, 12 + $intYMove, substr($this->strRandomString, $i, 1), $arrFontColors[$intColor]);
         }
     }
     //save the image for further processing
     $this->image = $image;
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:33,代码来源:ContrexxCaptcha.class.php


示例11: tile

 public function tile($tile) : InternalGD
 {
     if (!is_resource($tile)) {
         throw new InvalidArgumentException('Error', 'resourceParameter', '1.($tile)');
     }
     imagesettile($this->canvas, $tile);
     return $this;
 }
开发者ID:znframework,项目名称:znframework,代码行数:8,代码来源:InternalGD.php


示例12: fillPattern

 /**
  * Rellena la imagen con un patrón
  * @param  resource $tile Identificador de recurso de imagen de la imagen patrón
  */
 public function fillPattern($tile)
 {
     if (!imagesettile($this->imgData, $tile)) {
         throw new Exception("imagesettile error", 1);
     }
     imagefilledrectangle($this->imgData, 0, 0, $this->width(), $this->height(), IMG_COLOR_TILED);
     //$this->imgData=$tile;
 }
开发者ID:neslonso,项目名称:Sintax,代码行数:12,代码来源:Imagen.php


示例13: imageCreateFromPNG

	$imbg = imageCreateFromPNG ('tile.png'); // Alpha-transparent PNG
	
	$black = imagecolorallocate($im,   0,   0,   0);
	$white = imagecolorallocate($im, 255, 255, 255);
	$red   = imagecolorallocate($im, 255,   0,   0);
	$green = imagecolorallocate($im,   0, 128,   0);
	
	imagestring ($im, 3, 60+$x*4, 40, $nome, $green);
	imagestring ($im, 3, 59+$x*4, 39, $nome, $white);
	
	imageline  ($im, 0, 20+$x*8, 400, 40+$x*-2,      $green);
	imagestring($im, 3, 30,       50, microtime(),   $white);
	imagestring($im, 3, 35,       60, "X: $x",       $white);
	imagestring($im, 3, 105,      60, date("H:i:s"), $red);
   
	imagesettile ($im, $imbg);
	imagefilledrectangle ($im, 0, 0, 400, 200, IMG_COLOR_TILED);
	
	$randFilename = "tempFolder/".uniqid("$x-").".gif";
	$generated[] = $randFilename;
	imagegif($im, $randFilename);
}
$genEndTime = microtime(true);

$startTime = microtime(true);
/** Instantiate the class to join all the frames into one single GIF **/
$gif = new dGifAnimator();
$gif->setLoop(0);                         # Loop forever
$gif->setDefaultConfig('delay_ms', '10'); # Delay: 10ms
if(isset($_GET['transparent']))
	$gif->setDefaultConfig('transparent_color', 0);
开发者ID:j-stahl,项目名称:Game_of_Life,代码行数:31,代码来源:sample.php


示例14: createTextWatermark

 private function createTextWatermark($w, $h)
 {
     $font = $this->fw->get('ROOT') . '/../' . APP_FOLDER . '/views/' . $this->fw->get('site.tpl') . '/assets/fonts/' . $this->fw->get('site.watermark.font');
     //		\helpers\Debug::prePrintR($font);
     $text = $this->fw->get('site.watermark.text');
     $color = $this->fw->get('site.watermark.color');
     //		$hexcolor = $this->hexToPHPColor($this->fw->get('site.watermark.color'));
     $x = $this->fw->get('site.watermark.x');
     $y = $this->fw->get('site.watermark.y');
     $size = $this->fw->get('site.watermark.size');
     $angle = $this->fw->get('site.watermark.angle');
     if (is_string($x) || is_string($y)) {
         $textsize = imagettfbbox($size, $angle, $font, $text);
         $textwidth = abs($textsize[2]);
         $textheight = abs($textsize[7]);
         list($xalign, $xalign_offset) = explode(" ", $x);
         list($yalign, $yalign_offset) = explode(" ", $y);
     }
     if (is_string($x)) {
         switch ($xalign) {
             case 'left':
                 $x = 0 + $xalign_offset;
                 break;
             case 'right':
                 $x = $w - $textwidth + $xalign_offset;
                 break;
             case 'middle':
             case 'center':
                 $x = ($w - $textwidth) / 2 + $xalign_offset;
                 break;
         }
     }
     if (is_string($y)) {
         switch ($yalign) {
             case 'top':
                 $y = 0 + $textheight + $yalign_offset;
                 break;
             case 'bottom':
                 $y = $h + $yalign_offset;
                 break;
             case 'middle':
             case 'center':
                 $y = ($h - $textheight) / 2 + $textheight + $yalign_offset;
                 break;
         }
     }
     $img = imagecreatetruecolor($w, $h);
     imagefill($img, 0, 0, IMG_COLOR_TRANSPARENT);
     if ($this->fw->get('site.watermark.tile')) {
         $tile = imagecreatetruecolor($textwidth * 4, $textwidth * 4);
         imagefill($tile, 0, 0, IMG_COLOR_TRANSPARENT);
         $color_id = imagecolorallocate($tile, $color[0], $color[1], $color[2]);
         imagettftext($tile, $size, $angle, $textwidth, $textwidth * 2, $color_id, $font, $text);
         imagesettile($img, $tile);
         imagefilledrectangle($img, 0, 0, $w - 1, $h - 1, IMG_COLOR_TILED);
         imagedestroy($tile);
     } else {
         $color_id = imagecolorallocate($img, $color[0], $color[1], $color[2]);
         imagettftext($img, $size, $angle, $x, $y, $color_id, $font, $text);
     }
     imagesavealpha($img, true);
     imagepng($img, $this->fw->get('TEMP') . '/watermark.png');
     imagedestroy($img);
     return $this->fw->get('TEMP') . '/watermark.png';
 }
开发者ID:k-kalashnikov,项目名称:forKoda,代码行数:65,代码来源:ImageCorrector.php


示例15: imagecreate

<?php

$tile = imagecreate(36, 36);
$base = imagecreate(150, 150);
$white = imagecolorallocate($tile, 255, 255, 255);
$black = imagecolorallocate($tile, 0, 0, 0);
$white = imagecolorallocate($base, 255, 255, 255);
$black = imagecolorallocate($base, 0, 0, 0);
/* create the dots pattern */
for ($x = 0; $x < 36; $x += 2) {
    for ($y = 0; $y < 36; $y += 2) {
        imagesetpixel($tile, $x, $y, $black);
    }
}
imagesettile($base, $tile);
imagerectangle($base, 9, 9, 139, 139, $black);
imageline($base, 9, 9, 139, 139, $black);
imagefill($base, 11, 12, IMG_COLOR_TILED);
$res = imagecolorat($base, 0, 10) == $black ? '1' : '0';
$res .= imagecolorat($base, 0, 20) == $black ? '1' : '0';
$res .= imagecolorat($base, 0, 30) == $black ? '1' : '0';
$res .= imagecolorat($base, 0, 40) == $black ? '1' : '0';
$res .= imagecolorat($base, 0, 50) == $black ? '1' : '0';
$res .= imagecolorat($base, 0, 60) == $black ? '1' : '0';
$res .= imagecolorat($base, 11, 12) == $white ? '1' : '0';
$res .= imagecolorat($base, 12, 13) == $white ? '1' : '0';
$res .= imagecolorat($base, 13, 14) == $white ? '1' : '0';
$res .= imagecolorat($base, 14, 15) == $white ? '1' : '0';
$res .= imagecolorat($base, 15, 16) == $white ? '1' : '0';
$res .= imagecolorat($base, 16, 17) == $white ? '1' : '0';
$res .= imagecolorat($base, 10, 12) == $black ? '1' : '0';
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:bug24594.php


示例16: imageColorAllocate

//Функция 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 - цвет бордера)
//Функция imagefilledpolygon() - рисует закрашенный многоугольник(1-ресурс изображения, 2 - массив координат вершин{array(x1,y1,x2,y2...)}, 3 - количество вершин точнее указанных точек, 4 - цвет заливки)
$color = imagecolorallocate($i, 128, 128, 128);
for ($iter = 0; $iter < 10000; $iter++) {
    $x = mt_rand(0, imageSX($i));
    $y = mt_rand(0, imageSY($i));
    imagesetpixel($i, $x, $y, $color);
    //Функция imagesetpixel() - рисует точку (пиксел) на заданных координатах (1-ресурс изображения, 2 - х-координата точки, 3 - у-координата точки, цвет точки)
}
$color = imagecolorallocate($i, 255, 255, 255);
imagestring($i, 5, 150, 50, "PHP", $color);
开发者ID:echmaster,项目名称:data,代码行数:31,代码来源:image3.php


示例17: createBackground

 public function createBackground()
 {
     $this->tiles = imagecreatefromjpeg($this->path . '/img/tiles.jpg');
     $this->middle = imagecreatefromjpeg($this->path . '/img/tile_center.jpg');
     $this->background = imagecreatetruecolor($this->sizeX * 20, $this->sizeY * 20);
     imagesettile($this->background, $this->tiles);
     imagefilledrectangle($this->background, 0, 0, $this->sizeX * 20, $this->sizeY * 20, IMG_COLOR_TILED);
     imageCopy($this->background, $this->middle, $this->sizeX * 10 - 5, $this->sizeY * 10 - 5, 0, 0, 10, 10);
 }
开发者ID:Cteha,项目名称:coc-baseimage,代码行数:9,代码来源:image.php


示例18: imagecolorallocate

    for ($i = 0; $i < $steps; $i++) {
        $r = $s[0] - ($s[0] - $e[0]) / $steps * $i;
        $g = $s[1] - ($s[1] - $e[1]) / $steps * $i;
        $b = $s[2] - ($s[2] - $e[2]) / $steps * $i;
        $color = imagecolorallocate($img, $r, $g, $b);
        imagefilledrectangle($img, $x, $y + $i, $x1, $y + $i + 1, $color);
    }
    return true;
}
$imgWidth = 1920;
$imgHeight = 1080 + floor($argv[1] * 20);
$img = imagecreatetruecolor($imgWidth, $imgHeight);
image_gradientrect($img, 0, 0, $imgWidth, floor($imgHeight * 0.5), $pal['color5'], $pal['color4']);
image_gradientrect($img, 0, ceil($imgHeight * 0.5), $imgWidth, $imgHeight, $pal['color4'], $pal['color3']);
$water_pattern = imagecreatefrompng('assets/botb_bg.png');
imagesettile($img, $water_pattern);
imagefilledrectangle($img, 0, 0, $imgWidth, $imgHeight, IMG_COLOR_TILED);
imagedestroy($water_pattern);
imagepng($img, 'assets/background.png');
imagedestroy($img);
# create BotB logo
$text = 'battleofthebits.org';
$font = './arial-black.ttf';
$size = 160;
$spacing = -20;
function create_color($hex, $img)
{
    $r = hexdec(substr($hex, 0, 2));
    $g = hexdec(substr($hex, 2, 2));
    $b = hexdec(substr($hex, 4, 2));
    return imagecolorallocatealpha($img, $r, $g, $b, 0);
开发者ID:langel,项目名称:botb-instavid,代码行数:31,代码来源:assets_create.php


示例19: generate_image_from_json

 function generate_image_from_json($json_filename)
 {
     // Load the JSON into an array.
     $pixel_array = json_decode($this->cache_manager($json_filename), TRUE);
     // If the pixel array is empty, bail out of this function.
     if (empty($pixel_array)) {
         return;
     }
     // Calculate the final width & final height
     $width_pixelate = $this->width_resampled * $this->block_size_x;
     $height_pixelate = $this->height_resampled * $this->block_size_y;
     // Set the canvas for the processed image & resample the source image.
     $image_processed = imagecreatetruecolor($width_pixelate, $height_pixelate);
     $background_color = imagecolorallocate($image_processed, 20, 20, 20);
     imagefill($image_processed, 0, 0, IMG_COLOR_TRANSPARENT);
     // Process the pixel_array
     $blocks = array();
     foreach ($pixel_array['pixels'] as $position_y => $pixel_row) {
         $box_y = $position_y * $this->block_size_y;
         foreach ($pixel_row as $position_x => $pixel) {
             $box_x = $position_x * $this->block_size_x;
             $color = imagecolorclosest($image_processed, $pixel['rgba']['red'], $pixel['rgba']['green'], $pixel['rgba']['blue']);
             imagefilledrectangle($image_processed, $box_x, $box_y, $box_x + $this->block_size_x, $box_y + $this->block_size_y, $color);
         }
     }
     // Place a tiled overlay on the image.
     if ($this->row_flip_horizontal) {
         imageflip($image_processed, IMG_FLIP_HORIZONTAL);
     }
     // Apply a gaussian blur.
     if (FALSE) {
         $blur_matrix = array(array(1.0, 2.0, 1.0), array(2.0, 4.0, 2.0), array(1.0, 2.0, 1.0));
         imageconvolution($image_processed, $blur_matrix, 16, 0);
     }
     // Process the filename & save the image files.
     if ($this->generate_images) {
         if ($this->overlay_image) {
             // Place a tiled overlay on the image.
             $tiled_overlay = imagecreatefrompng($this->overlay_tile_file);
             imagealphablending($image_processed, true);
             imagesettile($image_processed, $tiled_overlay);
             imagefilledrectangle($image_processed, 0, 0, $width_pixelate, $height_pixelate, IMG_COLOR_TILED);
             imagedestroy($tiled_overlay);
         }
         $image_filenames = array();
         foreach ($this->image_types as $image_type) {
             // If the cache directory doesn’t exist, create it.
             if (!is_dir($this->cache_path[$image_type])) {
                 mkdir($this->cache_path[$image_type], $this->directory_permissions, true);
             }
             // Process the filename & generate the image files.
             $filename = $this->create_filename($this->image_file, $image_type);
             if ($image_type == 'gif' && !file_exists($filename)) {
                 imagegif($image_processed, $filename, $this->image_quality['gif']);
             } else {
                 if ($image_type == 'jpeg' && !file_exists($filename)) {
                     imagejpeg($image_processed, $filename, $this->image_quality['jpeg']);
                 } else {
                     if ($image_type == 'png' && !file_exists($filename)) {
                         imagepng($image_processed, $filename, $this->image_quality['png']);
                     }
                 }
             }
         }
     }
     imagedestroy($image_processed);
 }
开发者ID:JackSzwergold,项目名称:ASCII-PHP,代码行数:67,代码来源:Mosaic.class.php


示例20: fill

 /**
  * Fill image with given color or image source at position x,y
  *
  * @param  mixed   $source
  * @param  integer $pos_x
  * @param  integer $pos_y
  * @return Image
  */
 public function fill($source, $pos_x = null, $pos_y = null)
 {
     if (is_a($source, 'Intervention\\Image\\Image')) {
         // fill with image
         imagesettile($this->resource, $source->resource);
         $source = IMG_COLOR_TILED;
     } elseif ($this->isImageResource($source)) {
         // fill with image resource
         imagesettile($this->resource, $source);
         $source = IMG_COLOR_TILED;
     } elseif (is_string($source) && $this->isBinary($source)) {
         // fill with image from binary string
         $img = new self($source);
         imagesettile($this->resource, $img->resource);
         $source = IMG_COLOR_TILED;
     } elseif (is_string($source) && file_exists(realpath($source))) {
         $img = new self($source);
         imagesettile($this->resource, $img->resource);
         $source = IMG_COLOR_TILED;
     } else {
         // fill with color
         $source = $this->parseColor($source);
     }
     if (is_int($pos_x) && is_int($pos_y)) {
         // floodfill if exact position is defined
         imagefill($this->resource, $pos_x, $pos_y, $source);
     } else {
         // fill whole image otherwise
         imagefilledrectangle($this->resource, 0, 0, $this->width - 1, $this->height - 1, $source);
     }
     return $this;
 }
开发者ID:bytebybyte,项目名称:laravel-ecommerce,代码行数:40,代码来源:Image.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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