array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'pt_BR', ), 'this' => array ( 0 => 'function.imagelayereffect.php', 1 => 'imagelayereffect', ), 'up' => array ( 0 => 'ref.image.php', 1 => 'Funções de GD e Image', ), 'prev' => array ( 0 => 'function.imagejpeg.php', 1 => 'imagejpeg', ), 'next' => array ( 0 => 'function.imageline.php', 1 => 'imageline', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'pt_BR', 'path' => 'reference/image/functions/imagelayereffect.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
imagelayereffect — Define a opção de mesclagem alfa para usar efeitos de camada
Define a opção de mesclagem alfa para usar efeitos de camada.
image
Um objeto GdImage, retornado por uma das funções de criação de imagem, como imagecreatetruecolor().
effect
Uma das constantes a seguir:
IMG_EFFECT_REPLACE
true
para
imagealphablending())
IMG_EFFECT_ALPHABLEND
false
para
imagealphablending())
IMG_EFFECT_NORMAL
IMG_EFFECT_ALPHABLEND
.
IMG_EFFECT_OVERLAY
IMG_EFFECT_MULTIPLY
Versão | Descrição |
---|---|
8.0.0 |
O parâmetro image agora espera uma instância de GdImage;
anteriormente, um resource gd válido era esperado.
|
7.2.0 |
Adicionada a constante IMG_EFFECT_MULTIPLY (requer libgd de sistema >=
2.1.1 ou a libgd incluída no pacote).
|
Exemplo #1 Exemplo de imagelayereffect()
<?php
// Configura uma imagem
$im = imagecreatetruecolor(100, 100);
// Define a cor de fundo
imagefilledrectangle($im, 0, 0, 100, 100, imagecolorallocate($im, 220, 220, 220));
// Applica a opção de mesclagem alfa de sobreposição
imagelayereffect($im, IMG_EFFECT_OVERLAY);
// Desenha duas elipses cinzas
imagefilledellipse($im, 50, 50, 40, 40, imagecolorallocate($im, 100, 255, 100));
imagefilledellipse($im, 50, 50, 50, 80, imagecolorallocate($im, 100, 100, 255));
imagefilledellipse($im, 50, 50, 80, 50, imagecolorallocate($im, 255, 100, 100));
// Mostra
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>
O exemplo acima produzirá algo semelhante a: