Using an RGB matrix, I am attempting to make a manipulation tool using grayscale. For instance, you can apply a gradient across the image as well as change the color of certain points at will. Even though the image below is black and white, the gradient will apply a full greyscale. I was wondering if it is possible to remove the black values and apply this gradient tool to just the white portion. For example, the left side would of the white area would stay white and would transition to black moving closer to the other side of the white area. I can't seem to find a way to completely remove the black values.
So my question is - is there a way to completely remove these values from the rgb matrix, or will I have to try to find a work around using NaN values or some other equivalent? My apologies if the question is too ambiguous.