Sure, I can draw each pixel myself. But I am not sure how to combine the pieces (background, gradient, noise) to achieve the desired effect.
I was thinking this is what Illustrator does:
[code]void BackgroundPanel::paint(Graphics& g)
{
juce::Rectangle r = getLocalBounds();
// Background
g.setColour(Colour::fromRGBA(20, 20, 20, 255));
g.fillRect(r);
// Opacity Mask
juce::Image mask(juce::Image::SingleChannel, getWidth(), getHeight(), true);
Graphics maskG(mask);
ColourGradient cg(Colour::fromFloatRGBA(1.0f, 1.0f, 1.0f, 0.2f), r.getX() + (r.getWidth() / 2), r.getY() + (r.getHeight() / 2),
Colour::fromFloatRGBA(0.0f, 0.0f, 0.0f, 0.2f), r.getRight(), r.getY() + (r.getHeight() / 2), true);
maskG.setGradientFill(cg);
maskG.fillAll();
// Noise
juce::Image noise(juce::Image::ARGB, getWidth(), getHeight(), true);
Graphics noiseG(noise);
AffineTransform t;
noiseG.reduceClipRegion(mask, t); // Apply opacity mask
File noiseFile = sc::Resources::ResourcePathFromName("Grain.png");
Image noiseTile = ImageCache::getFromFile(noiseFile);
noiseG.setTiledImageFill(noiseTile, 0, 0, 1.0f);
noiseG.fillAll();
// Draw masked noise on top of background
g.drawImageAt(noise, 0, 0, false);
}[/code]
But this is what I get:
[attachment=0]My-Background.png[/attachment]
The radial gradient can still be seen clearly. Its close but not (yet) a background texture that can be used. In the Illustrator example the radial gradient is not visible at all.