I’m trying to draw text with a gradient. The white box surrounds the component and the gradient should go from the first white line to the second white line, this works fine on macOS, but the gradient is in the wrong spot on Windows.
I tried two methods. Create a gradient with a smaller rect, or a gradient with a larger rect, and use addColour to define the position of the gradient.
It’s still broken on my machine. I use a desktop scale of 200%. Before this change, the gradient was in the wrong location, now it doesn’t apply a gradient at all, or the transform is different, so only the color on the left side of the gradient is used everwhere.
I’ve added a g.fillRect () (for debugging/demonstration) right above the g.drawText call. The lines with the gradient on the right, should also affect the text, but as you can see, the text stays the same color.
The boxes without a gradient in them, only use g.setColour and as such work as intended.
I have updated the test program to show the issue still exists. The inner component is now scaled, when you resize the window, the scale is adjusted. When scale = 1.0 it works, otherwise it is broken. Note, I believe the issue is the gradient isn’t taking the position the text is being drawn at into account. On Line 29, change gradRect to getLocalBounds() and it works fine.
I have a new fix, would you mind taking a look to see if it fixes all issues for you? I think it’s right, but I thought that about the previous one too.
Will this be merged soon? The version in the development branch is broken. Even though not every possible case (rotation, shearing, etc.) was tested, this is still better than the current version.