Original Post
Hi guys, Happy Thanksgiving.
I''m trying to code my own color gradient like they have in the paint programs. They usually have a few options like linear, rectangular, circular, and radial; right now I just want to understand the linear version with two colors.
I can easily do it in the four primary directions (0, 90, 180, 270 degrees) but I can''t figure out how to do different angles. So, for example, if I want 45 degrees it will go from the top left to the bottom right. Do I take the pixel position and rotate it ? (I actually just thought of that while writing this.)
I guess it''s best to have the pixel values range from 0.0...1.0, I know what to do after that (like color interpolation using more than two colors and stuff like that.)
Thanks.