Hi,
when I paint something into an image and get the image back to screen, the
result is not the same as if I’d painted directly to screen. The result is a little
more blurred. Is there a way to get exactly the same result like painting to screen?
So here are the results. Normal paintng on the left side, painting to an image on the
right side:

Code:
void MainComponent::paint (juce::Graphics& g)
{
// Left Part draws to Screen
juce::Rectangle<float> r1(50, 50, 50, 50);
paintKnob(g, r1);
// Right Part draws into Image and copy Image back to Screen
juce::Image img(juce::Image::ARGB, 50, 50, false);
juce::Graphics gi(img);
juce::Rectangle<float> r2(0, 0, 50, 50);
paintKnob(gi, r2);
g.drawImage(img, 120, 50, 50, 50, 0, 0, 50, 50);
}
void MainComponent::paintKnob(juce::Graphics& g, juce::Rectangle<float> r)
{
g.fillAll(getLookAndFeel().findColour(juce::ResizableWindow::backgroundColourId));
g.setColour(juce::Colours::grey);
g.drawRect(r);
g.setColour(juce::Colours::black);
g.fillEllipse(r.reduced(5));
g.setColour(juce::Colours::grey);
g.fillEllipse(r.reduced(8));
g.setColour(juce::Colours::lightgrey);
g.fillEllipse(r.reduced(11));
g.setColour(juce::Colours::black);
g.drawLine(r.getCentreX(), r.getCentreY(), r.getX() + 16, r.getY() + 16, 3);
}
