I'm trying to intimidate a site that can be drawn onto canvasand make it into a GIF
So far I have succeeded, but I have problems with colors I will explain how my site works:
1) The user draws on the canvas and his shroud in the object in the array as follows:
[{x: 1, y:1, radius: 8, color: "blue"}, {x: 2, y:3, radius: 16, color: "red"} ...]
Each mouse move on the canvas represents an object in the array
Now I am posting it to a php page as json. Now on the php page I have an array of the given colors, for example:
$colors = array(
'brown' => array(
165,
42,
42
),
'cadetblue' => array(
95,
158,
160
),
'chartreuse' => array(
127,
255,
0
),
'chocolate' => array(
210,
105,
30
),
'coral' => array(
255,
127,
80
),
'crimson' => array(
220,
20,
60
)
);
So far so good. Now, when I draw the image, I loop every object in the array that is sent to m from the client, I take the color and create it using the php function and draw a filled ellipse. The code:
for ($i = 0; $i <= $j; $i++) {
$colorName = $model[$i]->color;
$color = imagecolorallocate($img, $colors[$colorName][0] ,$colors[$colorName][1] , $colors[$colorName][2]);
imagefilledellipse($img, $model[$i]->x, $model[$i]->y, $model[$i]->radius * 2, $model[$i]->radius * 2, $color);
}
, , -
, , , , , .
:
-:

, :

PHP- :
http://pastebin.com/0BGUeCF3
, :
http://pastebin.com/CPzpJq7f
:
chartreuse , exsist ,