I’ve spent a couple hours trying to make an MCVE of this but haven’t been able to replicate the problem. The main program is at 2k lines so I can’t post it here. I’ve been stuck on this for a while so really hoping someone has a hint.
I have a design I’m generating pictured here:
When I render this to the screen it looks fine.
When I render it to a PGraphic I’ve created and display it via image() it still looks fine, but when I do a rotate() before calling image() to render it to the screen, the lines end up distorted.
Here’s a zoom:
This doesn’t happen when I call rotate() and render it directly to the screen.
I thought this might be a problem with antialiasing being used once on the PGraphic and once when it was rendered via image(), so I tried noSmooth() on the PGraphic, and got different, but still broken results.
Here’s noSmooth() with no rotation:
And here it is with rotation:
I thought I found the answer when I came across this thread: offscreen PGraphics is ugly which suggests that the problem is antialiasing mixing my black pixels with transparent pixels, from the PGraphic, but drawing a background to my PGraphic as soon as I instantiate it doesn’t seem to have an effect. All of the examples above have pg.background(200) called right after instantiation and before anything else is drawn to them.
I’ll keep trying to replicate the problem in a MCVE, but would much appreciate any ideas on what’s going wrong.