<html><body><small><small><font face="Verdana">
<?
set_time_limit(9999999);
$time_start_script = getmicrotime();
echo str_repeat(" ", 230);
$img_name = "nks4";
$grid = Array();
$steps = 300;
$border_left = 0;
$border_right = 550; // (even number for perfect symmetry)
$middle = round($border_right/2);
//*****************************************************************//
//********* Picture initialisation ********************************//
//*****************************************************************//
$image_width = $border_right+1;
$image_height = $steps;
$img = imagecreatetruecolor($image_width,$image_height);
$blanc = imagecolorallocate($img, 255,255,255);
//*****************************************************************//
//*********** First line (initial condition) **********************//
//*****************************************************************//
$y = 0; $grid[$y] = Array();
for ($x = $border_left; $x <= $border_right; $x++) {
$grid[$y][$x] = Array(abs($x-$middle)/$border_right,abs($x-$middle)/$border_right,abs($x-$middle)/$border_right);
/*DRAW*/ $color = imagecolorallocate($img, $grid[$y][$x][0]*255,$grid[$y][$x][1]*255,$grid[$y][$x][2]*255);
/*DRAW*/ imagesetpixel($img,$x,$y,$color);
}
//*****************************************************************//
for ($y = 1; $y <= $steps-1; $y++) {
/*PROGRESS*/ print(round($y/($steps-1)*100)."% ... ");flush();ob_flush();
$grid[$y] = Array();
//*****************************************************************//
//*********** Borders (limit condition) ***************************//
//*****************************************************************//
$grid[$y][$border_left] = Array(1,1,1);
$grid[$y][$border_right] = Array(1,1,1);
//*****************************************************************//
for ($x = $border_left+1; $x <= $border_right-1; $x++) {
$grid[$y][$x] = Array();
/*RULE*/ $grid[$y][$x][0] = fpart(($grid[$y-1][$x-1][0]+$grid[$y-1][$x][0]+$grid[$y-1][$x+1][0])/3*1.02);
/*RULE*/ $grid[$y][$x][1] = fpart(($grid[$y-1][$x-1][1]+$grid[$y-1][$x][1]+$grid[$y-1][$x+1][1])/3*1.085);
/*RULE*/ $grid[$y][$x][2] = fpart(($grid[$y-1][$x-1][2]+$grid[$y-1][$x][2]+$grid[$y-1][$x+1][2])/3*1.17);
/*DRAW*/ $color = imagecolorallocate($img, $grid[$y][$x][0]*255,$grid[$y][$x][1]*255,$grid[$y][$x][2]*255);
/*DRAW*/ imagesetpixel($img,$x,$y,$color);
}
/*DRAW*/ $color = imagecolorallocate($img, $grid[$y][$border_left][0]*255,$grid[$y][$border_left][1]*255,$grid[$y][$border_left][2]*255);
/*DRAW*/ imagesetpixel($img,$border_left,$y,$color);
/*DRAW*/ $color = imagecolorallocate($img, $grid[$y][$border_right][0]*255,$grid[$y][$border_right][1]*255,$grid[$y][$border_right][2]*255);
/*DRAW*/ imagesetpixel($img,$border_right,$y,$color);
/*MEM*/ unset($grid[$y-1]);
}
//header("Content-type: image/png");
imagePNG($img,"$img_name.png");imagedestroy($img);
print("<hr><center><img src=\"$img_name.png\"></center><hr>Généré en ". round(getmicrotime()-$time_start_script,1) ." secondes.<br>Taille de l'image: ".round(filesize("$img_name.png")/1000)." ko.");
?>
</font></small></small></body></html>
<?
function fpart($num) {
return($num - floor($num));
}
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
?>
http://www.dnl.freesurf.fr/NKS/pub/ca1.png
http://www.dnl.freesurf.fr/NKS/pub/ca2.png
http://www.dnl.freesurf.fr/NKS/pub/ca3.png
http://www.dnl.freesurf.fr/NKS/pub/ca4.png
http://www.dnl.freesurf.fr/NKS/pub/ca5.png
http://www.dnl.freesurf.fr/NKS/pub/ca6.png
http://www.dnl.freesurf.fr/NKS/pub/anim6.gif
http://www.dnl.freesurf.fr/NKS/pub/anim3.gif
http://www.dnl.freesurf.fr/NKS/pub/anim8.gif
http://www.dnl.freesurf.fr/NKS/pub/anim9.gif/*RULE*/ $grille[$y][$x][0] = fpart(($grille[$y-1][$x-1][0]+$grille[$y-1][$x][0]+$grille[$y-1][$x+1][0])/3*1.0001);
/*RULE*/ $grille[$y][$x][1] = fpart(($grille[$y-1][$x-1][1]+$grille[$y-1][$x][1]+$grille[$y-1][$x+1][1])/3*1.1);
/*RULE*/ $grille[$y][$x][2] = fpart(($grille[$y-1][$x-1][2]+$grille[$y-1][$x][2]+$grille[$y-1][$x+1][2])/3*1.2);
/*RULE*/ $grille[$y][$x][0] = fpart(($grille[$y-1][$x-1][0]+$grille[$y-1][$x][0]+$grille[$y-1][$x+1][0])/3*1.00005);
/*RULE*/ $grille[$y][$x][1] = fpart(($grille[$y-1][$x-1][1]+$grille[$y-1][$x][1]+$grille[$y-1][$x+1][1])/3*1.00005);
/*RULE*/ $grille[$y][$x][2] = fpart(($grille[$y-1][$x-1][2]+$grille[$y-1][$x][2]+$grille[$y-1][$x+1][2])/3*1.00005);
<small><small><font face="Verdana">
<?
set_time_limit(9999999);
$time_start_script = getmicrotime();
echo str_repeat(" ", 250);
$img_name = "nks4";
$grille = Array();
$steps = 400;
$border_left = 0;
$border_right = 400; // (even number for perfect symmetry)
$middle = round($border_right/2);
//*****************************************************************//
//********* Picture initialisation ********************************//
//*****************************************************************//
$image_width = $border_right+1;
$image_height = $steps;
$img = imagecreatetruecolor($image_width,$image_height);
$blanc = imagecolorallocate($img, 255,255,255);
//*****************************************************************//
//********* Image avec le texte ***********************************//
//*****************************************************************//
$img_texte = imagecreatetruecolor($image_width,$image_height);
$noir_texte = imagecolorallocate($img, 0,0,0);
$blanc_texte = imagecolorallocate($img, 255,255,255);
imagefilledrectangle ($img_texte,0, 0, $image_width-1, $image_height-1, $noir_texte);
$texte = "NKS";
$font = "VERDANAB.TTF";
//$font = "BLAZED.TTF";
//$font = "BABE.TTF";
$ww = 99999;
$size=500;
while($ww > 360) {
$size -= 1;
$box = imagettfbbox ($size,0,$font,$texte);
$ww = $box[2]-$box[0];
}
$hh = $box[7]-$box[1];
$x = round(($image_width-$ww)/2);
$y = round(($image_height-$hh)/2);
imagettftext($img_texte,$size,0,$x,$y,$blanc_texte,$font,$texte);
//*****************************************************************//
//*********** First line (initial condition) **********************//
//*****************************************************************//
$y = 0; $grille[$y] = Array();
for ($x = $border_left; $x <= $border_right; $x++) {
$grille[$y][$x] = Array(abs($x-$middle)/$middle,abs($x-$middle)/$middle,abs($x-$middle)/$middle);
/*DRAW*/ $color = imagecolorallocate($img, $grille[$y][$x][0]*255,$grille[$y][$x][1]*255,$grille[$y][$x][2]*255);
/*DRAW*/ imagesetpixel($img,$x,$y,$color);
}
//*****************************************************************//
for ($y = 1; $y <= $steps-1; $y++) {
/*PROGRESS*/ print(round($y/($steps-1)*100)."% ... ");flush();ob_flush();
$grille[$y] = Array();
//*****************************************************************//
//*********** Borders (limit condition) ***************************//
//*****************************************************************//
$grille[$y][$border_left] = Array(1,1,1);
$grille[$y][$border_right] = Array(1,1,1);
//*****************************************************************//
for ($x = $border_left+1; $x <= $border_right-1; $x++) {
$grille[$y][$x] = Array();
$rgb = imagecolorat($img_texte,$x,$y);
$rgb_arr = imagecolorsforindex($img_texte, $rgb);
$color_moy = (($rgb_arr['red']+$rgb_arr['green']+$rgb_arr['blue'])/3)/255;
if ($color_moy > 0) {
/*RULE*/ $grille[$y][$x][0] = fpart(($grille[$y-1][$x-1][0]+$grille[$y-1][$x][0]+$grille[$y-1][$x+1][0])/3*1.00005);
/*RULE*/ $grille[$y][$x][1] = fpart(($grille[$y-1][$x-1][1]+$grille[$y-1][$x][1]+$grille[$y-1][$x+1][1])/3*1.00005);
/*RULE*/ $grille[$y][$x][2] = fpart(($grille[$y-1][$x-1][2]+$grille[$y-1][$x][2]+$grille[$y-1][$x+1][2])/3*1.00005);
} else {
/*RULE*/ $grille[$y][$x][0] = fpart(($grille[$y-1][$x-1][0]+$grille[$y-1][$x][0]+$grille[$y-1][$x+1][0])/3*1.0001);
/*RULE*/ $grille[$y][$x][1] = fpart(($grille[$y-1][$x-1][1]+$grille[$y-1][$x][1]+$grille[$y-1][$x+1][1])/3*1.1);
/*RULE*/ $grille[$y][$x][2] = fpart(($grille[$y-1][$x-1][2]+$grille[$y-1][$x][2]+$grille[$y-1][$x+1][2])/3*1.2);
}
/*DRAW*/ $color = imagecolorallocate($img, $grille[$y][$x][0]*255,$grille[$y][$x][1]*255,$grille[$y][$x][2]*255);
/*DRAW*/ imagesetpixel($img,$x,$y,$color);
}
/*DRAW*/ $color = imagecolorallocate($img, $grille[$y][$border_left][0]*255,$grille[$y][$border_left][1]*255,$grille[$y][$border_left][2]*255);
/*DRAW*/ imagesetpixel($img,$border_left,$y,$color);
/*DRAW*/ $color = imagecolorallocate($img, $grille[$y][$border_right][0]*255,$grille[$y][$border_right][1]*255,$grille[$y][$border_right][2]*255);
/*DRAW*/ imagesetpixel($img,$border_right,$y,$color);
/*MEM*/ unset($grille[$y-1]);
}
//header("Content-type: image/png");
imagePNG($img,"$img_name.png");imagedestroy($img);
print("<hr><center><img src=\"$img_name.png\"></center><hr>Généré en ". round(getmicrotime()-$time_start_script,1) ." secondes.");
?>
</font></small></small>
<?
function fpart($num) {
return($num - floor($num));
}
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
?>
Forum Sponsored by Wolfram Research
© 2004-2008 Wolfram Research, Inc. | Powered by vBulletin 2.3.0 © 2000-2002 Jelsoft Enterprises, Ltd. |
Disclaimer
vB Easy Archive Final - Created by Xenon and modified/released by SkuZZy from the Job Openings