Generation of uniform-intensity light beams with controllable spatial shapes