Witam Was (IMG:
style_emoticons/default/smile.gif)
Mam nastepujacy problem... otoz tworze taki skrypt-ankiete, gdzie odpowiadacie dajmy na to - na 15 pytan. Kazde z tych pytan przyporzadkowane jest jednej z 3ch grup (uzytkownik nie wie jakiej). Na koncu wyswietla mi sie nastepujacy rezultat:
(IMG:
http://img252.imageshack.us/img252/5340/schematu.png)
1) Kazdy okrag reprezentuje osobna grupe.
2) Jak zauwazyliscie, uzytkownik dal najwiecej poprawnych odpowiedzi na pytania z grupy 1. i 2., natomiast w 3. mniej (dlatego okrag jest mniejszy).
Ogolnie mam juz pewien kod (ponizej). Moj problem polega na tym, by:
1) pokolorowac czesc wspolna okregow na wybrany kolor
2) okregi musza byc zawsze generowane od srodka. W ponizszym kodzie, jesli wygenerujemy za male okregi, nie nachodza one na siebie.
PS. Sorki za brak PL znakow.
public function rysuj($circle_1 = 100, $circle_2 = 100, $circle_3 = 100)
{
$circle_1 = $circle_1/100;
$circle_2 = $circle_2/100;
$circle_3 = $circle_3/100;
$image_width = 910;
$image_height = 600;
if($image_width < $image_height){
$base = $image_width;
}else{
$base = $image_height;
}
// utworzenie pustego obrazka
$image = imagecreatetruecolor($image_width, $image_height);
// kolory
$white = imagecolorallocate($image, 255, 255, 255);
$black = imagecolorallocate($image, 128, 128, 128);
$orange = imagecolorallocate($image, 214, 111, 0);
// wypelnienie
imagefill($image, 0, 0, $white);
$circle_1_height = round((($base/1
.6
))*$circle_1); $circle_1_x = $image_width/2;
$circle_1_y = ($image_height/3);
$circle_2_height = round((($base/1
.6
))*$circle_2); $circle_2_x = $image_width/3;
$circle_2_y = ($image_height/3)*2;
$circle_3_height = round((($base/1
.6
))*$circle_3); $circle_3_x = ($image_width/3)*2;
$circle_3_y = ($image_height/3)*2;
// rysowanie okregow
imageellipse($image, $circle_1_x, $circle_1_y, $circle_1_height, $circle_1_height, $orange);
imageellipse($image, $circle_2_x, $circle_2_y, $circle_2_height, $circle_2_height, $orange);
imageellipse($image, $circle_3_x, $circle_3_y, $circle_3_height, $circle_3_height, $orange);
// zmiekczenie linii
imagefilter($image, IMG_FILTER_SMOOTH, 4);
// wynik obrazka
header("Content-type: image/png"); imagepng($image);
imagedestroy($image);
}