本文整理汇总了PHP中imageconvolution函数的典型用法代码示例。如果您正苦于以下问题:PHP imageconvolution函数的具体用法?PHP imageconvolution怎么用?PHP imageconvolution使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了imageconvolution函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: sharpenBlur
/**
* sharpen( $factor ) - factor goes from -64 to 64 where -64 is max blur and 64 is max sharpen
**/
public function sharpenBlur($factor)
{
if ($factor == 0) {
return $this;
}
// get a value thats equal to 64 - abs( factor )
// ( using min/max to limited the factor to 0 - 64 to not get out of range values )
$val1Adjustment = 64 - min(64, max(0, abs($factor)));
// the base factor for the "current" pixel depends on if we are blurring or sharpening.
// If we are blurring use 1, if sharpening use 9.
$val1Base = abs($factor) != $factor ? 1 : 9;
// value for the center/currrent pixel is:
// 1 + 0 - max blurring
// 1 + 64- minimal blurring
// 9 + 64- minimal sharpening
// 9 + 0 - maximum sharpening
$val1 = $val1Base + $val1Adjustment;
// the value for the surrounding pixels is either positive or negative depending on if we are blurring or sharpening.
$val2 = abs($factor) != $factor ? 1 : -1;
// setup matrix ..
$matrix = array(array($val2, $val2, $val2), array($val2, $val1, $val2), array($val2, $val2, $val2));
// calculate the correct divisor
// actual divisor is equal to "$divisor = $val1 + $val2 * 8;"
// but the following line is more generic
$divisor = array_sum(array_map('array_sum', $matrix));
// apply the matrix
imageconvolution($this->image, $matrix, $divisor, 0);
return $this;
}
开发者ID:soundake,项目名称:pd,代码行数:32,代码来源:Image.php
示例2: resize
public static function resize($file_name, $file_type)
{
switch ($file_type) {
// узнаем тип картинки
case "image/gif":
$im = imagecreatefromgif($file_name);
break;
case "image/jpeg":
$im = imagecreatefromjpeg($file_name);
break;
case "image/png":
$im = imagecreatefrompng($file_name);
break;
case "image/pjpeg":
$im = imagecreatefromjpeg($file_name);
break;
}
list($w, $h) = getimagesize($file_name);
// берем высоту и ширину
$koe = $w / 600;
// вычисляем коэффициент 600 это ширина которая должна быть
$new_h = ceil($h / $koe);
// с помощью коэффициента вычисляем высоту
$im1 = imagecreatetruecolor(600, $new_h);
// создаем картинку
imagecopyresampled($im1, $im, 0, 0, 0, 0, 600, $new_h, imagesx($im), imagesy($im));
imageconvolution($im1, array(array(-1, -1, -1), array(-1, 16, -1), array(-1, -1, -1)), 8, 0);
imagejpeg($im1, $file_name, 100);
// переводим в jpg
imagedestroy($im);
imagedestroy($im1);
}
开发者ID:KGB-Steam,项目名称:test,代码行数:32,代码来源:Functions.php
示例3: image
function image($mot)
{
$size = 40;
$marge = 5;
$box = imagettfbbox($size, 0, 'police/actionj.ttf', $mot);
$largeur = $box[2] - $box[0];
$hauteur = $box[1] - $box[7];
$largeur_lettre = round($largeur / strlen($mot));
$font = 'police/actionj.ttf';
// Flou Gaussien
$matrix_blur = array(array(1, 1, 1), array(1, 1, 1), array(1, 1, 1));
$img = imagecreate($largeur + $marge * 2, $hauteur + $marge * 2);
$blanc = imagecolorallocate($img, 255, 255, 255);
$noir = imagecolorallocate($img, 0, 0, 0);
$special_couleur = array(imagecolorallocate($img, 30, 140, 130), imagecolorallocate($img, 200, 14, 130), imagecolorallocate($img, 30, 140, 13), imagecolorallocate($img, 0, 140, 208), imagecolorallocate($img, 80, 180, 130), imagecolorallocate($img, 30, 255, 0));
for ($i = 0; $i < strlen($mot); $i++) {
$l = $mot[$i];
$angle = mt_rand(-35, 35);
//On génère un angle entre -35 et 35 degrés
//On écrit et on place le texte dans l'image
imagettftext($img, $size, $angle, $i * $largeur_lettre + $marge, $hauteur + mt_rand(0, $marge / 2), $special_couleur[array_rand($special_couleur)], $font, $l);
}
imageline($img, 2, mt_rand(2, $hauteur), $largeur + $marge, mt_rand(2, $hauteur), $noir);
//On réalise des barres aléatoires
imageline($img, 2, mt_rand(2, $hauteur), $largeur + $marge, mt_rand(2, $hauteur), $noir);
imageconvolution($img, $matrix_blur, 9, 0);
// On applique la matrice, avec un diviseur 9
imageconvolution($img, $matrix_blur, 9, 0);
imagepng($img);
//affiche l'image au format png
imagedestroy($img);
//libère toute la mémoire associé à l'image
}
开发者ID:smartful,项目名称:yourgroups,代码行数:33,代码来源:capcha.php
示例4: gaussianBlur
function gaussianBlur($gd, $direction = 90, $speed = 1.0, $bidirectional = TRUE)
{
$map = array(array(1, 0), array(2, 0), array(2, 1), array(2, 2), array(1, 2), array(0, 2), array(0, 1), array(0, 0));
// Convert the 360 degree direction to a 0-7 direction index (float)
$direction %= 360;
$direction /= 45;
// Create an empty convolution matrix
$matrix = array_fill(0, 3, array(0.0, 0.0, 0.0));
$matrix[1][1] = 1.0;
// Find the starting index (the counter-clockwise side)
$index = (int) $direction;
// Calculate how much of the speed should be passed to the next direction
$spread = fmod($direction, 1.0);
// Counter-clockwise side gets the inverse of $spread
list($x, $y) = $map[$index];
$matrix[$x][$y] = $speed * (1.0 - $spread);
if ($bidirectional) {
// Apply the same 180 degrees opposed
list($x, $y) = $map[($index + 4) % 8];
$matrix[$x][$y] = $speed * (1.0 - $spread);
}
// Clockwise side gets the rest from $spread
list($x, $y) = $map[($index + 1) % 8];
$matrix[$x][$y] = $speed * $spread;
if ($bidirectional) {
// Apply the same 180 degrees opposed
list($x, $y) = $map[($index + 5) % 8];
$matrix[$x][$y] = $speed * $spread;
}
$divisor = array_sum(array_map('array_sum', $matrix));
imageconvolution($gd, $matrix, $divisor, 0);
return $gd;
}
开发者ID:hemantshekhawat,项目名称:Snippets,代码行数:33,代码来源:blur.php
示例5: captcha
function captcha($mot)
{
$size = 64;
$marge = 15;
$font = '../fonts/angelina.ttf';
$matrix_blur = array(array(1, 1, 1), array(1, 1, 1), array(1, 1, 1));
$box = imagettfbbox($size, 0, $font, $mot);
$largeur = $box[2] - $box[0];
$hauteur = $box[1] - $box[7];
$largeur_lettre = round($largeur / strlen($mot));
$img = imagecreate($largeur + $marge, $hauteur + $marge);
$blanc = imagecolorallocate($img, 255, 255, 255);
$noir = imagecolorallocate($img, 0, 0, 0);
$couleur = array(imagecolorallocate($img, 0x99, 0x0, 0x66), imagecolorallocate($img, 0xcc, 0x0, 0x0), imagecolorallocate($img, 0x0, 0x0, 0xcc), imagecolorallocate($img, 0x0, 0x0, 0xcc), imagecolorallocate($img, 0xbb, 0x88, 0x77));
for ($i = 0; $i < strlen($mot); ++$i) {
$l = $mot[$i];
$angle = mt_rand(-35, 35);
imagettftext($img, mt_rand($size - 7, $size), $angle, $i * $largeur_lettre + $marge, $hauteur + mt_rand(0, $marge / 2), $couleur[array_rand($couleur)], $font, $l);
}
imageline($img, 2, mt_rand(2, $hauteur), $largeur + $marge, mt_rand(2, $hauteur), $noir);
imageline($img, 2, mt_rand(2, $hauteur), $largeur + $marge, mt_rand(2, $hauteur), $noir);
imageconvolution($img, $matrix_blur, 10, 10);
imageconvolution($img, $matrix_blur, 10, 0);
imagepng($img);
imagedestroy($img);
}
开发者ID:ChristopheSio,项目名称:GSB,代码行数:26,代码来源:captcha.php
示例6: show
/**
* Show the captcha image.
*
* @param integer $iRandom
* @return void
*/
public function show($iRandom = null)
{
if (!empty($iRandom)) {
$this->_sStr = Various::genRnd($iRandom, 5);
} else {
$this->_sStr = Various::genRnd('pH7_Pierre-Henry_Soria_Sanz_González_captcha', 5);
}
$this->_oSession->set('rand_code', $this->_sStr);
$this->_sFont = $this->_getFont();
//$sBackground = PH7_PATH_DATA . 'background/' . mt_rand(1, 5) . '.png';
$this->_aBox = imagettfbbox($this->_iSize, 0, $this->_sFont, $this->_sStr);
$this->_iWidth = $this->_aBox[2] - $this->_aBox[0];
$this->_iHeight = $this->_aBox[1] - $this->_aBox[7];
unset($this->_aBox);
$this->_iStringWidth = round($this->_iWidth / strlen($this->_sStr));
//$this->_rImg = imagecreatefrompng($sBackground);
$this->_rImg = imagecreate($this->_iWidth + $this->_iMargin, $this->_iHeight + $this->_iMargin);
$this->_aColor = array(imagecolorallocate($this->_rImg, 0x99, 0x0, 0x66), imagecolorallocate($this->_rImg, 0xcc, 0x0, 0x0), imagecolorallocate($this->_rImg, 0x0, 0x0, 0xcc), imagecolorallocate($this->_rImg, 0x0, 0x0, 0xcc), imagecolorallocate($this->_rImg, 0xbb, 0x88, 0x77));
$this->_rBlack = imagecolorallocate($this->_rImg, 0, 0, 0);
$this->_rRed = imagecolorallocate($this->_rImg, 200, 100, 90);
$this->_rWhite = imagecolorallocate($this->_rImg, 255, 255, 255);
imagefilledrectangle($this->_rImg, 0, 0, 399, 99, $this->_rWhite);
$this->_mixing();
imageline($this->_rImg, mt_rand(2, $this->_iWidth + $this->_iMargin), mt_rand(1, $this->_iWidth + $this->_iMargin), mt_rand(1, $this->_iHeight + $this->_iMargin), mt_rand(2, $this->_iWidth + $this->_iMargin), $this->_rBlack);
imageline($this->_rImg, mt_rand(2, $this->_iHeight + $this->_iMargin), mt_rand(1, $this->_iHeight + $this->_iMargin), mt_rand(1, $this->_iWidth + $this->_iMargin), mt_rand(2, $this->_iHeight + $this->_iMargin), $this->_rRed);
imageline($this->_rImg, mt_rand(2, $this->_iHeight + $this->_iMargin), mt_rand(1, $this->_iWidth + $this->_iMargin), mt_rand(1, $this->_iWidth + $this->_iMargin), mt_rand(2, $this->_iHeight + $this->_iMargin), $this->_aColor[array_rand($this->_aColor)]);
unset($this->_rBlack, $this->_rRed, $this->_rWhite);
imageconvolution($this->_rImg, $this->_aMatrixBlur, 9, 0);
imageconvolution($this->_rImg, $this->_aMatrixBlur, 9, 0);
unset($this->_aMatrixBlur);
(new Browser())->noCache();
header('Content-type: image/png');
imagepng($this->_rImg);
imagedestroy($this->_rImg);
}
开发者ID:huangciyin,项目名称:pH7-Social-Dating-CMS,代码行数:41,代码来源:Captcha.class.php
示例7: compress
function compress($path, $res)
{
$size = getimagesize($path);
$width = $size[0];
$height = $size[1];
$quality = 75;
$xRatio = $res / $width;
$yRatio = $res / $height;
$tnHeight;
$tnWidth;
if ($xRatio * $height < $rse) {
// Resize the image based on width
$tnHeight = ceil($xRatio * $height);
$tnWidth = $res;
} else {
$tnWidth = ceil($yRatio * $width);
$tnHeight = $res;
}
ini_set('memory_limit', MEMORY_TO_ALLOCATE);
$dst = imagecreatetruecolor($tnWidth, $tnHeight);
$src;
$newfile = dirname($path) . '/' . $res . '/' . $res . '_' . basename($path);
switch ($size['mime']) {
case 'image/gif':
$src = imagecreatefromgif($path);
$this->setalpha($dst);
$quality = round(10 - $quality / 10);
$sharpen = false;
$createfile = 'imagepng';
break;
case 'image/x-png':
case 'image/png':
$src = imagecreatefrompng($path);
$this->setalpha($dst);
$quality = round(10 - $quality / 10);
$sharpen = false;
$createfile = 'imagepng';
break;
default:
$src = imagecreatefromjpeg($path);
$sharpen = true;
$createfile = 'imagejpeg';
break;
}
imagecopyresampled($dst, $src, 0, 0, 0, 0, $tnWidth, $tnHeight, $width, $height);
if ($sharpen) {
$sharpness = $this->findSharp($width, $tnWidth);
$sharpenMatrix = array(array(-1, -2, -1), array(-2, $sharpness + 12, -2), array(-1, -2, -1));
$divisor = $sharpness;
$offset = 0;
imageconvolution($dst, $sharpenMatrix, $divisor, $offset);
}
if (!file_exists(dirname($path))) {
mkdir(dirname($path));
}
$createfile($dst, $newfile, $quality);
imagedestroy($src);
imagedestroy($dst);
}
开发者ID:abdulnizam,项目名称:php-freniz,代码行数:59,代码来源:compressimage.php
示例8: execute
/**
* Executes imageconvolution() filter.
*
* @param WideImage_Image $image
* @param array $matrix
* @param numeric $div
* @param numeric $offset
*
* @return WideImage_Image
*/
public function execute($image, $matrix, $div, $offset)
{
$new = $image->asTrueColor();
if (!imageconvolution($new->getHandle(), $matrix, $div, $offset)) {
throw new WideImage_GDFunctionResultException('imageconvolution() returned false');
}
return $new;
}
开发者ID:dongilbert,项目名称:mautic,代码行数:18,代码来源:ApplyConvolution.php
示例9: transform
public function transform(CGImageBase $src)
{
// copy the image (pixel for pixel)
$_dest = new CGImageBase($src);
imagecopy($_dest['rsrc'], $src['rsrc'], 0, 0, 0, 0, $src['width'], $src['height']);
imageconvolution($_dest['rsrc'], $this->_matrix, $this->_divisor, 0);
return $_dest;
}
开发者ID:rainbow-studio,项目名称:cmsms,代码行数:8,代码来源:class.CGImage_Sharpen_Filter.php
示例10: execute
function execute($image, $matrix, $div, $offset)
{
$new = $image->asTrueColor();
if (!imageconvolution($new->getHandle(), $matrix, $div, $offset)) {
JError::raiseError(500, "imageconvolution() returned false");
}
return $new;
}
开发者ID:iFactoryDigital,项目名称:gympieradiology,代码行数:8,代码来源:ApplyConvolution.php
示例11: sharpen
/**
* {@inheritdoc}
*/
public function sharpen()
{
$sharpenMatrix = array(array(-1, -1, -1), array(-1, 16, -1), array(-1, -1, -1));
$divisor = array_sum(array_map('array_sum', $sharpenMatrix));
if (false === imageconvolution($this->resource, $sharpenMatrix, $divisor, 0)) {
throw new RuntimeException('Failed to sharpen the image');
}
return $this;
}
开发者ID:BeerMan88,项目名称:yii,代码行数:12,代码来源:Effects.php
示例12: applySharpening
private function applySharpening()
{
if (!function_exists('imageconvolution')) {
return;
}
if ($this->sharpening !== 1) {
$this->sharpening = abs(1 - $this->sharpening);
}
$matrix = array(array(-1, -1, -1), array(-1, ceil($this->sharpening * 60), -1), array(-1, -1, -1));
$divisor = array_sum(array_map('array_sum', $matrix));
imageconvolution($this->finalImage, $matrix, $divisor, 0);
}
开发者ID:Atomox,项目名称:benhelmerphotography,代码行数:12,代码来源:DarkroomGD2.php
示例13: execute
/**
* Sharpen image
*
* @param Intervention\Image\Image $image
* @return boolean
*/
public function execute($image)
{
$amount = $this->argument(0)->between(0, 100)->value(10);
// build matrix
$min = $amount >= 10 ? $amount * -0.01 : 0;
$max = $amount * -0.025;
$abs = (4 * $min + 4 * $max) * -1 + 1;
$div = 1;
$matrix = array(array($min, $max, $min), array($max, $abs, $max), array($min, $max, $min));
// apply the matrix
return imageconvolution($image->getCore(), $matrix, $div, 0);
}
开发者ID:RHoKAustralia,项目名称:onaroll21_backend,代码行数:18,代码来源:SharpenCommand.php
示例14: apply
/**
* @param Image $image
*
* @return Image
*/
public function apply($image)
{
$amount = $this->amount;
// build matrix
$min = $amount >= 10 ? $amount * -0.01 : 0;
$max = $amount * -0.025;
$abs = (4 * $min + 4 * $max) * -1 + 1;
$div = 1;
$matrix = array(array($min, $max, $min), array($max, $abs, $max), array($min, $max, $min));
// apply the matrix
imageconvolution($image->getCore(), $matrix, $div, 0);
return $image;
}
开发者ID:kosinix,项目名称:grafika,代码行数:18,代码来源:Sharpen.php
示例15: imageconvolution
/**
* imageconvolution replacement for when the gd function is missing.
*
* @author Chao Xu
* @param himage $src The image
* @param array $filter The array
* @param float $div Filter divisor
* @param float $offset Filter offset
*/
static function imageconvolution($src, $filter, $div, $offset)
{
if (function_exists('imageconvolution')) {
return imageconvolution($himage, $m, $div, $offs);
}
if ($src == NULL) {
return 0;
}
$sx = imagesx($src);
$sy = imagesy($src);
$srcback = ImageCreateTrueColor($sx, $sy);
ImageCopy($srcback, $src, 0, 0, 0, 0, $sx, $sy);
if ($srcback == NULL) {
return 0;
}
$pxl = array(1, 1);
for ($y = 0; $y < $sy; ++$y) {
for ($x = 0; $x < $sx; ++$x) {
$new_r = $new_g = $new_b = 0;
$alpha = imagecolorat($srcback, $pxl[0], $pxl[1]);
$new_a = $alpha >> 24;
for ($j = 0; $j < 3; ++$j) {
$yv = min(max($y - 1 + $j, 0), $sy - 1);
for ($i = 0; $i < 3; ++$i) {
$pxl = array(min(max($x - 1 + $i, 0), $sx - 1), $yv);
$rgb = imagecolorat($srcback, $pxl[0], $pxl[1]);
$new_r += ($rgb >> 16 & 0xff) * $filter[$j][$i];
$new_g += ($rgb >> 8 & 0xff) * $filter[$j][$i];
$new_b += ($rgb & 0xff) * $filter[$j][$i];
}
}
$new_r = $new_r / $div + $offset;
$new_g = $new_g / $div + $offset;
$new_b = $new_b / $div + $offset;
$new_r = $new_r > 255 ? 255 : ($new_r < 0 ? 0 : $new_r);
$new_g = $new_g > 255 ? 255 : ($new_g < 0 ? 0 : $new_g);
$new_b = $new_b > 255 ? 255 : ($new_b < 0 ? 0 : $new_b);
$new_pxl = ImageColorAllocateAlpha($src, (int) $new_r, (int) $new_g, (int) $new_b, $new_a);
if ($new_pxl == -1) {
$new_pxl = ImageColorClosestAlpha($src, (int) $new_r, (int) $new_g, (int) $new_b, $new_a);
}
if ($y >= 0 && $y < $sy) {
imagesetpixel($src, $x, $y, $new_pxl);
}
}
}
imagedestroy($srcback);
return 1;
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:58,代码来源:graphics.php
示例16: blur
public function blur()
{
// resource
$res = $this->src_image;
if (is_resource($this->dst_image)) {
$res = $this->dst_image;
}
// define matrix
$gaussian = array(array(1.0, 2.0, 1.0), array(2.0, 4.0, 2.0), array(1.0, 2.0, 1.0));
// calculate the divisor
$divisor = array_sum(array_map('array_sum', $gaussian));
// apply the matrix
imageconvolution($res, $gaussian, $divisor, 0);
return $this;
}
开发者ID:anchorcms,项目名称:anchor-cms,代码行数:15,代码来源:image.php
示例17: imageBlurGD
/**
* provides image blur support for lib-GD:zp_imageUnsharpMask
*
* @param image $imgCanvas
* @param int $radius
* @param int $w
* @param int $h
*/
function imageBlurGD($imgCanvas, $imgCanvas2, $radius, $w, $h)
{
// Gaussian blur matrix:
// 1 2 1
// 2 4 2
// 1 2 1
//////////////////////////////////////////////////
for ($i = 0; $i < $radius; $i++) {
if (function_exists('imageconvolution')) {
// PHP >= 5.1
$matrix = array(array(1, 2, 1), array(2, 4, 2), array(1, 2, 1));
imageconvolution($imgCanvas, $matrix, 16, 0);
}
}
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:23,代码来源:_functions_GD.php
示例18: execute
/**
* Method to apply a filter to an image resource.
*
* @param array $options An array of options for the filter.
*
* @return void
*
* @since 11.3
* @throws RuntimeException
*/
public function execute(array $options = array())
{
// Verify that image filter support for PHP is available.
if (!function_exists('imagefilter')) {
// @codeCoverageIgnoreStart
JLog::add('The imagefilter function for PHP is not available.', JLog::ERROR);
throw new RuntimeException('The imagefilter function for PHP is not available.');
// @codeCoverageIgnoreEnd
}
// Sharpen the image
$sharpenMatrix = array(array(-1, -1, -1), array(-1, 16, -1), array(-1, -1, -1));
$divisor = 8;
$offset = 0;
imageconvolution($this->handle, $sharpenMatrix, $divisor, $offset);
}
开发者ID:ErickLopez76,项目名称:offiria,代码行数:25,代码来源:sharpen.php
示例19: __construct
public function __construct($image, array $sharpen_matrix = null)
{
if (is_array($sharpen_matrix)) {
$this->sharpen_matrix = $sharpen_matrix;
}
if ($image instanceof ImageInterface) {
$image = $image->getResource();
}
if (!is_resource($image)) {
throw new \InvalidArgumentException("Image resource expected");
}
$offset = 0;
$divisor = array_sum(array_map('array_sum', $this->sharpen_matrix));
imageconvolution($image, $this->sharpen_matrix, $divisor, $offset);
}
开发者ID:tomkyle,项目名称:yaphr,代码行数:15,代码来源:SharpenImage.php
示例20: applyOn
/**
* Apply this filter on a given image. Note: This changes the given image!
*
* @param img.Image image
* @return bool
* @throws img.ImagingException
*/
public function applyOn($image)
{
// Use builtin function (exists as of 5.1.0)
if (function_exists('imageconvolution')) {
return imageconvolution($image->handle, $this->kernel->getMatrix(), $this->divisor, $this->offset);
}
$clone = clone $image;
// Create local variables for faster access
$chandle = $clone->handle;
$ihandle = $image->handle;
$matrix = $this->kernel->getMatrix();
$divisor = $this->divisor;
$offset = $this->offset;
$w = $image->getWidth();
$h = $image->getHeight();
for ($y = 0; $y < $h; $y++) {
for ($x = 0; $x < $w; $x++) {
$nr = $ng = $nb = 0;
// Apply matrix
for ($j = 0; $j < 3; $j++) {
$max = $y - 1 + $j;
$min = $max < 0 ? 0 : $max;
$yv = $min >= $h ? $h - 1 : $min;
for ($i = 0; $i < 3; $i++) {
$max = $x - 1 + $i;
$min = $max < 0 ? 0 : $max;
$xv = $min >= $w ? $w - 1 : $min;
$rgb = imagecolorat($chandle, $xv, $yv);
$m = $matrix[$j][$i];
$nr += ($rgb >> 16 & 0xff) * $m;
$ng += ($rgb >> 8 & 0xff) * $m;
$nb += ($rgb & 0xff) * $m;
}
}
// Apply divisor and offset
$nr = $nr / $divisor + $offset;
$ng = $ng / $divisor + $offset;
$nb = $nb / $divisor + $offset;
// Normalize
$nr = $nr > 255.0 ? 255.0 : ($nr < 0.0 ? 0.0 : $nr);
$ng = $ng > 255.0 ? 255.0 : ($ng < 0.0 ? 0.0 : $ng);
$nb = $nb > 255.0 ? 255.0 : ($nb < 0.0 ? 0.0 : $nb);
imagesetpixel($ihandle, $x, $y, imagecolorallocate($ihandle, $nr, $ng, $nb));
}
}
unset($clone);
}
开发者ID:xp-framework,项目名称:imaging,代码行数:54,代码来源:ConvolveFilter.class.php
注:本文中的imageconvolution函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论