0 && (abs($fR-$bR)>127 || abs($fG-$bG)>127 || abs($fB-$bB)>127)) $bg=imagecolorallocate($sprite,$bR,$bG,$bB); else $bg=imagecolorallocate($sprite,255,255,255); imagefilledrectangle($sprite,0,0,self::$spriteZ,self::$spriteZ,$bg); switch($shape) { case 0: // empty $shape=array(); break; case 1: // fill $shape=array( 0,0, 1,0, 1,1, 0,1 ); break; case 2: // diamond $shape=array( 0.5,0, 1,0.5, 0.5,1, 0,0.5 ); break; case 3: // reverse diamond $shape=array( 0,0, 1,0, 1,1, 0,1, 0,0.5, 0.5,1, 1,0.5, 0.5,0, 0,0.5 ); break; case 4: // cross $shape=array( 0.25,0, 0.75,0, 0.5,0.5, 1,0.25, 1,0.75, 0.5,0.5, 0.75,1, 0.25,1, 0.5,0.5, 0,0.75, 0,0.25, 0.5,0.5 ); break; case 5: // morning star $shape=array( 0,0, 0.5,0.25, 1,0, 0.75,0.5, 1,1, 0.5,0.75, 0,1, 0.25,0.5 ); break; case 6: // small square $shape=array( 0.33,0.33, 0.67,0.33, 0.67,0.67, 0.33,0.67 ); break; case 7: // checkerboard $shape=array( 0,0, 0.33,0, 0.33,0.33, 0.66,0.33, 0.67,0, 1,0, 1,0.33, 0.67,0.33, 0.67,0.67, 1,0.67, 1,1, 0.67,1, 0.67,0.67, 0.33,0.67, 0.33,1, 0,1, 0,0.67, 0.33,0.67, 0.33,0.33, 0,0.33 ); break; } /* apply ratios */ for ($i=0;$i0) imagefilledpolygon($sprite,$shape,count($shape)/2,$fg); return $sprite; } }