In photshop, select all in the layer with the gradiant, copy that to the clipboard. go to the layer you want the mask applied, create a new mask. make sure the mask is selected, not the part of the layer you paint in. paste that sucker in there, and BAM. you've your mask.