I am working on creating a linear gradient, and writing pixels into an image from left to right. I have this working well.
Now, I need to be able to generate the gradient based on an angle. I was thinking I could basically create the linear gradient, and the rotate based on the angle, and crop (since Ill need to fill a larger area when I rotate).
Looking of ofPixels, there are methods to rotate by 90 degrees, but not arbitrary angles. So, my question is, what is the best approach for rotating ofPixels (or ofImage) by an arbitrary angle, and then copying / cropping a region of those pixels.
Basically like the attached image.
(I realize a better solution might be to just have my algorithm draw at an arbitrary angle, but I want to see if I can get this approach working first).
I think this is much easier and faster to do on the gpu, just create a mesh with color coordinates to create your gradient, draw it to an fbo rotated and then draw a subsection of the fbo texture using drawSubsection. Even with drawing to an fbo it’ll be faster than generating the pixels one by one in the cpu