Controllable beam shaping of coherent and incoherent beams by a laser amplifier