Hi all,
to rescale the components in my application window, I followed roughly the Tutorial on Android screen sizes.
Manage Android screen sizes
Sometimes, when using AffineTransform::scale on a component, the edges get blurry.
Is there a way to avoid that?
Here is an example code with a simple rectangle:
class SimpleRectanlge: public Component {
public:
SimpleRectanlge() {setSize(215, 108); } ~SimpleRectanlge() {} void paint (Graphics& g) override { g.fillAll(Colours::yellowgreen); } void resized() override { }private:
};
class MainComponent : public Component
{
public :
//==============================================================================
MainComponent();
~MainComponent();
//==============================================================================
void paint (Graphics&) override ;
void resized() override ;
private :
SimpleRectanlge rect;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainComponent)
};
MainComponent::MainComponent()
{
addAndMakeVisible(rect);
setSize(600, 300);
}
MainComponent::~MainComponent()
{
}
//==============================================================================
void MainComponent::paint (Graphics& g)
{
// (Our component is opaque, so we must completely fill the background with a solid colour)
g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId));
}
void MainComponent::resized()
{
auto rectArea = getLocalBounds().removeFromBottom(50).reduced(10);
rect.setBounds(rectArea);
rect.setTransform(juce::AffineTransform::scale(0.73, 0.73));
rect.setCentrePosition(rectArea.getCentre());
}


