Tunable waveguide transmission gratings based on active gain control