|
|
@ -28,15 +28,47 @@ function DrawBlock($the_block, $vImage, $parametres) |
|
|
if (isset($parametres['font_RGB'])) $vFgRGB = $parametres['font_RGB'];
|
|
|
if (isset($parametres['font_RGB'])) $vFgRGB = $parametres['font_RGB'];
|
|
|
if (isset($parametres['background_RGB'])) $vBgRGB = $parametres['background_RGB'];
|
|
|
if (isset($parametres['background_RGB'])) $vBgRGB = $parametres['background_RGB'];
|
|
|
|
|
|
|
|
|
|
|
|
// Forcer les couleurs
|
|
|
|
|
|
$hasard = rand(0,10);
|
|
|
|
|
|
$couleur=3;$val=0;
|
|
|
|
|
|
if ($hasard > $val++) $couleur = 5;
|
|
|
|
|
|
if ($hasard > $val++) $couleur = 6;
|
|
|
|
|
|
if ($hasard > $val++) $couleur = 7;
|
|
|
|
|
|
if ($hasard > $val++) $couleur = 8;
|
|
|
|
|
|
|
|
|
|
|
|
$couleur = 8;
|
|
|
|
|
|
switch($couleur) {
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
case 5:
|
|
|
|
|
|
$fondRGB=[0,0,0];
|
|
|
|
|
|
$couleurRGB=[240,147,43];
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 7:
|
|
|
|
|
|
$fondRGB=[17,61,86];
|
|
|
|
|
|
$couleurRGB=[255,134,63];
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 8:
|
|
|
|
|
|
$fondRGB=[234,220,207];
|
|
|
|
|
|
$couleurRGB=[252,196,37];
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
$fondRGB=[17,61,86];
|
|
|
|
|
|
$couleurRGB=[73,20,26];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$img_w = $width;
|
|
|
|
|
|
$img_h = $height+(2*$y);
|
|
|
|
|
|
|
|
|
// Redessiner entête et pied de page
|
|
|
// Redessiner entête et pied de page
|
|
|
$couleur=3;
|
|
|
|
|
|
if (rand(0,100) < 50) $couleur = 5;
|
|
|
|
|
|
blockchain::DrawBlockHeaderFooter($the_block, $vImage, $y, $couleur);
|
|
|
blockchain::DrawBlockHeaderFooter($the_block, $vImage, $y, $couleur);
|
|
|
|
|
|
imagefilledrectangle($vImage, 0, $y, $width, $y + $height, $parametres['background_color']);
|
|
|
|
|
|
imageline($vImage, 0, 5, 0, $img_h-25, $parametres['font_color']);
|
|
|
|
|
|
imageline($vImage, $width-1, 5, $width-1, $img_h-25, $parametres['font_color']);
|
|
|
|
|
|
|
|
|
// Forcer les couleurs
|
|
|
|
|
|
$fondRGB=[0,0,0];
|
|
|
|
|
|
$fond=imagecolorallocate($vImage,$fondRGB[0],$fondRGB[1],$fondRGB[2]);
|
|
|
$fond=imagecolorallocate($vImage,$fondRGB[0],$fondRGB[1],$fondRGB[2]);
|
|
|
$couleurRGB=[240,147,43];
|
|
|
|
|
|
$couleur=imagecolorallocate($vImage,$couleurRGB[0],$couleurRGB[1],$couleurRGB[2]);
|
|
|
$couleur=imagecolorallocate($vImage,$couleurRGB[0],$couleurRGB[1],$couleurRGB[2]);
|
|
|
|
|
|
|
|
|
// Remplir le fond
|
|
|
// Remplir le fond
|
|
|
@ -67,6 +99,13 @@ function DrawBlock($the_block, $vImage, $parametres) |
|
|
for($i=0;$i<$nb_colors;$i++)
|
|
|
for($i=0;$i<$nb_colors;$i++)
|
|
|
{
|
|
|
{
|
|
|
$rgbval = ColorGradient::hex2rgb($gradient[$i]);
|
|
|
$rgbval = ColorGradient::hex2rgb($gradient[$i]);
|
|
|
|
|
|
// Pas de blanc <=> c'est la transparence ...
|
|
|
|
|
|
if (($rgbval[0] == $rgbval[1])&&($rgbval[1] == $rgbval[2])&&($rgbval[0] == 254))
|
|
|
|
|
|
{
|
|
|
|
|
|
$rgbval[0] = 255;
|
|
|
|
|
|
$rgbval[1] = 255;
|
|
|
|
|
|
$rgbval[2] = 255;
|
|
|
|
|
|
}
|
|
|
$vColor[192+$i] = new ColorGradient();
|
|
|
$vColor[192+$i] = new ColorGradient();
|
|
|
$vColor[192+$i]->pct = ((192+$i)*1.0) / 256;
|
|
|
$vColor[192+$i]->pct = ((192+$i)*1.0) / 256;
|
|
|
$vColor[192+$i]->color = imagecolorallocate($vImage, $rgbval[0], $rgbval[1], $rgbval[2]);
|
|
|
$vColor[192+$i]->color = imagecolorallocate($vImage, $rgbval[0], $rgbval[1], $rgbval[2]);
|
|
|
|