|
Bad scaling with al_set_display_icon() |
Bruce Pascoe
Member #15,931
April 2015
|
I've recently found that, using al_set_display_icon(), passing a bitmap larger than 32x32 ends with a crummy-looking taskbar icon. From a cursory look at the Allegro source, it seems like it uses memory bitmaps to scale the image to the proper size. I'm wondering if there's a way I can work around this, as I know there are platforms using icons larger than 32x32 and I still want it to look decent.
|
SiegeLord
Member #7,827
October 2006
|
I was under the impression that that is what al_set_display_icons was for, you'd pass it a whole bunch of icons of different sizes and it'd somehow pick one that looks best. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Bruce Pascoe
Member #15,931
April 2015
|
I was hoping I wouldn't have to do that. Currently I have it load a single image file, icon.png, from the game directory to apply to the window, with this I would have to have multiple files (or maybe some sort of icon atlas) and load them all. That said, I partially worked around it by doing this: As I'm making a general-purpose game engine, my requirements are a bit different than if I were just making a standalone game--I want to keep things as simple as possible.
|
SiegeLord
Member #7,827
October 2006
|
Well, you could create the different sizes programmatically (I guess that's what you're essentially doing) and pass them to that function. Start with a 512x512 icon and then scale it down a few times with whatever high quality method you chose and then pass them to Allegro. It's an interesting question of whether al_set_display_icon should have configurable icon scaling quality. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
Bruce Pascoe
Member #15,931
April 2015
|
In case you're curious, this question came about due to my recent discovery that Windows 10 is going to support 768x768 icons, so I was getting ready by scaling up my icons to that size. Allegro didn't much appreciate me passing that huge image to al_set_display_icon though, it looked like crap.
|
Thomas Fjellstrom
Member #476
June 2000
|
Icons tend to look like crap if you scale them too much. To look best, you want to have a few sizes, that then get scaled up or down to the nearest platform supported size (android apps do this a lot, it saves on a bunch of copies of icons, but provides the decent looking results at most display sizes and pixel densities). -- |
beoran
Member #12,636
March 2011
|
I think it would be nice if we had an API which can help discover just which sizes ans usages of icons are supported. Maybe something like this: typedef struct ALLEGRO_ICON_INFO { int width; // Icon width int height; // Icon height int usage; // Flag that describes what the icon is used for, etc. } ALLEGRO_ICON_INFO; int al_get_num_icons(ALLEGRO_DISPLAY * disp); ALLEGRO_ICON_INFO * al_get_icon_info(ALLEGRO_DISPLAY * disp, int index);
|
|