I’m trying to draw some icons in my AlertWindows. They look wonderful on the Mac, and seriously pixelated on Windows.
The icons are all stored as 24-bit PNG with transparency, 512 x 512.
The examples here use the default JUCEAppIcon.png from the AudioPluginHost (also 512 x 512).
I notice that the screen snapshots I took are 96 dpi on Windows, and 144 dpi on Mac, but I don’t think that has anything to do with it.
First, the Mac:
Same thing, on Windows 10:
In fact, the text looks like crap on Windows as well. Is there some setting I’m missing?
Here is a portion of the relevant code for drawing the icons in my override of LookAndFeel::drawAlertBox()
:
auto iconWidth = 64;
Rectangle<int> iconRect (10, 10, iconWidth, iconWidth);
auto appIcon = ImageCache::getFromMemory(BinaryData::JUCEAppIcon_png, BinaryData::JUCEAppIcon_pngSize);
g.setImageResamplingQuality(Graphics::highResamplingQuality);
g.drawImageWithin(appIcon, iconRect.getX(), iconRect.getY(), iconRect.getWidth(), iconRect.getHeight(), RectanglePlacement::fillDestination );
Image typeIcon;
switch (alert.getAlertType())
{
case AlertWindow::WarningIcon:
typeIcon = ImageCache::getFromMemory(BinaryData::warning_png, BinaryData::warning_pngSize);
break;
case AlertWindow::QuestionIcon: // we are using for Stop
typeIcon = ImageCache::getFromMemory(BinaryData::stop_png, BinaryData::stop_pngSize);
break;
case AlertWindow::InfoIcon:
typeIcon = ImageCache::getFromMemory(BinaryData::info_png, BinaryData::info_pngSize);
break;
default: // noIcon
break;
}
if (typeIcon.isValid())
{
auto typeIconWIdth = 32;
Rectangle<int> typeIconRect (iconRect.getCentreX() + 10, iconRect.getCentreY() + 10, typeIconWIdth, typeIconWIdth);
g.drawImageWithin(typeIcon, typeIconRect.getX(), typeIconRect.getY(), typeIconRect.getWidth(), typeIconRect.getHeight(), RectanglePlacement::fillDestination );
}
I tried g.setImageResamplingQuality(Graphics::highResamplingQuality)
although I think I read that has no effect on downsampling. Anyway, no effect.