function image_decal_couleur($coul, $gamma) { include_spip('filtres/images_lib'); return _image_decale_composante($coul, $gamma); }
function image_gamma($im, $gamma = 0) { include_spip('filtres/images_lib'); $fonction = array('image_gamma', func_get_args()); $image = _image_valeurs_trans($im, "gamma-{$gamma}", false, $fonction); if (!$image) { return ""; } $x_i = $image["largeur"]; $y_i = $image["hauteur"]; $im = $image["fichier"]; $dest = $image["fichier_dest"]; $creer = $image["creer"]; if ($creer) { // Creation de l'image en deux temps // de facon a conserver les GIF transparents $im = $image["fonction_imagecreatefrom"]($im); imagepalettetotruecolor($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); imagecopy($im_, $im, 0, 0, 0, 0, $x_i, $y_i); for ($x = 0; $x < $x_i; $x++) { for ($y = 0; $y < $y_i; $y++) { $rgb = ImageColorAt($im_, $x, $y); $a = $rgb >> 24 & 0xff; $r = $rgb >> 16 & 0xff; $g = $rgb >> 8 & 0xff; $b = $rgb & 0xff; $r = _image_decale_composante($r, $gamma); $g = _image_decale_composante($g, $gamma); $b = _image_decale_composante($b, $gamma); $color = ImageColorAllocateAlpha($im_, $r, $g, $b, $a); imagesetpixel($im_, $x, $y, $color); } } _image_gd_output($im_, $image); } return _image_ecrire_tag($image, array('src' => $dest)); }