1--TEST-- 2Testing imagetruecolortopalette() of GD library 3--CREDITS-- 4Rafael Dohms <rdohms [at] gmail [dot] com> 5--EXTENSIONS-- 6gd 7--SKIPIF-- 8<?php 9 if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.2', '<')) { 10 die("skip test requires GD 2.2.2 or higher"); 11 } 12 if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible"); 13 if (!(imagetypes() & IMG_PNG)) { 14 die("skip No PNG support"); 15 } 16?> 17--FILE-- 18<?php 19$image = imagecreatetruecolor(150, 150); 20 21$a = imagecolorallocate($image,255,0,255); 22$b = imagecolorallocate($image,0,255,255); 23 24$half = imagefilledarc ( $image, 75, 75, 70, 70, 0, 180, $a, IMG_ARC_PIE ); 25$half2 = imagefilledarc ( $image, 75, 55, 80, 70, 0, -180, $b, IMG_ARC_PIE ); 26 27var_dump(imagetruecolortopalette($image, true, 2)); 28 29include_once __DIR__ . '/func.inc'; 30test_image_equals_file(__DIR__ . '/imagetruecolortopalette_basic.png', $image); 31?> 32--EXPECT-- 33bool(true) 34The images are equal. 35