function image_estampage_alpha($im, $trait=1, $prof=1) { $dec1 = floor($trait/2); $dec2 = ceil($trait/2); $image = valeurs_image_trans($im, "estampage-$trait-$prof"); if (!$image) return(""); $x_i = $image["largeur"]; $y_i = $image["hauteur"]; $im = $image["fichier"]; $dest = $image["fichier_dest"]; $creer = $image["creer"]; if ($creer) { $im = $image["fonction_imagecreatefrom"]($im); $im_ = imagecreatetruecolor($x_i, $y_i); @imagealphablending($im_, false); @imagesavealpha($im_,true); $color_t = ImageColorAllocateAlpha( $im_, 255, 255, 255 , 127 ); imagefill ($im_, 0, 0, $color_t); for ($x = 0; $x < $x_i; $x++) { for ($y=0; $y < $y_i; $y++) { $rgb = ImageColorAt($im, $x, $y); $a = ($rgb >> 24) & 0xFF; $x1 = $x+$dec1; $y1 = $y+$dec1; if ($x1 < 0 OR $x1 >= $x_i) $x1 = $x; if ($y1 < 0 OR $y1 >= $y_i) $y1 = $y; $rgb1 = ImageColorAt($im, $x1, $y1); $a1 = ($rgb1 >> 24) & 0xFF; $x2 = $x-$dec2; $y2 = $y-$dec2; if ($x2 < 0 OR $x2 >= $x_i) $x2 = $x; if ($y2 < 0 OR $y2 >= $y_i) $y2 = $y; $rgb2 = ImageColorAt($im, $x2, $y2); $a2 = ($rgb2 >> 24) & 0xFF; $m = round((($a-$a1)+($a2-$a))*$prof); $m = max(min($m,127),-127); $m += 127; $color = ImageColorAllocateAlpha( $im_, $m, $m, $m , 0 ); imagesetpixel ($im_, $x, $y, $color); } } $image["fonction_image"]($im_, "$dest"); } $class = $image["class"]; if (strlen($class) > 1) $tags=" class='$class'"; $tags = "$tags alt='".$image["alt"]."'"; $style = $image["style"]; if (strlen($style) > 1) $tags="$tags style='$style'"; return ""; }