draw_pie($canvas, 200, 200, 100, 225, 300, 'cyan'); draw_pie($canvas, 200, 200, 100, 300, 360, 'orange'); test_shape($canvas); test_path($canvas); test_composite($canvas); test_annotation($canvas); // $actual_file = __DIR__.'/draw_example.out.png'; $expected_file = __DIR__ . '/draw_example.png'; // $canvas->writeImage($actual_file); $bg = new ImagickPixel('white'); $actual_iterator = new ImagickPixelIterator($canvas); $expected_iterator = new ImagickPixelIterator(new Imagick($expected_file)); list($total, $same, $similar, $diff) = array(0, 0, 0, 0); $actual_iterator->rewind(); $expected_iterator->rewind(); while ($actual_iterator->valid() && $expected_iterator->valid()) { if ($expected_iterator->key() !== $expected_iterator->key()) { var_dump(array('actual' => $expected_iterator->key(), 'expected' => $expected_iterator->key())); } $actual_pixels = $actual_iterator->current(); $expected_pixels = $expected_iterator->current(); foreach (array_map(null, $actual_pixels, $expected_pixels) as $value) { list($actual, $expected) = $value; if ($actual->isPixelSimilar($bg, 0.01) && $expected->isPixelSimilar($bg, 0.01)) { continue; } ++$total; if ($actual->isPixelSimilar($expected, 0.01)) { ++$same; } else { if ($actual->isPixelSimilar($expected, 0.2)) {