enlever le hasard

This commit is contained in:
2022-08-21 09:30:06 +02:00
parent 6d161b3804
commit 0bf16e3ab5
17 changed files with 161 additions and 174 deletions
+3 -16
View File
@@ -28,28 +28,15 @@ function DrawBlock($the_block, $vImage, $parametres)
if (isset($parametres['font_RGB'])) $vFgRGB = $parametres['font_RGB'];
if (isset($parametres['background_RGB'])) $vBgRGB = $parametres['background_RGB'];
// Une chance sur deux d'inverser entre fg et bg
if (rand(0,100) < 50) {
$fond = $vBgColor;
$couleur = $vFgColor;
$fondRGB = $vBgRGB;
$couleurRGB = $vFgRGB;
} else {
$fond = $vFgColor;
$couleur = $vBgColor;
$fondRGB = $vFgRGB;
$couleurRGB = $vBgRGB;
}
// Remplir le fond
imagefilledrectangle($vImage, $x+($marge_x/2), $y+($marge_y/2), $x+$width-+($marge_x/2), $y+$height-+($marge_y/2), $fond);
imagefilledrectangle($vImage, $x+($marge_x/2), $y+($marge_y/2), $x+$width-+($marge_x/2), $y+$height-+($marge_y/2), $vFgColor);
// Dégradé de 256 couleurs entre la couleur de fond et la couleur de dessin
$nb_colors = 256;
$vColor = array();
$hex_val = array(
ColorGradient::rgb2hex($couleurRGB),
ColorGradient::rgb2hex($fondRGB)
ColorGradient::rgb2hex($vBgRGB),
ColorGradient::rgb2hex($vFgRGB)
);
$gradient = ColorGradient::gradient($hex_val[0], $hex_val[1], $nb_colors);
for($i=0;$i<$nb_colors;$i++)