/** * Allocates a color in the given image. * * Userdefined color specifications get translated into * an array of rgb values. * * @param resource Image handle * @param mixed (Userdefined) color specification * @return resource Image color handle * @see color2RGB() * @access public */ function allocateColor(&$img, $color) { $color = Image_Color::color2RGB($color); return ImageColorAllocate($img, $color[0], $color[1], $color[2]); }
function testColor2RGB_Named() { $result = Image_Color::color2RGB('red'); $this->assertEquals(array(255, 0, 0), $result); }