Design and metrology of freeform gradient-index optics for imaging and illumination