<?php

$width = $_POST['width'];
$height = $_POST['height'];

$points = simplexml_load_string($_POST['pointData']);

$img = imagecreatetruecolor($width, $height);

$limit = count($points->point);

for ($j=0; $j < $limit; $j++)
{
   $x = $points->point[$j]->x;
   $y = $points->point[$j]->y;

   $color = $points->point[$j]->c;
   $color = hexdec($color);

   imagesetpixel($img, $x, $y, $color);
}

header('Content-Type: image/png');
imagepng($img, 'render_' . time() . '.png');

?>