From ccede092d056521a291cc1be96a891d2f105b457 Mon Sep 17 00:00:00 2001 From: MEUNIER Thibaud Date: Sat, 9 Mar 2019 13:55:23 +0100 Subject: [PATCH] splinelineblack is not only black ... --- blockchain/inc/block.php | 13 ++++++++ methode2/splinelineblack/draw.php | 49 +++++++++++++++++++++++++++---- 2 files changed, 57 insertions(+), 5 deletions(-) diff --git a/blockchain/inc/block.php b/blockchain/inc/block.php index 9bbe1f9..1f6e72a 100644 --- a/blockchain/inc/block.php +++ b/blockchain/inc/block.php @@ -359,6 +359,19 @@ class blockchain [240,147,43], [255,255,255] ], + // pour splinelineblack + [ + [17,61,86], + [254,254,254] + ], + [ + [17,61,86], + [255,134,63] + ], + [ + [234,220,207], + [127,106,85] + ], [ [48,51,107], [255,255,255] diff --git a/methode2/splinelineblack/draw.php b/methode2/splinelineblack/draw.php index c93c703..a727e24 100644 --- a/methode2/splinelineblack/draw.php +++ b/methode2/splinelineblack/draw.php @@ -28,15 +28,47 @@ function DrawBlock($the_block, $vImage, $parametres) if (isset($parametres['font_RGB'])) $vFgRGB = $parametres['font_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 - $couleur=3; - if (rand(0,100) < 50) $couleur = 5; 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]); - $couleurRGB=[240,147,43]; $couleur=imagecolorallocate($vImage,$couleurRGB[0],$couleurRGB[1],$couleurRGB[2]); // Remplir le fond @@ -67,6 +99,13 @@ function DrawBlock($the_block, $vImage, $parametres) for($i=0;$i<$nb_colors;$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]->pct = ((192+$i)*1.0) / 256; $vColor[192+$i]->color = imagecolorallocate($vImage, $rgbval[0], $rgbval[1], $rgbval[2]);